index.vue 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046
  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
  9. label="全部任务"
  10. name="2"
  11. v-if="$hasPermission('mes:taskreport:allorder')"
  12. ></el-tab-pane>
  13. <el-tab-pane
  14. label="班组任务"
  15. name="3"
  16. v-if="$hasPermission('mes:taskreport:teamorder')"
  17. ></el-tab-pane>
  18. <el-tab-pane
  19. label="NC编程任务"
  20. name="4"
  21. v-if="$hasPermission('mes:taskreport:programmingorder')"
  22. ></el-tab-pane>
  23. <!-- <el-tab-pane label="我的任务" name="1"></el-tab-pane>
  24. <el-tab-pane label="全部任务" name="2"></el-tab-pane> -->
  25. </el-tabs>
  26. <ele-pro-table
  27. ref="table"
  28. :columns="tabValue == '4' ? ncColumns : columns"
  29. :datasource="datasource"
  30. :pageSize="20"
  31. cache-key="workOrderTable"
  32. class="my_pro_table"
  33. row-key="id"
  34. :height="tableHeight"
  35. @fullscreen-change="fullscreenChange"
  36. >
  37. <template v-slot:assigneeCode="{ row }">
  38. <el-link
  39. :underline="false"
  40. type="primary"
  41. @click="details('assign', row)"
  42. >{{ row.assigneeCode }}
  43. </el-link>
  44. </template>
  45. <template v-slot:code="{ row }" v-if="tabValue == '4'">
  46. <el-link
  47. :underline="false"
  48. type="primary"
  49. @click="detailsNC(row, 'detail')"
  50. >{{ row.code }}
  51. </el-link>
  52. </template>
  53. <template v-slot:workOrderCode="{ row }">
  54. <el-link
  55. :underline="false"
  56. type="primary"
  57. @click="details('assign', row)"
  58. >{{ row.workOrderCode }}
  59. </el-link>
  60. </template>
  61. <template v-slot:disposalStatus="{ row }">
  62. <el-tag v-if="row.disposalStatus == 1" type="success">已接收</el-tag>
  63. <el-tag v-if="row.disposalStatus == 2" type="danger">已拒绝</el-tag>
  64. </template>
  65. <template v-slot:totalFirstArticleDualInspectionStatus="{ row }">
  66. <el-tag
  67. v-if="
  68. row.hasFirstArticleDualInspection == 1 &&
  69. row.totalFirstArticleDualInspectionStatus == 0
  70. "
  71. type="success"
  72. >待自检</el-tag
  73. >
  74. <el-tag
  75. v-if="
  76. row.hasFirstArticleDualInspection == 1 &&
  77. row.totalFirstArticleDualInspectionStatus == 1
  78. "
  79. type="success"
  80. >待专检</el-tag
  81. >
  82. <el-tag
  83. v-if="
  84. row.hasFirstArticleDualInspection == 1 &&
  85. row.totalFirstArticleDualInspectionStatus == 2
  86. "
  87. type="success"
  88. >已完成</el-tag
  89. >
  90. </template>
  91. <template v-slot:action="{ row }">
  92. <el-link
  93. v-if="tabValue == '2' && row.disposalStatus == '2'"
  94. :underline="false"
  95. type="primary"
  96. @click="reassignTask(row)"
  97. >转派
  98. </el-link>
  99. <el-link
  100. :underline="false"
  101. type="primary"
  102. @click="details('report', row)"
  103. v-if="
  104. (row.disposalStatus == '1' &&
  105. row.hasFirstArticleDualInspection == '0' &&
  106. tabValue != '4') ||
  107. (row.disposalStatus == '1' &&
  108. row.totalFirstArticleDualInspectionStatus == 2 &&
  109. row.hasFirstArticleDualInspection == '1' &&
  110. tabValue != '4')
  111. "
  112. >报工
  113. </el-link>
  114. <el-link
  115. :underline="false"
  116. type="primary"
  117. @click="selfRequest(row)"
  118. v-if="
  119. row.disposalStatus == '1' &&
  120. row.totalFirstArticleDualInspectionStatus == 2 &&
  121. row.hasFirstArticleDualInspection == '1' &&
  122. tabValue != '4'
  123. "
  124. >首件两检详情
  125. </el-link>
  126. <el-link
  127. :underline="false"
  128. type="primary"
  129. @click="details('report', row)"
  130. v-if="tabValue == '4' && !row.status"
  131. >报工
  132. </el-link>
  133. <!-- <el-link
  134. :underline="false"
  135. type="primary"
  136. @click="details('report', row)"
  137. v-if="
  138. ((row.disposalStatus == '1' || tabValue == '2') &&
  139. row.totalFirstArticleDualInspectionStatus == 2) ||
  140. (!row.totalFirstArticleDualInspectionStatus &&
  141. row.totalFirstArticleDualInspectionStatus != 0 &&
  142. tabValue == '4' &&
  143. row.status.code != 5)
  144. "
  145. >报工
  146. </el-link> -->
  147. <el-link
  148. :underline="false"
  149. type="primary"
  150. @click="viewRecords(row.id)"
  151. v-if="row.disposalStatus == '1'"
  152. >报工记录
  153. </el-link>
  154. <!-- v-if="
  155. (row.disposalStatus == '1' || tabValue == '2') &&
  156. row.hasFirstArticleDualInspection == 1
  157. " -->
  158. <el-link
  159. :underline="false"
  160. type="primary"
  161. @click="selfRequest(row)"
  162. v-if="
  163. row.disposalStatus == '1' &&
  164. tabValue != '4' &&
  165. row.hasFirstArticleDualInspection == '1' &&
  166. row.totalFirstArticleDualInspectionStatus != 2
  167. "
  168. >首件两检
  169. </el-link>
  170. <el-popconfirm
  171. icon="el-icon-info"
  172. title="确定接收任务吗?"
  173. @confirm="receiveTask(row.id, '1')"
  174. v-if="
  175. row.disposalStatus != '1' &&
  176. row.disposalStatus != '2' &&
  177. tabValue != '2' &&
  178. tabValue != '4'
  179. "
  180. >
  181. <el-button slot="reference" type="text">接收</el-button>
  182. </el-popconfirm>
  183. <el-popconfirm
  184. icon="el-icon-info"
  185. title="确定拒绝任务吗?"
  186. @confirm="receiveTask(row.id, '2')"
  187. v-if="
  188. row.disposalStatus != '1' &&
  189. row.disposalStatus != '2' &&
  190. tabValue != '2' &&
  191. tabValue != '4'
  192. "
  193. >
  194. <el-button slot="reference" type="text">拒绝</el-button>
  195. </el-popconfirm>
  196. <!-- <el-link
  197. :underline="false"
  198. type="primary"
  199. @click="receiveTask(row)"
  200. v-if="row.disposalStatus != '1'"
  201. >接收任务
  202. </el-link> -->
  203. <!-- <el-link
  204. :underline="false"
  205. type="primary"
  206. @click="rejectTask(row)"
  207. v-if="row.disposalStatus != '1'"
  208. >拒绝任务
  209. </el-link> -->
  210. </template>
  211. </ele-pro-table>
  212. </el-card>
  213. <modifyDialog ref="modifyRef" />
  214. <Ddtails ref="detailsRef" @success="reload" />
  215. <el-dialog
  216. title="选择人员"
  217. :visible.sync="dialogFormVisible"
  218. v-if="dialogFormVisible"
  219. width="30%"
  220. center
  221. >
  222. <el-form :model="form">
  223. <el-form-item label="人员">
  224. <el-select
  225. size="mini"
  226. class="content_num"
  227. filterable
  228. v-model="form.userId"
  229. placeholder="请选择任务人员"
  230. >
  231. <el-option
  232. v-for="item in teamList"
  233. :label="item.name"
  234. :value="item.id"
  235. :key="item.id"
  236. >
  237. </el-option>
  238. </el-select>
  239. </el-form-item>
  240. </el-form>
  241. <div slot="footer" class="dialog-footer">
  242. <el-button @click="dialogFormVisible = false">取 消</el-button>
  243. <el-button type="primary" @click="chooseUser">确 定</el-button>
  244. </div>
  245. </el-dialog>
  246. <qualityInspection
  247. ref="qualityInspectionRefs"
  248. @close="close"
  249. ></qualityInspection>
  250. <nc-report ref="ncReportRef" @refreshList="reload"></nc-report>
  251. </div>
  252. </template>
  253. <script>
  254. import TaskSearch from './components/task-search.vue';
  255. import Ddtails from './components/Ddtails.vue';
  256. import modifyDialog from '@/views/taskList/components/modifyDialog.vue';
  257. import { getteampage } from '@/api/produceWord/index.js';
  258. import { getProduceTaskList } from '@/api/aps';
  259. import {
  260. pageByCurrentUser,
  261. pageByCurrentUserLeader,
  262. listUpdateRealTimeRecord,
  263. taskManagement,
  264. transferTasks,
  265. pageByCurrentCurrentUserTeam,
  266. getNCtaskListData
  267. } from '@/api/workOrderList';
  268. import { revokeWork } from '@/api/manufacture/spreadWorkOrder';
  269. import qualityInspection from '@/views/produce/components/qualityInspection/index.vue';
  270. import ncReport from './components/ncReport.vue';
  271. import { parameterGetByCode } from '@/api/system/dictionary-data';
  272. export default {
  273. components: {
  274. TaskSearch,
  275. Ddtails,
  276. modifyDialog,
  277. qualityInspection,
  278. ncReport
  279. },
  280. data() {
  281. return {
  282. loading: false,
  283. tabValue: '1',
  284. statusOpt: [
  285. { label: '待生产', value: 4 },
  286. { label: '生产中', value: 5 },
  287. { label: '待下达', value: 8 }
  288. ],
  289. form: {
  290. userId: '',
  291. id: ''
  292. },
  293. dialogFormVisible: false,
  294. teamList: [],
  295. tableHeight: 'calc(100vh - 380px)'
  296. // isInspection: '0'
  297. };
  298. },
  299. computed: {
  300. // 表格列配置
  301. columns() {
  302. return [
  303. {
  304. columnKey: 'index',
  305. label: '序号',
  306. type: 'index',
  307. width: 55,
  308. align: 'center',
  309. showOverflowTooltip: true,
  310. fixed: 'left'
  311. },
  312. {
  313. slot: 'assigneeCode',
  314. prop: 'assigneeCode',
  315. label: '任务编号',
  316. align: 'center',
  317. showOverflowTooltip: true,
  318. width: 210
  319. },
  320. {
  321. slot: 'workOrderCode',
  322. prop: 'workOrderCode',
  323. label: '生产订单号',
  324. align: 'center',
  325. showOverflowTooltip: true,
  326. width: 210
  327. },
  328. {
  329. prop: 'mesWorkOrderCode',
  330. label: '生产工单号',
  331. align: 'center',
  332. showOverflowTooltip: true,
  333. width: 210
  334. },
  335. {
  336. prop: 'productionPlanCode',
  337. label: '计划编号',
  338. align: 'center',
  339. showOverflowTooltip: true,
  340. width: 170
  341. },
  342. {
  343. prop: 'assigneeType',
  344. label: '执行类型',
  345. align: 'center',
  346. showOverflowTooltip: true,
  347. width: 120,
  348. formatter: (row) => {
  349. if (!row.assigneeType) return '';
  350. return row.assigneeType.desc;
  351. }
  352. },
  353. {
  354. prop: 'assigneeName',
  355. label: '执行对象名称',
  356. align: 'center',
  357. showOverflowTooltip: true,
  358. width: 180
  359. },
  360. {
  361. prop: 'workCenterName',
  362. label: '工作中心',
  363. align: 'center',
  364. width: 180,
  365. showOverflowTooltip: true
  366. },
  367. {
  368. prop: 'assignTeamName',
  369. label: '班组名称',
  370. align: 'center',
  371. showOverflowTooltip: true,
  372. width: 180
  373. },
  374. {
  375. prop: 'taskName',
  376. label: '工序名称',
  377. align: 'center',
  378. showOverflowTooltip: true,
  379. width: 150
  380. },
  381. {
  382. prop: 'produceRoutingName',
  383. label: '工艺路线',
  384. align: 'center',
  385. showOverflowTooltip: true,
  386. width: 170
  387. },
  388. {
  389. prop: 'productCode',
  390. label: '产品编码',
  391. align: 'center',
  392. showOverflowTooltip: true,
  393. width: 170
  394. },
  395. {
  396. prop: 'productName',
  397. label: '产品名称',
  398. align: 'center',
  399. showOverflowTooltip: true,
  400. width: 200
  401. },
  402. {
  403. prop: 'productionCodes',
  404. label: '生产编号',
  405. align: 'center',
  406. showOverflowTooltip: true,
  407. width: 170
  408. },
  409. {
  410. prop: 'brandNo',
  411. label: '牌号',
  412. align: 'center',
  413. showOverflowTooltip: true,
  414. width: 170
  415. },
  416. {
  417. prop: 'batchNo',
  418. label: '批次号',
  419. align: 'center',
  420. width: 100,
  421. showOverflowTooltip: true
  422. },
  423. {
  424. prop: 'model',
  425. label: '型号',
  426. align: 'center',
  427. width: 200,
  428. showOverflowTooltip: true
  429. },
  430. {
  431. prop: 'quantity',
  432. label: '任务数量',
  433. align: 'center',
  434. showOverflowTooltip: true,
  435. width: 110
  436. },
  437. {
  438. prop: 'weight',
  439. label: '任务重量(kg)',
  440. align: 'center',
  441. showOverflowTooltip: true,
  442. width: 110
  443. },
  444. {
  445. prop: 'planStartTime',
  446. label: '计划开始时间',
  447. align: 'center',
  448. showOverflowTooltip: true,
  449. width: 180
  450. },
  451. {
  452. prop: 'planCompleteTime',
  453. label: '计划结束时间',
  454. align: 'center',
  455. showOverflowTooltip: true,
  456. width: 180
  457. },
  458. {
  459. prop: 'startTime',
  460. label: '任务开始时间',
  461. align: 'center',
  462. showOverflowTooltip: true,
  463. width: 180
  464. },
  465. {
  466. prop: 'endTime',
  467. label: '任务结束时间',
  468. align: 'center',
  469. showOverflowTooltip: true,
  470. width: 180
  471. },
  472. {
  473. label: '实际开始时间',
  474. prop: 'realStartTime',
  475. minWidth: 150,
  476. align: 'center',
  477. showOverflowTooltip: true
  478. },
  479. {
  480. label: '实际结束时间',
  481. prop: 'realEndTime',
  482. minWidth: 150,
  483. align: 'center',
  484. showOverflowTooltip: true
  485. },
  486. {
  487. label: '工时',
  488. prop: 'durationText',
  489. width: 150,
  490. align: 'center',
  491. showOverflowTooltip: true
  492. },
  493. {
  494. prop: 'firstTaskName',
  495. label: '首工序',
  496. align: 'center',
  497. width: 180,
  498. showOverflowTooltip: true
  499. },
  500. {
  501. prop: 'createTime',
  502. label: '创建时间',
  503. align: 'center',
  504. showOverflowTooltip: true,
  505. width: 180
  506. },
  507. {
  508. prop: 'statusText',
  509. label: '状态',
  510. align: 'center',
  511. // formatter: (row) => {
  512. // const obj = this.statusOpt.find((i) => i.value == row.status);
  513. // return obj && obj.label;
  514. // },
  515. width: 120
  516. },
  517. {
  518. prop: 'disposalStatus',
  519. label: '任务接收状态',
  520. align: 'center',
  521. slot: 'disposalStatus',
  522. width: 120
  523. },
  524. {
  525. prop: 'totalFirstArticleDualInspectionStatus',
  526. label: '首件两检状态',
  527. align: 'center',
  528. slot: 'totalFirstArticleDualInspectionStatus',
  529. width: 120
  530. },
  531. {
  532. prop: 'customerName',
  533. label: '客户名称',
  534. align: 'center',
  535. showOverflowTooltip: true,
  536. width: 180
  537. },
  538. {
  539. prop: 'serialNo',
  540. label: '客户代号',
  541. align: 'center',
  542. showOverflowTooltip: true,
  543. width: 180
  544. },
  545. {
  546. prop: 'simpleName',
  547. label: '客户简称',
  548. align: 'center',
  549. showOverflowTooltip: true,
  550. width: 180
  551. },
  552. {
  553. columnKey: 'action',
  554. label: '操作',
  555. width: 200,
  556. align: 'center',
  557. resizable: false,
  558. fixed: 'right',
  559. slot: 'action'
  560. }
  561. ];
  562. },
  563. ncColumns() {
  564. return [
  565. {
  566. columnKey: 'index',
  567. label: '序号',
  568. type: 'index',
  569. width: 55,
  570. align: 'center',
  571. showOverflowTooltip: true,
  572. fixed: 'left'
  573. },
  574. {
  575. slot: 'code',
  576. prop: 'code',
  577. label: '任务编号',
  578. align: 'center',
  579. showOverflowTooltip: true,
  580. width: 210
  581. },
  582. {
  583. prop: 'productionPlanCode',
  584. label: '计划编号',
  585. align: 'center',
  586. showOverflowTooltip: true,
  587. width: 170
  588. },
  589. {
  590. prop: 'executeGroupName',
  591. label: '执行部门',
  592. align: 'center',
  593. showOverflowTooltip: true,
  594. width: 120
  595. },
  596. {
  597. prop: 'executorName',
  598. label: '执行人',
  599. align: 'center',
  600. showOverflowTooltip: true,
  601. width: 180
  602. },
  603. {
  604. prop: 'taskName',
  605. label: '工序名称',
  606. align: 'center',
  607. showOverflowTooltip: true,
  608. width: 150
  609. },
  610. {
  611. prop: 'produceRoutingName',
  612. label: '工艺路线',
  613. align: 'center',
  614. showOverflowTooltip: true,
  615. width: 170
  616. },
  617. {
  618. prop: 'categoryCode',
  619. label: '产品编码',
  620. align: 'center',
  621. showOverflowTooltip: true,
  622. width: 170
  623. },
  624. {
  625. prop: 'categoryName',
  626. label: '产品名称',
  627. align: 'center',
  628. showOverflowTooltip: true,
  629. width: 200
  630. },
  631. {
  632. prop: 'brandNum',
  633. label: '牌号',
  634. align: 'center',
  635. showOverflowTooltip: true,
  636. width: 170
  637. },
  638. {
  639. prop: 'modelType',
  640. label: '型号',
  641. align: 'center',
  642. width: 200,
  643. showOverflowTooltip: true
  644. },
  645. {
  646. prop: 'specification',
  647. label: '规格',
  648. align: 'center',
  649. width: 200,
  650. showOverflowTooltip: true
  651. },
  652. {
  653. label: '实际开始时间',
  654. prop: 'realStartTime',
  655. minWidth: 150,
  656. align: 'center',
  657. showOverflowTooltip: true
  658. },
  659. {
  660. label: '实际结束时间',
  661. prop: 'realEndTime',
  662. minWidth: 150,
  663. align: 'center',
  664. showOverflowTooltip: true
  665. },
  666. {
  667. prop: 'createTime',
  668. label: '创建时间',
  669. align: 'center',
  670. showOverflowTooltip: true,
  671. width: 180
  672. },
  673. {
  674. prop: 'remark',
  675. label: '订单备注',
  676. align: 'center',
  677. showOverflowTooltip: true,
  678. width: 180
  679. },
  680. {
  681. prop: 'reportRemark',
  682. label: '报备注',
  683. align: 'center',
  684. showOverflowTooltip: true,
  685. width: 180
  686. },
  687. {
  688. columnKey: 'action',
  689. label: '操作',
  690. width: 200,
  691. align: 'center',
  692. resizable: false,
  693. fixed: 'right',
  694. slot: 'action'
  695. }
  696. ];
  697. }
  698. },
  699. created() {},
  700. mounted() {
  701. // this.getInspections();
  702. },
  703. methods: {
  704. handleTabClick(e) {
  705. this.tabValue = e.name;
  706. this.reload();
  707. },
  708. /* 表格数据源 */
  709. datasource({ page, limit, where }) {
  710. if (this.tabValue && this.tabValue != 0) {
  711. let api =
  712. this.tabValue === '1'
  713. ? pageByCurrentUser
  714. : this.tabValue == '2'
  715. ? pageByCurrentUserLeader
  716. : this.tabValue == '3'
  717. ? pageByCurrentCurrentUserTeam
  718. : getNCtaskListData;
  719. let params = {
  720. ...where,
  721. pageNum: page,
  722. size: limit
  723. };
  724. if (this.tabValue === '3') {
  725. params.teamIdsStr = this.$store.state.user.info?.teamId;
  726. // if (teamId) {
  727. // const ids = teamId
  728. // .split(',')
  729. // .map((i) => i.trim())
  730. // .filter(Boolean);
  731. // params.teamIds = ids; // 不要加 []
  732. // }
  733. }
  734. console.log(params);
  735. return api(params);
  736. } else {
  737. return [];
  738. }
  739. // if (
  740. // (this.$hasPermission('mes:taskreport:myorder') &&
  741. // this.$hasPermission('mes:taskreport:allorder')) ||
  742. // (this.$hasPermission('mes:taskreport:myorder') &&
  743. // !this.$hasPermission('mes:taskreport:allorder'))
  744. // ) {
  745. // let api = pageByCurrentUser;
  746. // return api({
  747. // ...where,
  748. // pageNum: page,
  749. // size: limit
  750. // });
  751. // } else if (
  752. // this.$hasPermission('mes:taskreport:myorder') &&
  753. // !this.$hasPermission('mes:taskreport:allorder')
  754. // ) {
  755. // let api = pageByCurrentUserLeader;
  756. // return api({
  757. // ...where,
  758. // pageNum: page,
  759. // size: limit
  760. // });
  761. // } else {
  762. // return [];
  763. // }
  764. // if()
  765. },
  766. // async getInspections() {
  767. // await parameterGetByCode({
  768. // code: 'first_article_dual_inspection_for_report'
  769. // }).then((res) => {
  770. // this.isInspection = res.value ? res.value : '0';
  771. // });
  772. // },
  773. async chooseUser() {
  774. if (!this.form.userId) {
  775. return this.$message.warning('请选择转派人员');
  776. }
  777. const data = this.teamList.find((it) => it.id == this.form.userId);
  778. await transferTasks({
  779. assigneeId: data.id,
  780. assigneeName: data.name,
  781. id: this.form.id
  782. }).then((res) => {
  783. console.log(res);
  784. });
  785. this.dialogFormVisible = false;
  786. this.reload();
  787. },
  788. async receiveTask(id, type) {
  789. await taskManagement({
  790. id,
  791. disposalStatus: Number(type)
  792. }).then((res) => {
  793. console.log(res);
  794. this.reload();
  795. });
  796. },
  797. async selfRequest(row) {
  798. let params = {
  799. routingId: row.produceRoutingId,
  800. pageNum: 1,
  801. size: -1,
  802. isDetail: true
  803. };
  804. const result = await getProduceTaskList(params);
  805. const taskData = result.list.find(
  806. (item) => item.sourceTaskId === row.taskId
  807. );
  808. this.$refs.qualityInspectionRefs.open(row, taskData, 1);
  809. },
  810. reportClick(row, type) {
  811. this.$refs.selfReportingRef.open(row, type);
  812. },
  813. detailsNC(item, type) {
  814. this.$refs.ncReportRef.open(item, type);
  815. },
  816. // async receiveTask(item) {
  817. // await taskManagement({
  818. // id: item.id,
  819. // disposalStatus: 1
  820. // }).then((res) => {
  821. // console.log(res);
  822. // this.reload();
  823. // });
  824. // },
  825. // async rejectTask(item) {
  826. // await taskManagement({
  827. // id: item.id,
  828. // disposalStatus: 2
  829. // }).then((res) => {
  830. // console.log(res);
  831. // this.reload();
  832. // });
  833. // },
  834. async reassignTask(item) {
  835. this.form.userId = '';
  836. this.form.id = item.id;
  837. await getteampage({ name: item.assignTeamName }).then((res) => {
  838. this.teamList = res.list[0].userVOList;
  839. });
  840. this.dialogFormVisible = true;
  841. },
  842. fullscreenChange(fullscreen) {
  843. if (fullscreen) {
  844. this.tableHeight = 'calc(100vh - 120px)';
  845. } else {
  846. this.tableHeight = 'calc(100vh - 380px)';
  847. }
  848. },
  849. close() {
  850. this.reload();
  851. },
  852. reload(where) {
  853. this.$refs.table.reload({ page: 1, where });
  854. },
  855. details(type, row) {
  856. let currentRow = {
  857. assignCode: row.assignCode,
  858. mesWorkOrderCode: row.mesWorkOrderCode,
  859. workOrderCode: row.workOrderCode,
  860. workOrderId: row.workOrderId,
  861. productionPlanCode: row.productionPlanCode,
  862. produceRoutingName: row.produceRoutingName,
  863. formingNum: row.formingNum,
  864. assignTeamName: row.assignTeamName,
  865. formingWeight: row.formingWeight,
  866. planStartTime: row.planStartTime,
  867. planCompleteTime: row.planCompleteTime,
  868. startTime: row.startTime,
  869. firstTaskId: row.firstTaskId,
  870. endTime: row.endTime,
  871. taskName: row.taskName,
  872. firstTaskName: row.firstTaskName,
  873. assigneeType: row.assigneeType ? row.assigneeType.desc : '',
  874. assigneeName: row.assigneeName,
  875. weight: row.weight,
  876. quantity: row.quantity,
  877. durationText: row.durationText,
  878. apsAssigneeId: row.id,
  879. batchNo: row.batchNo,
  880. productCode: row.productCode,
  881. productName: row.productName,
  882. specification: row.specification,
  883. newWeightUnit: row.newWeightUnit,
  884. measuringUnit: row.measuringUnit
  885. };
  886. const actualQuantity = this.add(
  887. row.reportQuantity ? row.reportQuantity : 0,
  888. row.lossQuantity ? row.lossQuantity : 0
  889. );
  890. const remainingQuantity = this.sub(row.formingNum, actualQuantity);
  891. let form = {
  892. realEndTime: row.realEndTime,
  893. realStartTime: row.realStartTime,
  894. unqualifiedWeight: row.unqualifiedWeight,
  895. unqualifiedQuantity: row.unqualifiedQuantity,
  896. qualifiedWeight: row.qualifiedWeight,
  897. remark: row.assigneeRemark,
  898. qualifiedQuantity: row.qualifiedQuantity,
  899. reportQuantity: row.reportQuantity
  900. ? remainingQuantity
  901. : row.formingNum,
  902. lossQuantity: 0,
  903. workOrderCode: row.workOrderCode,
  904. workOrderId: row.workOrderId,
  905. taskId: row.taskId
  906. };
  907. if (this.tabValue == '4') {
  908. const data = {
  909. realStartTime: '',
  910. realEndTime: '',
  911. brandNum: row.brandNum,
  912. categoryName: row.categoryName,
  913. categoryCode: row.categoryCode,
  914. code: row.code,
  915. productionPlanCode: row.productionPlanCode,
  916. produceRoutingName: row.produceRoutingName,
  917. taskName: row.taskName,
  918. modelType: row.modelType,
  919. specification: row.specification,
  920. fileParam: [],
  921. reportRemark: row.reportRemark,
  922. id: row.id,
  923. sourceTaskId: row.sourceTaskId
  924. };
  925. this.$refs.ncReportRef.open(data);
  926. } else {
  927. this.$refs.detailsRef.open(type, currentRow, form);
  928. }
  929. },
  930. getDecimalLength(num) {
  931. return (num.toString().split('.')[1] || '').length;
  932. },
  933. toInteger(num) {
  934. const len = this.getDecimalLength(num);
  935. return {
  936. int: Math.round(num * Math.pow(10, len)),
  937. factor: Math.pow(10, len)
  938. };
  939. },
  940. add(a, b) {
  941. const { int: aInt, factor: aFactor } = this.toInteger(a);
  942. const { int: bInt, factor: bFactor } = this.toInteger(b);
  943. const maxFactor = Math.max(aFactor, bFactor);
  944. return (
  945. (aInt * (maxFactor / aFactor) + bInt * (maxFactor / bFactor)) /
  946. maxFactor
  947. );
  948. },
  949. sub(a, b) {
  950. const { int: aInt, factor: aFactor } = this.toInteger(a);
  951. const { int: bInt, factor: bFactor } = this.toInteger(b);
  952. const maxFactor = Math.max(aFactor, bFactor);
  953. return (
  954. (aInt * (maxFactor / aFactor) - bInt * (maxFactor / bFactor)) /
  955. maxFactor
  956. );
  957. },
  958. viewRecords(apsAssigneeId) {
  959. listUpdateRealTimeRecord(apsAssigneeId)
  960. .then((res) => {
  961. if (res && res.length > 0) {
  962. this.$refs.modifyRef.open(res);
  963. } else {
  964. this.$message.warning('暂无修改历史记录数据');
  965. }
  966. })
  967. .catch((err) => {
  968. this.$message.error(err.message);
  969. });
  970. }
  971. }
  972. };
  973. </script>
  974. <style lang="scss" scoped>
  975. .ele-body {
  976. height: 100%;
  977. // .my_pro_table {
  978. // height: calc(100% - 136px);
  979. // }
  980. }
  981. // ::v-deep .el-table {
  982. // height: calc(100% - 96px);
  983. // }
  984. </style>