index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <div>
  3. <Toptitle>
  4. <template #left>
  5. <Button type="primary" @click="is_open = !is_open">{{
  6. is_open ? "收缩" : "展开"
  7. }}</Button>
  8. </template>
  9. <template #right>
  10. <Button type="primary" ghost @click="handleExport">导出</Button>
  11. </template>
  12. </Toptitle>
  13. <div
  14. :style="
  15. is_open
  16. ? 'max-height:200px;transition: all .5s;'
  17. : 'max-height:0px;overflow: hidden;transition: all .5s;'
  18. "
  19. >
  20. <Form :label-width="120" style="display: flex; flex-wrap: wrap">
  21. <FormItem label="起止日期">
  22. <DatePicker
  23. v-model="searchData.crt_time"
  24. clearable
  25. type="daterange"
  26. style="width: 200px"
  27. transfer
  28. placeholder="年/月/日"
  29. />
  30. </FormItem>
  31. <FormItem label="所属集团">
  32. <Select
  33. transfer
  34. filterable
  35. clearable
  36. v-model="searchData.company_id"
  37. style="width: 200px"
  38. >
  39. <Option
  40. v-for="item in companyList"
  41. :key="item.id"
  42. :value="item.id"
  43. :label="item.title"
  44. />
  45. </Select>
  46. </FormItem>
  47. <FormItem label="仓库名称">
  48. <Select
  49. transfer
  50. filterable
  51. clearable
  52. v-model="searchData.storehouse_id"
  53. style="width: 200px"
  54. >
  55. <Option
  56. v-for="item in storehouseList"
  57. :key="item.id"
  58. :value="item.id"
  59. :label="item.title"
  60. />
  61. </Select>
  62. </FormItem>
  63. <FormItem label="卷膜分类">
  64. <Select
  65. v-model="searchData.b_r_f_id"
  66. clearable
  67. filterable
  68. transfer
  69. style="width: 200px"
  70. >
  71. <Option
  72. v-for="item in basicRollFilmList"
  73. :key="item.id"
  74. :value="item.id"
  75. :label="item.title"
  76. />
  77. </Select>
  78. </FormItem>
  79. <FormItem label="卷膜代码">
  80. <Input
  81. clearable
  82. placeholder="请输入"
  83. style="width: 200px"
  84. v-model="searchData.code"
  85. />
  86. </FormItem>
  87. <FormItem label="卷膜型号">
  88. <Select
  89. v-model="searchData.roll_film_id"
  90. clearable
  91. filterable
  92. style="width: 200px"
  93. transfer
  94. >
  95. <Option
  96. v-for="item in rollFilmList"
  97. :key="item.id"
  98. :value="item.id"
  99. :label="item.title"
  100. />
  101. </Select>
  102. </FormItem>
  103. <FormItem label="卷膜编号">
  104. <Input
  105. clearable
  106. placeholder="请输入"
  107. style="width: 200px"
  108. v-model="searchData.roll_film_number"
  109. />
  110. </FormItem>
  111. <FormItem label="单据类型">
  112. <Select
  113. v-model="searchData.order_type_title"
  114. clearable
  115. filterable
  116. style="width: 200px"
  117. transfer
  118. >
  119. <Option label="领料单" value="LL"/>
  120. <Option label="施工单" value="SG"/>
  121. <Option label="退料单" value="TL"/>
  122. <Option label="调拨单" value="DB"/>
  123. <Option label="盘点单" value="PD"/>
  124. <Option label="初期单" value="QC"/>
  125. <Option label="施工单:红冲" value="SGHC"/>
  126. </Select>
  127. </FormItem>
  128. <FormItem :label-width="40">
  129. <Button type="primary" @click="handleSearch">查询</Button>
  130. </FormItem>
  131. </Form>
  132. </div>
  133. <div class="table_content">
  134. <vxe-grid v-bind="gridOptions"
  135. :footer-method="footerMethod"
  136. @checkbox-all="selectAllEvent"
  137. @checkbox-change="selectChangeEvent">
  138. <template #order_number="{ row }">
  139. <a
  140. @click="handleClick(row)"
  141. :disabled="row.order_type ? false : true"
  142. >{{ row.order_number }}</a
  143. >
  144. </template>
  145. </vxe-grid>
  146. </div>
  147. </div>
  148. </template>
  149. <script>
  150. export default {
  151. data() {
  152. return {
  153. selectData:[],
  154. basicRollFilmList: [],
  155. rollFilmList: [],
  156. storehouseList: [],
  157. companyList: [],
  158. is_open: true,
  159. sort: null,
  160. is_show: false,
  161. searchData: {},
  162. proxyData: {},
  163. gridOptions: {
  164. border: true,
  165. resizable: true,
  166. maxHeight: 'auto',
  167. showOverflow: true,
  168. showFooter: true,
  169. align: 'left',
  170. columns: [
  171. { type: 'checkbox', width: 50, fixed: 'left' },
  172. { type: 'seq', title: '序号', width: 80 },
  173. { field: 'company_name', title: '所属集团', showHeaderOverflow: true, minWidth: 100 },
  174. { field: 'storehouse_name', title: '仓库名称', showHeaderOverflow: true, minWidth: 100 },
  175. { field: 'b_r_f_name', title: '卷膜分类', showHeaderOverflow: true, minWidth: 100 },
  176. { field: 'code', title: '卷膜代码', showHeaderOverflow: true, minWidth: 100 },
  177. { field: 'title', title: '卷膜型号', showHeaderOverflow: true, minWidth: 100 },
  178. { field: 'roll_film_number', title: '卷膜编号', showHeaderOverflow: true, minWidth: 100 },
  179. { field: 'unit', title: '计量单位', showHeaderOverflow: true, minWidth: 100 },
  180. { field: 'crt_time', title: '业务日期', showHeaderOverflow: true, minWidth: 100 },
  181. {
  182. field: 'order_number', title: '单据编码', showHeaderOverflow: true, minWidth: 140, slots: {
  183. default: 'order_number'
  184. }
  185. },
  186. { field: 'order_name', title: '单据类型', showHeaderOverflow: true, minWidth: 100 },
  187. { field: 'start_number', title: '期初数量', showHeaderOverflow: true, minWidth: 100 },
  188. { field: 'in_number', title: '本期收入', showHeaderOverflow: true, minWidth: 100 },
  189. { field: 'out_number', title: '本期发出', showHeaderOverflow: true, minWidth: 100 },
  190. { field: 'end_number', title: '期末结存', showHeaderOverflow: true, minWidth: 100 },
  191. ],
  192. data: []
  193. },
  194. }
  195. },
  196. created() {
  197. //获取集团
  198. this.axios.post('/api/companyList').then(res => {
  199. this.companyList = res.data.data;
  200. })
  201. //获取仓库
  202. this.axios.post('/api/storehouseList').then(res => {
  203. this.storehouseList = res.data.data;
  204. })
  205. //获取卷膜型号
  206. this.axios.post('/api/rollFilmList').then(res => {
  207. this.rollFilmList = res.data.data
  208. })
  209. //获取卷膜分类
  210. this.axios.post('/api/basicRollFilmList').then(res => {
  211. this.basicRollFilmList = this.getArr(res.data);
  212. })
  213. },
  214. mounted() {
  215. },
  216. methods: {
  217. selectAllEvent(e) {
  218. this.selectData = e.records;
  219. },
  220. selectChangeEvent(e) {
  221. this.selectData = e.records;
  222. },
  223. async handleExport(){
  224. if(this.selectData.length==0){
  225. return this.$Message.warning('请选择需要导出的数据!')
  226. }
  227. let id = this.selectData.map(v=>v.id);
  228. const res = await this.axios.post('/api/exportFileReport',{type:2,id,...this.proxyData})
  229. if(res.code === 200){
  230. let url = `${this.$store.state.ip}/api/getExport/${res.data.file}`
  231. location.href = url
  232. }
  233. },
  234. handleClick(row) {
  235. let url = '';
  236. let title;
  237. switch (row.order_type) {
  238. case 'PD'://盘点
  239. url = '/cms/BusinessManagement/InventorySheet/detail';
  240. title = '盘点单详情';
  241. break;
  242. case 'SG'://施工
  243. url = '/cms/BusinessManagement/Construction/detail';
  244. title = '施工单详情';
  245. break;
  246. case 'LL'://领料
  247. url = '/cms/BusinessManagement/Picking/detail';
  248. title = '领料单详情';
  249. break;
  250. case 'TL'://退料
  251. url = '/cms/BusinessManagement/MaterialReturn/detail';
  252. title = '退料单详情';
  253. break;
  254. case 'DB'://调拨
  255. url = '/cms/BusinessManagement/TransferOrder/detail';
  256. title = '调拨单详情';
  257. break;
  258. }
  259. this.$router.push({ path: url, query: { order_number: row.order_number, title, type: 3 } })
  260. },
  261. footerMethod({ columns, data }) {
  262. return [
  263. columns.map((column, index) => {
  264. if (index === 0) {
  265. return '合计'
  266. } else if (['in_number','out_number','start_number','end_number'].includes(column.property)) {
  267. return this.sumNum(data, column.property)
  268. }
  269. return null
  270. })
  271. ]
  272. },
  273. sumNum(list, field) {
  274. let count = 0
  275. list.forEach(item => {
  276. count += Number(item[field] ? item[field] : 0)
  277. })
  278. return count.toFixed(2)
  279. },
  280. getArr(arr) {
  281. let data = [];
  282. arr.forEach(ele => {
  283. data.push(ele);
  284. if (ele.children.length != 0) {
  285. data = [...data, ...this.getArr(ele.children)];
  286. }
  287. });
  288. return data;
  289. },
  290. handleSearch() {
  291. this.proxyData = JSON.parse(JSON.stringify(this.searchData));
  292. this.proxyData.crt_time = [this.proxyData.crt_time[0] ? Date.parse(this.proxyData.crt_time[0]).toString().slice(0, 10) : '', this.proxyData.crt_time[1] ? (Date.parse(this.proxyData.crt_time[1])+86400000-1).toString().slice(0, 10) : '']
  293. this.initData(this.proxyData);
  294. },
  295. initData(row) {
  296. this.axios.post('/api/RollFilmInventoryInAndOutList', { ...row }).then(res => {
  297. this.gridOptions.data = res.data;
  298. this.selectData = [];
  299. })
  300. },
  301. }
  302. }
  303. </script>
  304. <style lang="scss" scoped>
  305. .form_item {
  306. margin-bottom: 15px !important;
  307. }
  308. .table_content {
  309. height: calc(100% - 200px);
  310. }
  311. </style>