index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  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
  8. label="我的任务"
  9. name="1"
  10. v-if="$hasPermission('mes:taskreport:myorder')"
  11. ></el-tab-pane>
  12. <el-tab-pane
  13. label="全部任务"
  14. name="2"
  15. v-if="$hasPermission('mes:taskreport:allorder')"
  16. ></el-tab-pane>
  17. <!-- <el-tab-pane label="我的任务" name="1"></el-tab-pane>
  18. <el-tab-pane label="全部任务" name="2"></el-tab-pane> -->
  19. </el-tabs>
  20. </el-card>
  21. <ele-pro-table
  22. ref="table"
  23. :columns="columns"
  24. :datasource="datasource"
  25. :pageSize="20"
  26. cache-key="workOrderTable"
  27. class="my_pro_table"
  28. row-key="id"
  29. >
  30. <template v-slot:assignCode="{ row }">
  31. <el-link
  32. :underline="false"
  33. type="primary"
  34. @click="details('assign', row)"
  35. >{{ row.assignCode }}
  36. </el-link>
  37. </template>
  38. <template v-slot:workOrderCode="{ row }">
  39. <el-link
  40. :underline="false"
  41. type="primary"
  42. @click="details('assign', row)"
  43. >{{ row.workOrderCode }}
  44. </el-link>
  45. </template>
  46. <template v-slot:disposalStatus="{ row }">
  47. <el-tag v-if="row.disposalStatus == 1" type="success">已接受</el-tag>
  48. <el-tag v-if="row.disposalStatus == 2" type="danger">已拒绝</el-tag>
  49. </template>
  50. <template v-slot:action="{ row }">
  51. <el-link
  52. v-if="tabValue == '2' && row.disposalStatus == '2'"
  53. :underline="false"
  54. type="primary"
  55. @click="reassignTask(row)"
  56. >转派
  57. </el-link>
  58. <el-link
  59. :underline="false"
  60. type="primary"
  61. @click="details('report', row)"
  62. v-if="row.disposalStatus == '1' || tabValue == '2'"
  63. >报工
  64. </el-link>
  65. <el-link
  66. :underline="false"
  67. type="primary"
  68. @click="viewRecords(row.id)"
  69. v-if="row.disposalStatus == '1' || tabValue == '2'"
  70. >报工记录
  71. </el-link>
  72. <el-popconfirm
  73. icon="el-icon-info"
  74. title="确定接收任务吗?"
  75. @confirm="receiveTask(row.id, '1')"
  76. v-if="
  77. row.disposalStatus != '1' &&
  78. row.disposalStatus != '2' &&
  79. tabValue != '2'
  80. "
  81. >
  82. <el-button slot="reference" type="text">接收任务</el-button>
  83. </el-popconfirm>
  84. <el-popconfirm
  85. icon="el-icon-info"
  86. title="确定拒绝任务吗?"
  87. @confirm="receiveTask(row.id, '2')"
  88. v-if="
  89. row.disposalStatus != '1' &&
  90. row.disposalStatus != '2' &&
  91. tabValue != '2'
  92. "
  93. >
  94. <el-button slot="reference" type="text">拒绝任务</el-button>
  95. </el-popconfirm>
  96. <!-- <el-link
  97. :underline="false"
  98. type="primary"
  99. @click="receiveTask(row)"
  100. v-if="row.disposalStatus != '1'"
  101. >接收任务
  102. </el-link> -->
  103. <!-- <el-link
  104. :underline="false"
  105. type="primary"
  106. @click="rejectTask(row)"
  107. v-if="row.disposalStatus != '1'"
  108. >拒绝任务
  109. </el-link> -->
  110. </template>
  111. </ele-pro-table>
  112. <modifyDialog ref="modifyRef" />
  113. <Ddtails ref="detailsRef" @success="reload" />
  114. <el-dialog
  115. title="选择人员"
  116. :visible.sync="dialogFormVisible"
  117. v-if="dialogFormVisible"
  118. width="30%"
  119. center
  120. >
  121. <el-form :model="form">
  122. <el-form-item label="人员">
  123. <el-select
  124. size="mini"
  125. class="content_num"
  126. filterable
  127. v-model="form.userId"
  128. placeholder="请选择任务人员"
  129. >
  130. <el-option
  131. v-for="item in teamList"
  132. :label="item.name"
  133. :value="item.id"
  134. :key="item.id"
  135. >
  136. </el-option>
  137. </el-select>
  138. </el-form-item>
  139. </el-form>
  140. <div slot="footer" class="dialog-footer">
  141. <el-button @click="dialogFormVisible = false">取 消</el-button>
  142. <el-button type="primary" @click="chooseUser">确 定</el-button>
  143. </div>
  144. </el-dialog>
  145. </div>
  146. </template>
  147. <script>
  148. import TaskSearch from './components/task-search.vue';
  149. import Ddtails from './components/Ddtails.vue';
  150. import modifyDialog from '@/views/taskList/components/modifyDialog.vue';
  151. import { getteampage } from '@/api/produceWord/index.js';
  152. import {
  153. pageByCurrentUser,
  154. pageByCurrentUserLeader,
  155. listUpdateRealTimeRecord,
  156. taskManagement,
  157. transferTasks
  158. } from '@/api/workOrderList';
  159. import { revokeWork } from '@/api/manufacture/spreadWorkOrder';
  160. export default {
  161. components: { TaskSearch, Ddtails, modifyDialog },
  162. data() {
  163. return {
  164. loading: false,
  165. tabValue: '1',
  166. statusOpt: [
  167. { label: '待生产', value: 4 },
  168. { label: '生产中', value: 5 },
  169. { label: '待下达', value: 8 }
  170. ],
  171. form: {
  172. userId: '',
  173. id: ''
  174. },
  175. dialogFormVisible: false,
  176. teamList: []
  177. };
  178. },
  179. computed: {
  180. // 表格列配置
  181. columns() {
  182. return [
  183. {
  184. columnKey: 'index',
  185. label: '序号',
  186. type: 'index',
  187. width: 55,
  188. align: 'center',
  189. showOverflowTooltip: true,
  190. fixed: 'left'
  191. },
  192. {
  193. slot: 'assignCode',
  194. prop: 'assignCode',
  195. label: '任务编码',
  196. align: 'center',
  197. showOverflowTooltip: true,
  198. width: 210
  199. },
  200. {
  201. slot: 'workOrderCode',
  202. prop: 'workOrderCode',
  203. label: '生产订单编码',
  204. align: 'center',
  205. showOverflowTooltip: true,
  206. width: 210
  207. },
  208. {
  209. prop: 'mesWorkOrderCode',
  210. label: '生产工单编码',
  211. align: 'center',
  212. showOverflowTooltip: true,
  213. width: 210
  214. },
  215. {
  216. prop: 'productionPlanCode',
  217. label: '计划编号',
  218. align: 'center',
  219. showOverflowTooltip: true,
  220. width: 170
  221. },
  222. {
  223. prop: 'assigneeType',
  224. label: '执行类型',
  225. align: 'center',
  226. showOverflowTooltip: true,
  227. width: 120,
  228. formatter: (row) => {
  229. if (!row.assigneeType) return '';
  230. return row.assigneeType.desc;
  231. }
  232. },
  233. {
  234. prop: 'assigneeName',
  235. label: '执行对象名称',
  236. align: 'center',
  237. showOverflowTooltip: true,
  238. width: 180
  239. },
  240. {
  241. prop: 'workCenterName',
  242. label: '工作中心',
  243. align: 'center',
  244. width: 180,
  245. showOverflowTooltip: true
  246. },
  247. {
  248. prop: 'assignTeamName',
  249. label: '班组名称',
  250. align: 'center',
  251. showOverflowTooltip: true,
  252. width: 180
  253. },
  254. {
  255. prop: 'taskName',
  256. label: '工序名称',
  257. align: 'center',
  258. showOverflowTooltip: true,
  259. width: 150
  260. },
  261. {
  262. prop: 'produceRoutingName',
  263. label: '工艺路线',
  264. align: 'center',
  265. showOverflowTooltip: true,
  266. width: 170
  267. },
  268. {
  269. prop: 'productCode',
  270. label: '产品编码',
  271. align: 'center',
  272. showOverflowTooltip: true,
  273. width: 170
  274. },
  275. {
  276. prop: 'productName',
  277. label: '产品名称',
  278. align: 'center',
  279. showOverflowTooltip: true,
  280. width: 200
  281. },
  282. {
  283. prop: 'productionCodes',
  284. label: '生产编号',
  285. align: 'center',
  286. showOverflowTooltip: true,
  287. width: 170
  288. },
  289. {
  290. prop: 'brandNo',
  291. label: '牌号',
  292. align: 'center',
  293. showOverflowTooltip: true,
  294. width: 170
  295. },
  296. {
  297. prop: 'batchNo',
  298. label: '批次号',
  299. align: 'center',
  300. width: 100,
  301. showOverflowTooltip: true
  302. },
  303. {
  304. prop: 'model',
  305. label: '型号',
  306. align: 'center',
  307. width: 200,
  308. showOverflowTooltip: true
  309. },
  310. {
  311. prop: 'quantity',
  312. label: '任务数量',
  313. align: 'center',
  314. showOverflowTooltip: true,
  315. width: 110
  316. },
  317. {
  318. prop: 'weight',
  319. label: '任务重量(kg)',
  320. align: 'center',
  321. showOverflowTooltip: true,
  322. width: 110
  323. },
  324. {
  325. prop: 'planStartTime',
  326. label: '计划开始时间',
  327. align: 'center',
  328. showOverflowTooltip: true,
  329. width: 180
  330. },
  331. {
  332. prop: 'planCompleteTime',
  333. label: '计划结束时间',
  334. align: 'center',
  335. showOverflowTooltip: true,
  336. width: 180
  337. },
  338. {
  339. prop: 'startTime',
  340. label: '任务开始时间',
  341. align: 'center',
  342. showOverflowTooltip: true,
  343. width: 180
  344. },
  345. {
  346. prop: 'endTime',
  347. label: '任务结束时间',
  348. align: 'center',
  349. showOverflowTooltip: true,
  350. width: 180
  351. },
  352. {
  353. label: '实际开始时间',
  354. prop: 'realStartTime',
  355. minWidth: 150,
  356. align: 'center',
  357. showOverflowTooltip: true
  358. },
  359. {
  360. label: '实际结束时间',
  361. prop: 'realEndTime',
  362. minWidth: 150,
  363. align: 'center',
  364. showOverflowTooltip: true
  365. },
  366. {
  367. label: '工时',
  368. prop: 'durationText',
  369. width: 150,
  370. align: 'center',
  371. showOverflowTooltip: true
  372. },
  373. {
  374. prop: 'firstTaskName',
  375. label: '首工序',
  376. align: 'center',
  377. width: 180,
  378. showOverflowTooltip: true
  379. },
  380. {
  381. prop: 'createTime',
  382. label: '创建时间',
  383. align: 'center',
  384. showOverflowTooltip: true,
  385. width: 180
  386. },
  387. {
  388. prop: 'statusText',
  389. label: '状态',
  390. align: 'center',
  391. // formatter: (row) => {
  392. // const obj = this.statusOpt.find((i) => i.value == row.status);
  393. // return obj && obj.label;
  394. // },
  395. width: 120
  396. },
  397. {
  398. prop: 'disposalStatus',
  399. label: '任务接收状态',
  400. align: 'center',
  401. slot: 'disposalStatus',
  402. width: 120
  403. },
  404. {
  405. prop: 'customerName',
  406. label: '客户名称',
  407. align: 'center',
  408. showOverflowTooltip: true,
  409. width: 180
  410. },
  411. {
  412. prop: 'serialNo',
  413. label: '客户代号',
  414. align: 'center',
  415. showOverflowTooltip: true,
  416. width: 180
  417. },
  418. {
  419. prop: 'simpleName',
  420. label: '客户简称',
  421. align: 'center',
  422. showOverflowTooltip: true,
  423. width: 180
  424. },
  425. {
  426. columnKey: 'action',
  427. label: '操作',
  428. width: 200,
  429. align: 'center',
  430. resizable: false,
  431. fixed: 'right',
  432. slot: 'action'
  433. }
  434. ];
  435. }
  436. },
  437. created() {},
  438. mounted() {
  439. if (this.$hasPermission('mes:taskreport:allorder')) {
  440. this.tabValue = '2';
  441. }
  442. if (this.$hasPermission('mes:taskreport:myorder')) {
  443. this.tabValue = '1';
  444. }
  445. if (
  446. !this.$hasPermission('mes:taskreport:myorder') &&
  447. !this.$hasPermission('mes:taskreport:allorder')
  448. ) {
  449. this.tabValue = '';
  450. }
  451. },
  452. methods: {
  453. handleTabClick(e) {
  454. this.tabValue = e.name;
  455. this.reload();
  456. },
  457. /* 表格数据源 */
  458. datasource({ page, limit, where }) {
  459. // console.log(this.tabValue, 'this.tabValue');
  460. if (this.tabValue && this.tabValue != 0) {
  461. let api =
  462. this.tabValue === '1' ? pageByCurrentUser : pageByCurrentUserLeader;
  463. return api({
  464. ...where,
  465. pageNum: page,
  466. size: limit
  467. });
  468. } else {
  469. return [];
  470. }
  471. },
  472. async chooseUser() {
  473. if (!this.form.userId) {
  474. return this.$message.warning('请选择转派人员');
  475. }
  476. const data = this.teamList.find((it) => it.id == this.form.userId);
  477. await transferTasks({
  478. assigneeId: data.id,
  479. assigneeName: data.name,
  480. id: this.form.id
  481. }).then((res) => {
  482. console.log(res);
  483. });
  484. this.dialogFormVisible = false;
  485. this.reload();
  486. },
  487. async receiveTask(id, type) {
  488. await taskManagement({
  489. id,
  490. disposalStatus: Number(type)
  491. }).then((res) => {
  492. console.log(res);
  493. this.reload();
  494. });
  495. },
  496. // async receiveTask(item) {
  497. // await taskManagement({
  498. // id: item.id,
  499. // disposalStatus: 1
  500. // }).then((res) => {
  501. // console.log(res);
  502. // this.reload();
  503. // });
  504. // },
  505. // async rejectTask(item) {
  506. // await taskManagement({
  507. // id: item.id,
  508. // disposalStatus: 2
  509. // }).then((res) => {
  510. // console.log(res);
  511. // this.reload();
  512. // });
  513. // },
  514. async reassignTask(item) {
  515. this.form.userId = '';
  516. this.form.id = item.id;
  517. await getteampage({ name: item.assignTeamName }).then((res) => {
  518. this.teamList = res.list[0].userVOList;
  519. });
  520. this.dialogFormVisible = true;
  521. },
  522. reload(where) {
  523. this.$refs.table.reload({ page: 1, where });
  524. },
  525. details(type, row) {
  526. let currentRow = {
  527. assignCode: row.assignCode,
  528. workOrderCode: row.workOrderCode,
  529. productionPlanCode: row.productionPlanCode,
  530. produceRoutingName: row.produceRoutingName,
  531. formingNum: row.quantity,
  532. assignTeamName: row.assignTeamName,
  533. formingWeight: row.quantity,
  534. planStartTime: row.planStartTime,
  535. planCompleteTime: row.planCompleteTime,
  536. startTime: row.startTime,
  537. firstTaskId: row.firstTaskId,
  538. endTime: row.endTime,
  539. taskName: row.taskName,
  540. firstTaskName: row.firstTaskName,
  541. assigneeType: row.assigneeType ? row.assigneeType.desc : '',
  542. assigneeName: row.assigneeName,
  543. weight: row.weight,
  544. quantity: row.quantity,
  545. durationText: row.durationText,
  546. apsAssigneeId: row.id,
  547. batchNo: row.batchNo,
  548. productCode: row.productCode,
  549. productName: row.productName,
  550. specification: row.specification
  551. };
  552. let form = {
  553. realEndTime: row.realEndTime,
  554. realStartTime: row.realStartTime,
  555. unqualifiedWeight: row.unqualifiedWeight,
  556. unqualifiedQuantity: row.unqualifiedQuantity,
  557. qualifiedWeight: row.qualifiedWeight,
  558. remark: row.assigneeRemark,
  559. qualifiedQuantity: row.qualifiedQuantity
  560. };
  561. this.$refs.detailsRef.open(type, currentRow, form);
  562. },
  563. viewRecords(apsAssigneeId) {
  564. listUpdateRealTimeRecord(apsAssigneeId)
  565. .then((res) => {
  566. if (res && res.length > 0) {
  567. this.$refs.modifyRef.open(res);
  568. } else {
  569. this.$message.warning('暂无修改历史记录数据');
  570. }
  571. })
  572. .catch((err) => {
  573. this.$message.error(err.message);
  574. });
  575. }
  576. }
  577. };
  578. </script>
  579. <style lang="scss" scoped>
  580. .ele-body {
  581. height: 100%;
  582. .my_pro_table {
  583. height: calc(100% - 136px);
  584. }
  585. }
  586. ::v-deep .el-table {
  587. height: calc(100% - 96px);
  588. }
  589. </style>