index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. <template>
  2. <div id="inventoryBalance">
  3. <el-card shadow="never">
  4. <!-- 数据表格 -->
  5. <div>
  6. <search-table @search="reload"></search-table>
  7. </div>
  8. <ele-pro-table
  9. ref="table"
  10. class="table"
  11. :columns="columns"
  12. :pageSize="20"
  13. :datasource="datasource"
  14. height="calc(100vh - 405px)"
  15. full-height="calc(100vh - 116px)"
  16. tool-class="ele-toolbar-form"
  17. :needPage="false"
  18. >
  19. <!-- <template v-slot:action="{ row }">
  20. <el-link
  21. type="primary"
  22. :underline="false"
  23. icon="el-icon-view"
  24. @click="add(true, row)"
  25. >
  26. 详情
  27. </el-link>
  28. <el-link
  29. type="primary"
  30. :underline="false"
  31. icon="el-icon-download"
  32. @click="downLoad(row)"
  33. >
  34. 下载
  35. </el-link>
  36. </template> -->
  37. </ele-pro-table>
  38. </el-card>
  39. </div>
  40. </template>
  41. <script>
  42. import searchTable from './components/searchTable.vue';
  43. import { sendReceiveGatherExcel } from '@/api/warehouseManagement/statisticalReports';
  44. export default {
  45. components: { searchTable },
  46. computed: {
  47. columns() {
  48. let year, month, days;
  49. if (this.date) {
  50. year = this.date.split('-')[0];
  51. month = this.date.split('-')[1].replace(/^0+/, '');
  52. days = new Date(year, month, 0).getDate();
  53. } else {
  54. year = new Date().getFullYear();
  55. month = new Date().getMonth() + 1;
  56. days = new Date(year, month, 0).getDate();
  57. }
  58. let dateColumns = Array.from({ length: days }, (_, i) => ({
  59. prop: `dateList[${i}][dateTotalNum]`,
  60. label: `${month}/${i + 1}`,
  61. align: 'center',
  62. showOverflowTooltip: true
  63. }));
  64. let arr = [
  65. {
  66. type: 'index',
  67. label: '序号',
  68. width: 50,
  69. align: 'center'
  70. },
  71. {
  72. prop: 'clientName',
  73. label: '客户',
  74. align: 'center',
  75. width: 200,
  76. showOverflowTooltip: true
  77. },
  78. {
  79. prop: 'categoryCode',
  80. label: '件号',
  81. align: 'center',
  82. width: 180,
  83. showOverflowTooltip: true
  84. },
  85. {
  86. prop: 'categoryName',
  87. label: '件名',
  88. align: 'center',
  89. width: 180,
  90. showOverflowTooltip: true
  91. },
  92. {
  93. prop: 'startNum',
  94. label: '期初\n素材',
  95. slot: 'startTime',
  96. align: 'center',
  97. width: 80,
  98. showOverflowTooltip: true
  99. },
  100. {
  101. prop: 'endNum',
  102. label: '结存\n合计',
  103. align: 'center',
  104. width: 0,
  105. showOverflowTooltip: true
  106. },
  107. {
  108. prop: 'totalNum',
  109. label: '小计',
  110. align: 'center',
  111. showOverflowTooltip: true
  112. },
  113. {
  114. prop: 'category',
  115. label: '类别',
  116. align: 'center',
  117. showOverflowTooltip: true
  118. },
  119. {
  120. prop: 'dateList',
  121. label: '日期/数量',
  122. align: 'center',
  123. showOverflowTooltip: true,
  124. // children: [
  125. // {
  126. // prop: 'dateList[0][dateTotalNum]',
  127. // label: month + '/1',
  128. // align: 'center',
  129. // showOverflowTooltip: true
  130. // },
  131. // {
  132. // prop: 'dateList[1][dateTotalNum]',
  133. // label: month + '/2',
  134. // align: 'center',
  135. // showOverflowTooltip: true
  136. // },
  137. // {
  138. // prop: 'dateList[2][dateTotalNum]',
  139. // label: month + '/3',
  140. // align: 'center',
  141. // showOverflowTooltip: true
  142. // },
  143. // {
  144. // prop: 'dateList[3][dateTotalNum]',
  145. // label: month + '/4',
  146. // align: 'center',
  147. // showOverflowTooltip: true
  148. // },
  149. // {
  150. // prop: 'dateList[4][dateTotalNum]',
  151. // label: month + '/5',
  152. // align: 'center',
  153. // showOverflowTooltip: true
  154. // },
  155. // {
  156. // prop: 'dateList[5][dateTotalNum]',
  157. // label: month + '/6',
  158. // align: 'center',
  159. // showOverflowTooltip: true
  160. // },
  161. // {
  162. // prop: 'dateList[6][dateTotalNum]',
  163. // label: month + '/7',
  164. // align: 'center',
  165. // showOverflowTooltip: true
  166. // },
  167. // {
  168. // prop: 'dateList[7][dateTotalNum]',
  169. // label: month + '/8',
  170. // align: 'center',
  171. // showOverflowTooltip: true
  172. // },
  173. // {
  174. // prop: 'dateList[8][dateTotalNum]',
  175. // label: month + '/9',
  176. // align: 'center',
  177. // showOverflowTooltip: true
  178. // },
  179. // {
  180. // prop: 'dateList[9][dateTotalNum]',
  181. // label: month + '/10',
  182. // align: 'center',
  183. // showOverflowTooltip: true
  184. // },
  185. // {
  186. // prop: 'dateList[10][dateTotalNum]',
  187. // label: month + '/11',
  188. // align: 'center',
  189. // showOverflowTooltip: true
  190. // },
  191. // {
  192. // prop: 'dateList[11][dateTotalNum]',
  193. // label: month + '/12',
  194. // align: 'center',
  195. // showOverflowTooltip: true
  196. // },
  197. // {
  198. // prop: 'dateList[12][dateTotalNum]',
  199. // label: month + '/13',
  200. // align: 'center',
  201. // showOverflowTooltip: true
  202. // },
  203. // {
  204. // prop: 'dateList[13][dateTotalNum]',
  205. // label: month + '/14',
  206. // align: 'center',
  207. // showOverflowTooltip: true
  208. // },
  209. // {
  210. // prop: 'dateList[14][dateTotalNum]',
  211. // label: month + '/15',
  212. // align: 'center',
  213. // showOverflowTooltip: true
  214. // },
  215. // {
  216. // prop: 'dateList[15][dateTotalNum]',
  217. // label: month + '/16',
  218. // align: 'center',
  219. // showOverflowTooltip: true
  220. // },
  221. // {
  222. // prop: 'dateList[16][dateTotalNum]',
  223. // label: month + '/17',
  224. // align: 'center',
  225. // showOverflowTooltip: true
  226. // },
  227. // {
  228. // prop: 'dateList[17][dateTotalNum]',
  229. // label: month + '/18',
  230. // align: 'center',
  231. // showOverflowTooltip: true
  232. // },
  233. // {
  234. // prop: 'dateList[18][dateTotalNum]',
  235. // label: month + '/19',
  236. // align: 'center',
  237. // showOverflowTooltip: true
  238. // },
  239. // {
  240. // prop: 'dateList[19][dateTotalNum]',
  241. // label: month + '/20',
  242. // align: 'center',
  243. // showOverflowTooltip: true
  244. // },
  245. // {
  246. // prop: 'dateList[20][dateTotalNum]',
  247. // label: month + '/21',
  248. // align: 'center',
  249. // showOverflowTooltip: true
  250. // },
  251. // {
  252. // prop: 'dateList[21][dateTotalNum]',
  253. // label: month + '/22',
  254. // align: 'center',
  255. // showOverflowTooltip: true
  256. // },
  257. // {
  258. // prop: 'dateList[22][dateTotalNum]',
  259. // label: month + '/23',
  260. // align: 'center',
  261. // showOverflowTooltip: true
  262. // },
  263. // {
  264. // prop: 'dateList[23][dateTotalNum]',
  265. // label: month + '/24',
  266. // align: 'center',
  267. // showOverflowTooltip: true
  268. // },
  269. // {
  270. // prop: 'dateList[24][dateTotalNum]',
  271. // label: month + '/25',
  272. // align: 'center',
  273. // showOverflowTooltip: true
  274. // },
  275. // {
  276. // prop: 'dateList[25][dateTotalNum]',
  277. // label: month + '/26',
  278. // align: 'center',
  279. // showOverflowTooltip: true
  280. // },
  281. // {
  282. // prop: 'dateList[26][dateTotalNum]',
  283. // label: month + '/27',
  284. // align: 'center',
  285. // showOverflowTooltip: true
  286. // },
  287. // {
  288. // prop: 'dateList[27][dateTotalNum]',
  289. // label: month + '/28',
  290. // align: 'center',
  291. // showOverflowTooltip: true
  292. // },
  293. // {
  294. // prop: 'dateList[28][dateTotalNum]',
  295. // label: month + '/29',
  296. // align: 'center',
  297. // showOverflowTooltip: true
  298. // },
  299. // {
  300. // prop: 'dateList[29][dateTotalNum]',
  301. // label: month + '/30',
  302. // align: 'center',
  303. // showOverflowTooltip: true
  304. // },
  305. // {
  306. // prop: 'dateList[30][dateTotalNum]',
  307. // label: month + '/31',
  308. // align: 'center',
  309. // showOverflowTooltip: true
  310. // }
  311. // ]
  312. children: dateColumns
  313. }
  314. ];
  315. return arr;
  316. }
  317. },
  318. data() {
  319. return {
  320. date: ''
  321. // columns: [
  322. // {
  323. // type: 'index',
  324. // label: '序号',
  325. // width: 50,
  326. // align: 'center'
  327. // },
  328. // {
  329. // prop: 'code',
  330. // label: '客户',
  331. // align: 'center',
  332. // showOverflowTooltip: true
  333. // },
  334. // {
  335. // prop: 'name',
  336. // label: '件号',
  337. // align: 'center',
  338. // showOverflowTooltip: true
  339. // },
  340. // {
  341. // prop: 'createUserName',
  342. // label: '件名',
  343. // align: 'center',
  344. // showOverflowTooltip: true
  345. // },
  346. // {
  347. // prop: 'startTime',
  348. // label: '期初素材',
  349. // slot: 'startTime',
  350. // align: 'center',
  351. // showOverflowTooltip: true
  352. // },
  353. // {
  354. // prop: 'endTime',
  355. // label: '结存合计',
  356. // align: 'center',
  357. // showOverflowTooltip: true
  358. // },
  359. // {
  360. // prop: 'endTime',
  361. // label: '小计',
  362. // align: 'center',
  363. // showOverflowTooltip: true
  364. // },
  365. // {
  366. // prop: 'endTime',
  367. // label: '类别',
  368. // align: 'center',
  369. // showOverflowTooltip: true
  370. // },
  371. // {
  372. // prop: 'endTime',
  373. // label: '日期/数量',
  374. // align: 'center',
  375. // showOverflowTooltip: true,
  376. // children: [
  377. // {
  378. // prop: 'province',
  379. // label: '1',
  380. // align: 'center',
  381. // showOverflowTooltip: true
  382. // }
  383. // ]
  384. // }
  385. // ]
  386. };
  387. },
  388. methods: {
  389. // downLoad(row) {
  390. // sendReceiveGatherExcel({
  391. // code: row.code,
  392. // name: row.name,
  393. // startTime: row.startTime,
  394. // endTime: row.endTime,
  395. // exportStatus: 1
  396. // }).then((data) => {
  397. // try {
  398. // let objectUrl1 = window.URL.createObjectURL(new Blob([data]));
  399. // let elink = document.createElement('a');
  400. // elink.setAttribute(
  401. // 'download',
  402. // decodeURI(decodeURI('收发汇总表.xlsx'))
  403. // );
  404. // elink.style.display = 'none';
  405. // elink.href = objectUrl1;
  406. // document.body.appendChild(elink);
  407. // elink.click();
  408. // document.body.removeChild(elink);
  409. // window.URL.revokeObjectURL(elink.href);
  410. // this.search();
  411. // } catch (err) {
  412. // this.$message.error('导出失败,请联系管理员!');
  413. // }
  414. // });
  415. // },
  416. // add(isView, row) {
  417. // console.log('isView--', isView);
  418. // console.log('row-----', row);
  419. // this.$refs.addRef.open(isView, row);
  420. // },
  421. /* 表格数据源 */
  422. datasource({ page, limit, where, order }) {
  423. return sendReceiveGatherExcel({
  424. ...where
  425. // ...order,
  426. // type: 2,
  427. // keyWord: this.keyWord,
  428. // pageNum: page,
  429. // size: limit
  430. });
  431. },
  432. reload(where) {
  433. this.date = where.startDate ?? '';
  434. console.log(where);
  435. this.$refs.table.reload({ page: 1, where: where });
  436. }
  437. }
  438. };
  439. </script>
  440. <style lang="scss" scoped>
  441. #inventoryBalance {
  442. height: calc(100vh - 96px);
  443. width: 100%;
  444. padding: 10px;
  445. box-sizing: border-box;
  446. // element-ui样式穿透
  447. :deep(.el-card) {
  448. height: 100%;
  449. .el-card__body {
  450. height: 100%;
  451. box-sizing: border-box;
  452. display: flex;
  453. flex-direction: column;
  454. .ele-pro-table {
  455. flex: 1;
  456. display: flex;
  457. flex-direction: column;
  458. .el-table {
  459. flex: 1;
  460. // display: flex;
  461. // flex-direction: column;
  462. // .el-table__body-wrapper {
  463. // flex: 1;
  464. // }
  465. }
  466. }
  467. }
  468. .el-form-item {
  469. margin-bottom: 5px !important;
  470. }
  471. }
  472. .ele-form-actions {
  473. display: flex;
  474. justify-content: flex-end;
  475. }
  476. }
  477. :deep(.ele-pro-table-header-ellipsis > .el-table th.el-table__cell > .cell) {
  478. white-space: pre;
  479. }
  480. </style>