index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <!-- <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <seek-page :seekList="seekList" @search="search"></seek-page>
  5. <ele-pro-table
  6. ref="table"
  7. :columns="columns"
  8. :datasource="datasource"
  9. cache-key="wanLongDailyList"
  10. :current.sync="current"
  11. highlight-current-row
  12. row-key="id"
  13. :pageSize="20"
  14. :height="tableHeight"
  15. :selection.sync="selection"
  16. @fullscreen-change="fullscreenChange"
  17. >
  18. <template slot="subCountAllFirst" slot-scope="{ row }">
  19. <span class="clickable" @click="onClickSubCountAllFirst(row)">
  20. {{ row.subCountAllFirst != null ? row.subCountAllFirst : 0 }}
  21. </span>
  22. </template>
  23. <template slot="subCountSendFirst" slot-scope="{ row }">
  24. <span class="clickable" @click="onClickSubCountSendFirst(row)">
  25. {{ row.subCountSendFirst != null ? row.subCountSendFirst : 0 }}
  26. </span>
  27. </template>
  28. </ele-pro-table>
  29. </el-card>
  30. </div>
  31. </template>
  32. <script>
  33. import { getDailyList } from '@/api/wanLong/index';
  34. export default {
  35. name: 'wanLongIndex',
  36. data() {
  37. return {
  38. loading: false,
  39. current: null,
  40. selection: [],
  41. tableHeight: 'calc(100vh - 320px)',
  42. dynamicColumns: [], // 保存 taskList 动态列
  43. taskNames: [] // taskName 列名数组
  44. };
  45. },
  46. computed: {
  47. seekList() {
  48. return [
  49. {
  50. label: '开始时间:',
  51. value: 'startTime',
  52. type: 'date',
  53. dateType: 'daterange',
  54. placeholder: ''
  55. }
  56. ];
  57. },
  58. columns() {
  59. const baseColumns = [
  60. {
  61. columnKey: 'selection',
  62. type: 'selection',
  63. width: 45,
  64. align: 'center'
  65. },
  66. {
  67. columnKey: 'index',
  68. label: '序号',
  69. type: 'index',
  70. width: 55,
  71. align: 'center',
  72. showOverflowTooltip: true,
  73. align: 'center'
  74. },
  75. {
  76. label: '物品名称',
  77. prop: 'categoryName',
  78. width: 150,
  79. showOverflowTooltip: true,
  80. align: 'center'
  81. },
  82. {
  83. label: '物品编码',
  84. prop: 'categoryCode',
  85. width: 160,
  86. showOverflowTooltip: true,
  87. align: 'center'
  88. },
  89. {
  90. label: '图号',
  91. prop: 'imgCode',
  92. width: 160,
  93. showOverflowTooltip: true,
  94. align: 'center'
  95. },
  96. {
  97. label: '图纸版本',
  98. prop: 'version',
  99. width: 160,
  100. showOverflowTooltip: true,
  101. align: 'center'
  102. },
  103. {
  104. label: '重量',
  105. prop: 'productUnitWeight',
  106. width: 120,
  107. showOverflowTooltip: true,
  108. align: 'center'
  109. },
  110. {
  111. label: '型号',
  112. prop: 'modelType',
  113. width: 120,
  114. showOverflowTooltip: true,
  115. align: 'center'
  116. },
  117. {
  118. label: '规格',
  119. prop: 'specification',
  120. width: 120,
  121. showOverflowTooltip: true,
  122. align: 'center'
  123. },
  124. {
  125. label: '中间状态数量',
  126. prop: 'middleNum',
  127. width: 120,
  128. showOverflowTooltip: true,
  129. align: 'center'
  130. },
  131. {
  132. label: '库存数量',
  133. prop: 'availableCountBase',
  134. width: 120,
  135. showOverflowTooltip: true,
  136. align: 'center'
  137. },
  138. {
  139. label: '下料初始值',
  140. prop: 'subCountAllFirst',
  141. width: 120,
  142. slot: 'subCountAllFirst',
  143. showOverflowTooltip: true,
  144. align: 'center'
  145. },
  146. {
  147. label: '下料总数量',
  148. prop: 'subCountAll',
  149. width: 120,
  150. showOverflowTooltip: true,
  151. align: 'center'
  152. },
  153. {
  154. label: '送货初始值',
  155. prop: 'subCountSendFirst',
  156. width: 120,
  157. slot: 'subCountSendFirst',
  158. showOverflowTooltip: true,
  159. align: 'center'
  160. },
  161. {
  162. label: '送货数量',
  163. prop: 'subCountSend',
  164. width: 120,
  165. showOverflowTooltip: true,
  166. align: 'center'
  167. },
  168. {
  169. label: '备注',
  170. prop: 'remark',
  171. width: 120,
  172. showOverflowTooltip: true,
  173. align: 'center'
  174. },
  175. {
  176. label: '日期',
  177. prop: 'date',
  178. width: 100,
  179. showOverflowTooltip: true,
  180. align: 'center'
  181. }
  182. ];
  183. return baseColumns.concat(this.dynamicColumns);
  184. }
  185. },
  186. methods: {
  187. datasource({ page, limit, where }) {
  188. return getDailyList({
  189. pageNum: page,
  190. size: limit,
  191. ...where
  192. }).then((res) => {
  193. const data = res.data || [];
  194. if (data.length) {
  195. const firstItem = data[0];
  196. if (firstItem.taskList && firstItem.taskList.length) {
  197. this.taskNames = firstItem.taskList.map((t) => t.taskName);
  198. this.dynamicColumns = firstItem.taskList.map((t) => ({
  199. label: t.taskName,
  200. prop: `task_${t.taskName}`,
  201. width: 100,
  202. align: 'center'
  203. }));
  204. }
  205. }
  206. const tableData = data.map((item) => {
  207. const taskFields = {};
  208. if (item.taskList && item.taskList.length) {
  209. item.taskList.forEach((t) => {
  210. taskFields[`task_${t.taskName}`] = t.quantity;
  211. });
  212. }
  213. return Object.assign({}, item, taskFields);
  214. });
  215. return tableData;
  216. });
  217. },
  218. search(e) {
  219. this.$refs.table.reload(e);
  220. },
  221. fullscreenChange(fullscreen) {
  222. this.tableHeight = fullscreen
  223. ? 'calc(100vh - 120px)'
  224. : 'calc(100vh - 320px)';
  225. },
  226. onClickSubCountAllFirst(row) {
  227. console.log('点击下料初始值', row);
  228. this.$message.info(`下料初始值: ${row.subCountAllFirst}`);
  229. },
  230. onClickSubCountSendFirst(row) {
  231. console.log('点击送货初始值', row);
  232. this.$message.info(`送货初始值: ${row.subCountSendFirst}`);
  233. }
  234. }
  235. };
  236. </script>
  237. <style scoped>
  238. .clickable {
  239. cursor: pointer;
  240. color: #409eff;
  241. }
  242. </style> -->
  243. <template> </template>
  244. <script>
  245. export default {};
  246. </script>
  247. <style></style>