index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <template>
  2. <div class="ele-body">
  3. <el-card v-loading="loading" shadow="never">
  4. <task-search @search="reload"></task-search>
  5. <!-- <taskDialog-search></taskDialog-search> -->
  6. <el-tabs v-model="tabValue" type="card" @tab-click="handleTabClick">
  7. <el-tab-pane label="我的任务" name="1"></el-tab-pane>
  8. <el-tab-pane label="全部任务" name="2"></el-tab-pane>
  9. </el-tabs>
  10. </el-card>
  11. <ele-pro-table
  12. ref="table"
  13. :columns="columns"
  14. :datasource="datasource"
  15. :pageSize="20"
  16. cache-key="workOrderTable"
  17. class="my_pro_table"
  18. row-key="id"
  19. >
  20. <template v-slot:assignCode="{ row }">
  21. <el-link
  22. :underline="false"
  23. type="primary"
  24. @click="details('assign', row)"
  25. >{{ row.assignCode }}
  26. </el-link>
  27. </template>
  28. <template v-slot:workOrderCode="{ row }">
  29. <el-link
  30. :underline="false"
  31. type="primary"
  32. @click="details('assign', row)"
  33. >{{ row.workOrderCode }}
  34. </el-link>
  35. </template>
  36. <template v-slot:action="{ row }">
  37. <el-link
  38. :underline="false"
  39. type="primary"
  40. @click="details('report', row)"
  41. >报工
  42. </el-link>
  43. <el-link :underline="false" type="primary" @click="viewRecords(row.id)"
  44. >修改记录
  45. </el-link>
  46. </template>
  47. </ele-pro-table>
  48. <modifyDialog ref="modifyRef" />
  49. <Ddtails ref="detailsRef" @success="reload" />
  50. </div>
  51. </template>
  52. <script>
  53. import TaskSearch from './components/task-search.vue';
  54. import Ddtails from './components/Ddtails.vue';
  55. import modifyDialog from '@/views/taskList/components/modifyDialog.vue';
  56. import {
  57. pageByCurrentUser,
  58. pageByCurrentUserLeader,
  59. listUpdateRealTimeRecord
  60. } from '@/api/workOrderList';
  61. export default {
  62. components: { TaskSearch, Ddtails, modifyDialog },
  63. data() {
  64. return {
  65. loading: false,
  66. tabValue: '1',
  67. statusOpt: [
  68. { label: '待生产', value: 4 },
  69. { label: '生产中', value: 5 },
  70. { label: '待下达', value: 8 }
  71. ]
  72. };
  73. },
  74. computed: {
  75. // 表格列配置
  76. columns() {
  77. return [
  78. {
  79. columnKey: 'index',
  80. label: '序号',
  81. type: 'index',
  82. width: 55,
  83. align: 'center',
  84. showOverflowTooltip: true,
  85. fixed: 'left'
  86. },
  87. {
  88. slot: 'assignCode',
  89. prop: 'assignCode',
  90. label: '任务编码',
  91. align: 'center',
  92. showOverflowTooltip: true,
  93. width: 210
  94. },
  95. {
  96. slot: 'workOrderCode',
  97. prop: 'workOrderCode',
  98. label: '生产订单编码',
  99. align: 'center',
  100. showOverflowTooltip: true,
  101. width: 210
  102. },
  103. {
  104. prop: 'mesWorkOrderCode',
  105. label: '生产工单编码',
  106. align: 'center',
  107. showOverflowTooltip: true,
  108. width: 210
  109. },
  110. {
  111. prop: 'productionPlanCode',
  112. label: '计划编号',
  113. align: 'center',
  114. showOverflowTooltip: true,
  115. width: 170
  116. },
  117. {
  118. prop: 'assigneeType',
  119. label: '执行类型',
  120. align: 'center',
  121. showOverflowTooltip: true,
  122. width: 120,
  123. formatter: (row) => {
  124. if (!row.assigneeType) return '';
  125. return row.assigneeType.desc;
  126. }
  127. },
  128. {
  129. prop: 'assigneeName',
  130. label: '执行对象名称',
  131. align: 'center',
  132. showOverflowTooltip: true,
  133. width: 180
  134. },
  135. {
  136. prop: 'workCenterName',
  137. label: '工作中心',
  138. align: 'center',
  139. width: 180,
  140. showOverflowTooltip: true
  141. },
  142. {
  143. prop: 'assignTeamName',
  144. label: '班组名称',
  145. align: 'center',
  146. showOverflowTooltip: true,
  147. width: 180
  148. },
  149. {
  150. prop: 'taskName',
  151. label: '工序名称',
  152. align: 'center',
  153. showOverflowTooltip: true,
  154. width: 150
  155. },
  156. {
  157. prop: 'produceRoutingName',
  158. label: '工艺路线',
  159. align: 'center',
  160. showOverflowTooltip: true,
  161. width: 170
  162. },
  163. {
  164. prop: 'productCode',
  165. label: '产品编码',
  166. align: 'center',
  167. showOverflowTooltip: true,
  168. width: 170
  169. },
  170. {
  171. prop: 'productName',
  172. label: '产品名称',
  173. align: 'center',
  174. showOverflowTooltip: true,
  175. width: 200
  176. },
  177. {
  178. prop: 'productionCodes',
  179. label: '生产编号',
  180. align: 'center',
  181. showOverflowTooltip: true,
  182. width: 170
  183. },
  184. {
  185. prop: 'brandNo',
  186. label: '牌号',
  187. align: 'center',
  188. showOverflowTooltip: true,
  189. width: 170
  190. },
  191. {
  192. prop: 'batchNo',
  193. label: '批次号',
  194. align: 'center',
  195. width: 100,
  196. showOverflowTooltip: true
  197. },
  198. {
  199. prop: 'model',
  200. label: '型号',
  201. align: 'center',
  202. width: 200,
  203. showOverflowTooltip: true
  204. },
  205. {
  206. prop: 'quantity',
  207. label: '要求生产数量',
  208. align: 'center',
  209. showOverflowTooltip: true,
  210. width: 110
  211. },
  212. {
  213. prop: 'weight',
  214. label: '要求生产重量',
  215. align: 'center',
  216. showOverflowTooltip: true,
  217. width: 110
  218. },
  219. {
  220. prop: 'planStartTime',
  221. label: '计划开始时间',
  222. align: 'center',
  223. showOverflowTooltip: true,
  224. width: 180
  225. },
  226. {
  227. prop: 'planCompleteTime',
  228. label: '计划结束时间',
  229. align: 'center',
  230. showOverflowTooltip: true,
  231. width: 180
  232. },
  233. {
  234. prop: 'startTime',
  235. label: '任务开始时间',
  236. align: 'center',
  237. showOverflowTooltip: true,
  238. width: 180
  239. },
  240. {
  241. prop: 'endTime',
  242. label: '任务结束时间',
  243. align: 'center',
  244. showOverflowTooltip: true,
  245. width: 180
  246. },
  247. {
  248. label: '实际开始时间',
  249. prop: 'realStartTime',
  250. minWidth: 150,
  251. align: 'center',
  252. showOverflowTooltip: true
  253. },
  254. {
  255. label: '实际结束时间',
  256. prop: 'realEndTime',
  257. minWidth: 150,
  258. align: 'center',
  259. showOverflowTooltip: true
  260. },
  261. {
  262. label: '工时',
  263. prop: 'durationText',
  264. width: 150,
  265. align: 'center',
  266. showOverflowTooltip: true
  267. },
  268. {
  269. prop: 'firstTaskName',
  270. label: '首工序',
  271. align: 'center',
  272. width: 180,
  273. showOverflowTooltip: true
  274. },
  275. {
  276. prop: 'createTime',
  277. label: '创建时间',
  278. align: 'center',
  279. showOverflowTooltip: true,
  280. width: 180
  281. },
  282. {
  283. prop: 'statusText',
  284. label: '状态',
  285. align: 'center',
  286. // formatter: (row) => {
  287. // const obj = this.statusOpt.find((i) => i.value == row.status);
  288. // return obj && obj.label;
  289. // },
  290. width: 120
  291. },
  292. {
  293. prop: 'customerName',
  294. label: '客户名称',
  295. align: 'center',
  296. showOverflowTooltip: true,
  297. width: 180
  298. },
  299. {
  300. prop: 'serialNo',
  301. label: '客户代号',
  302. align: 'center',
  303. showOverflowTooltip: true,
  304. width: 180
  305. },
  306. {
  307. prop: 'simpleName',
  308. label: '客户简称',
  309. align: 'center',
  310. showOverflowTooltip: true,
  311. width: 180
  312. },
  313. {
  314. columnKey: 'action',
  315. label: '操作',
  316. width: 150,
  317. align: 'center',
  318. resizable: false,
  319. fixed: 'right',
  320. slot: 'action'
  321. }
  322. ];
  323. }
  324. },
  325. created() {},
  326. mounted() {},
  327. methods: {
  328. handleTabClick(e) {
  329. this.tabValue = e.name;
  330. this.reload();
  331. },
  332. /* 表格数据源 */
  333. datasource({ page, limit, where }) {
  334. let api =
  335. this.tabValue === '1' ? pageByCurrentUser : pageByCurrentUserLeader;
  336. return api({
  337. ...where,
  338. pageNum: page,
  339. size: limit
  340. });
  341. },
  342. reload(where) {
  343. this.$refs.table.reload({ page: 1, where });
  344. },
  345. details(type, row) {
  346. let currentRow = {
  347. assignCode: row.assignCode,
  348. workOrderCode: row.workOrderCode,
  349. productionPlanCode: row.productionPlanCode,
  350. produceRoutingName: row.produceRoutingName,
  351. formingNum: row.quantity,
  352. assignTeamName: row.assignTeamName,
  353. formingWeight: row.quantity,
  354. planStartTime: row.planStartTime,
  355. planCompleteTime: row.planCompleteTime,
  356. startTime: row.startTime,
  357. firstTaskId: row.firstTaskId,
  358. endTime: row.endTime,
  359. taskName: row.taskName,
  360. firstTaskName: row.firstTaskName,
  361. assigneeType: row.assigneeType ? row.assigneeType.desc : '',
  362. assigneeName: row.assigneeName,
  363. weight: row.weight,
  364. quantity: row.quantity,
  365. durationText: row.durationText,
  366. apsAssigneeId: row.id
  367. };
  368. let form = {
  369. realEndTime: row.realEndTime,
  370. realStartTime: row.realStartTime,
  371. unqualifiedWeight: row.unqualifiedWeight,
  372. unqualifiedQuantity: row.unqualifiedQuantity,
  373. qualifiedWeight: row.qualifiedWeight,
  374. remark: row.assigneeRemark,
  375. qualifiedQuantity: row.qualifiedQuantity
  376. };
  377. this.$refs.detailsRef.open(type, currentRow, form);
  378. },
  379. viewRecords(apsAssigneeId) {
  380. listUpdateRealTimeRecord(apsAssigneeId)
  381. .then((res) => {
  382. if (res && res.length > 0) {
  383. this.$refs.modifyRef.open(res);
  384. } else {
  385. this.$message.warning('暂无修改历史记录数据');
  386. }
  387. })
  388. .catch((err) => {
  389. this.$message.error(err.message);
  390. });
  391. }
  392. }
  393. };
  394. </script>
  395. <style lang="scss" scoped>
  396. .ele-body {
  397. height: 100%;
  398. .my_pro_table {
  399. height: calc(100% - 136px);
  400. }
  401. }
  402. ::v-deep .el-table {
  403. height: calc(100% - 96px);
  404. }
  405. </style>