index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <!-- 搜索表单 -->
  5. <search @search="reload" />
  6. <!-- 数据表格 -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. :selection.sync="selection"
  12. row-key="code"
  13. :page-size="20"
  14. @columns-change="handleColumnChange"
  15. :cache-key="cacheKeyUrl"
  16. >
  17. <!-- 表头工具栏 -->
  18. <template v-slot:qualityType="{ row }">
  19. {{ getDictValue('质检计划类型', row.qualityType) }}
  20. </template>
  21. <template v-slot:qualityMode="{ row }">
  22. {{ getDictValue('取样类型', row.qualityMode) }}
  23. </template>
  24. <template v-slot:code="{ row }">
  25. <el-link
  26. type="primary"
  27. :underline="false"
  28. @click="report(row, 'detail')"
  29. >{{ row.code }}</el-link
  30. >
  31. </template>
  32. <template v-slot:approvalStatus="{ row }">
  33. <el-link
  34. v-if="row.processInstanceId"
  35. type="primary"
  36. :underline="false"
  37. @click="bpmDetailOpen(row, 'detail')"
  38. >{{ reviewStatus[row.approvalStatus] }}
  39. </el-link>
  40. <span v-else> {{ reviewStatus[row.approvalStatus] }}</span>
  41. </template>
  42. <!-- 操作列 -->
  43. <template v-slot:action="{ row }">
  44. <el-link
  45. type="primary"
  46. :underline="false"
  47. icon="el-icon-edit"
  48. @click="openEdit(row)"
  49. v-if="
  50. [0, 3].includes(row.approvalStatus) &&
  51. pageName == 'inspectionProjectRequest'
  52. "
  53. >
  54. 编辑
  55. </el-link>
  56. <el-link
  57. type="primary"
  58. :underline="false"
  59. v-if="
  60. [0, 3].includes(row.approvalStatus) &&
  61. pageName == 'inspectionProjectRequest'
  62. "
  63. @click="approvalSubmit(row)"
  64. >提交</el-link
  65. >
  66. <!-- <el-link
  67. type="primary"
  68. :underline="false"
  69. v-if="
  70. [2].includes(row.approvalStatus) &&
  71. pageName == 'inspectionProjectEntrusted' &&
  72. row.status == 0
  73. "
  74. @click="sampleCollection(row)"
  75. >收样</el-link
  76. > -->
  77. <el-link
  78. type="primary"
  79. :underline="false"
  80. v-if="
  81. [2].includes(row.approvalStatus) &&
  82. pageName == 'inspectionProjectEntrusted' &&
  83. row.status == 1
  84. "
  85. @click="report(row, 'edit')"
  86. >报工</el-link
  87. >
  88. <el-link
  89. type="primary"
  90. :underline="false"
  91. v-if="
  92. [2].includes(row.approvalStatus) &&
  93. pageName == 'inspectionProjectEntrusted' &&
  94. row.status == 1
  95. "
  96. @click="openTransfer(row)"
  97. >转派</el-link
  98. >
  99. <!-- <el-link
  100. v-if="row.qualityWorkOrderId"
  101. type="primary"
  102. :underline="false"
  103. @click="craftFiles(row.qualityWorkOrderId)"
  104. >工艺文件</el-link
  105. > -->
  106. <el-link
  107. type="danger"
  108. :underline="false"
  109. icon="el-icon-edit"
  110. @click="remove(row)"
  111. v-if="
  112. [0, 3].includes(row.approvalStatus) &&
  113. pageName == 'inspectionProjectRequest'
  114. "
  115. >
  116. 删除
  117. </el-link>
  118. </template>
  119. </ele-pro-table>
  120. </el-card>
  121. <!-- 编辑弹窗 -->
  122. <inspectionProjectTaskSend
  123. ref="inspectionProjectTaskSendRef"
  124. @reload="reload"
  125. />
  126. <!-- 编辑弹窗 -->
  127. <inspectionProjectReport
  128. ref="inspectionProjectReportRef"
  129. @reload="reload"
  130. />
  131. <processSubmitDialog
  132. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  133. v-if="processSubmitDialogFlag"
  134. ref="processSubmitDialogRef"
  135. @reload="reload"
  136. ></processSubmitDialog>
  137. <Transfer
  138. v-if="transferVisible"
  139. :transferVisible.sync="transferVisible"
  140. @success="transferConfirm"
  141. :id="transferId"
  142. ></Transfer>
  143. <ele-modal
  144. :visible.sync="bpmDetailShow"
  145. :close-on-click-modal="false"
  146. :close-on-press-escape="false"
  147. append-to-body
  148. width="70%"
  149. :maxable="true"
  150. >
  151. <bpmDetail
  152. v-if="bpmDetailShow && processInstanceId"
  153. :id="processInstanceId"
  154. ></bpmDetail>
  155. <template v-slot:footer>
  156. <el-button @click="bpmDetailShow = false">关闭</el-button>
  157. </template>
  158. </ele-modal>
  159. </div>
  160. </template>
  161. <script>
  162. import search from './components/search.vue';
  163. import Transfer from './components/transfer.vue';
  164. import tabMixins from '@/mixins/tableColumnsMixin';
  165. import inspectionProjectTaskSend from '@/views/inspectionProjectTask/components/inspectionProjectTaskSend.vue';
  166. import inspectionProjectReport from '@/views/inspectionWork/components/inspectionProjectReport.vue';
  167. import {
  168. getList,
  169. sampleCollection,
  170. getById,
  171. verificationQualityInspector,
  172. removeItem
  173. } from '@/api/inspectionProjectRequest';
  174. import { craftFiles } from '@/api/inspectionWork';
  175. import dictMixins from '@/mixins/dictMixins';
  176. import { reviewStatus } from '@/enum/dict';
  177. import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
  178. import bpmDetail from '@/views/bpm/processInstance/detail.vue';
  179. import { recordingMethodList } from '@/utils/util.js';
  180. export default {
  181. components: {
  182. search,
  183. inspectionProjectTaskSend,
  184. processSubmitDialog,
  185. inspectionProjectReport,
  186. Transfer,
  187. bpmDetail
  188. },
  189. props: {
  190. cacheKeyUrl: {
  191. type: String,
  192. default: 'qsm-c2e9664a-inspectionProjectRequest'
  193. },
  194. pageName: {
  195. type: String,
  196. default: 'inspectionProjectRequest'
  197. }
  198. },
  199. mixins: [dictMixins, tabMixins],
  200. data() {
  201. return {
  202. processSubmitDialogFlag: false,
  203. transferVisible: false,
  204. reviewStatus,
  205. transferId: '',
  206. processInstanceId: '',
  207. bpmDetailShow: false,
  208. // 表格列配置
  209. columns: []
  210. };
  211. },
  212. created() {
  213. this.requestDict('质检计划类型');
  214. this.requestDict('取样类型');
  215. this.getColumns();
  216. },
  217. methods: {
  218. bpmDetailOpen(row) {
  219. this.bpmDetailShow = true;
  220. this.processInstanceId = row.processInstanceId;
  221. },
  222. getColumns() {
  223. this.columns = [
  224. {
  225. columnKey: 'index',
  226. label: '序号',
  227. type: 'index',
  228. width: 55,
  229. align: 'center',
  230. showOverflowTooltip: true,
  231. fixed: 'left'
  232. },
  233. {
  234. prop: 'code',
  235. slot: 'code',
  236. label: '请托单号',
  237. showOverflowTooltip: true,
  238. align: 'center',
  239. minWidth: 130
  240. },
  241. {
  242. prop: 'name',
  243. label: '任务名称',
  244. showOverflowTooltip: true,
  245. align: 'center',
  246. minWidth: 110
  247. },
  248. {
  249. prop: 'receiveDeptName',
  250. label: '接收部门',
  251. showOverflowTooltip: true,
  252. align: 'center',
  253. minWidth: 110
  254. },
  255. {
  256. prop: 'receiveUserName',
  257. minWidth: 110,
  258. label: '接收人员',
  259. align: 'center',
  260. showOverflowTooltip: true
  261. },
  262. {
  263. prop: 'executeDeptName',
  264. label: '执行部门',
  265. showOverflowTooltip: true,
  266. align: 'center',
  267. minWidth: 110
  268. },
  269. {
  270. prop: 'executeUserName',
  271. minWidth: 110,
  272. label: '执行人员',
  273. align: 'center',
  274. showOverflowTooltip: true
  275. },
  276. {
  277. prop: 'requiredCompletionTime',
  278. minWidth: 110,
  279. label: '完成日期',
  280. align: 'center',
  281. showOverflowTooltip: true
  282. },
  283. {
  284. prop: 'urgent',
  285. minWidth: 110,
  286. label: '紧急程度',
  287. align: 'center',
  288. formatter: (row) => {
  289. return row.urgent == 1
  290. ? '普通'
  291. : row.urgent == 2
  292. ? '紧急'
  293. : '重要';
  294. },
  295. showOverflowTooltip: true
  296. },
  297. {
  298. prop: 'qualityWorkOrderCode',
  299. minWidth: 110,
  300. label: '质检工单编码',
  301. align: 'center',
  302. showOverflowTooltip: true
  303. },
  304. {
  305. prop: 'qualityWorkOrderName',
  306. minWidth: 110,
  307. label: '质检工单名称',
  308. align: 'center',
  309. showOverflowTooltip: true
  310. },
  311. {
  312. prop: 'sourceCode',
  313. minWidth: 110,
  314. label: '来源单号',
  315. align: 'center',
  316. showOverflowTooltip: true
  317. },
  318. {
  319. prop: 'qualityType',
  320. slot: 'qualityType',
  321. minWidth: 110,
  322. label: '类型',
  323. align: 'center',
  324. showOverflowTooltip: true
  325. },
  326. {
  327. slot: 'qualityMode',
  328. prop: 'qualityMode',
  329. minWidth: 110,
  330. label: '质检方式',
  331. align: 'center',
  332. showOverflowTooltip: true
  333. },
  334. {
  335. prop: 'productCode',
  336. minWidth: 110,
  337. label: '编码',
  338. align: 'center',
  339. showOverflowTooltip: true
  340. },
  341. {
  342. prop: 'productName',
  343. minWidth: 110,
  344. label: '名称',
  345. align: 'center',
  346. showOverflowTooltip: true
  347. },
  348. {
  349. prop: 'batchNo',
  350. minWidth: 110,
  351. label: '批次号',
  352. align: 'center',
  353. showOverflowTooltip: true
  354. },
  355. {
  356. prop: 'specification',
  357. minWidth: 110,
  358. label: '规格',
  359. align: 'center',
  360. showOverflowTooltip: true
  361. },
  362. {
  363. prop: 'brandNo',
  364. minWidth: 110,
  365. label: '牌号',
  366. align: 'center',
  367. showOverflowTooltip: true
  368. },
  369. {
  370. prop: 'produceTaskName',
  371. minWidth: 110,
  372. label: '工序名称',
  373. align: 'center',
  374. showOverflowTooltip: true
  375. },
  376. {
  377. prop: 'recordingMethod',
  378. label: '记录方法',
  379. align: 'center',
  380. formatter: (row) => {
  381. return (
  382. recordingMethodList.find(
  383. (item) => item.value == row.recordingMethod
  384. )?.label || ''
  385. );
  386. },
  387. width: 130,
  388. showOverflowTooltip: true
  389. },
  390. {
  391. prop: 'status',
  392. minWidth: 110,
  393. label: '状态',
  394. align: 'center',
  395. formatter: (row) => {
  396. return row.status == 1
  397. ? '未报工'
  398. : row.status == 2
  399. ? '已报工'
  400. : '';
  401. },
  402. showOverflowTooltip: true
  403. },
  404. {
  405. prop: 'approvalStatus',
  406. slot: 'approvalStatus',
  407. label: '审核状态',
  408. align: 'center',
  409. minWidth: 110,
  410. showOverflowTooltip: true
  411. },
  412. {
  413. prop: 'createUserName',
  414. minWidth: 110,
  415. label: '创建人',
  416. align: 'center',
  417. showOverflowTooltip: true
  418. },
  419. {
  420. prop: 'createTime',
  421. minWidth: 110,
  422. label: '创建时间',
  423. align: 'center',
  424. showOverflowTooltip: true
  425. },
  426. {
  427. prop: 'approvalUserName',
  428. minWidth: 110,
  429. label: '审核人',
  430. align: 'center',
  431. // isNone: this.pageName != 'inspectionProjectEntrusted',
  432. showOverflowTooltip: true
  433. },
  434. {
  435. prop: 'approvalTime',
  436. minWidth: 110,
  437. label: '审核时间',
  438. align: 'center',
  439. // isNone: this.pageName != 'inspectionProjectEntrusted',
  440. showOverflowTooltip: true
  441. },
  442. {
  443. prop: 'sampleReceiverName',
  444. minWidth: 110,
  445. label: '收样人',
  446. align: 'center',
  447. // isNone: this.pageName != 'inspectionProjectEntrusted',
  448. showOverflowTooltip: true
  449. },
  450. {
  451. prop: 'sampleReceiverTime',
  452. minWidth: 110,
  453. label: '收样时间',
  454. // isNone: this.pageName != 'inspectionProjectEntrusted',
  455. align: 'center',
  456. showOverflowTooltip: true
  457. },
  458. {
  459. columnKey: 'action',
  460. label: '操作',
  461. width: 220,
  462. align: 'center',
  463. resizable: false,
  464. slot: 'action',
  465. fixed: 'right',
  466. showOverflowTooltip: true
  467. }
  468. ].filter((item) => !item.isNone);
  469. },
  470. approvalSubmit(res) {
  471. this.processSubmitDialogFlag = true;
  472. this.$nextTick(() => {
  473. let params = {
  474. businessId: res.id,
  475. businessKey: 'quality_inspection_item_entrustment',
  476. formCreateUserId: res.createUserId,
  477. variables: {
  478. businessCode: res.code,
  479. businessName: res.name,
  480. businessType: '请托'
  481. }
  482. };
  483. this.$refs.processSubmitDialogRef.init(params);
  484. });
  485. },
  486. /*回显类型 */
  487. /* 表格数据源 */
  488. datasource({ page, where, limit }) {
  489. return getList({
  490. ...where,
  491. pageNum: page,
  492. size: limit
  493. });
  494. },
  495. /* 刷新表格 */
  496. reload(where) {
  497. this.$refs.table.reload({ page: 1, where: where });
  498. },
  499. /* 打开编辑弹窗 */
  500. openEdit(row) {
  501. this.$refs.inspectionProjectTaskSendRef.open(
  502. row,
  503. '2',
  504. 'inspectionProjectRequest'
  505. );
  506. },
  507. /* 报工 */
  508. async report(row, type) {
  509. if (type != 'detail') {
  510. const code = await verificationQualityInspector(row.id);
  511. if (code == '-1') {
  512. return;
  513. }
  514. }
  515. const res = await getById(row.id);
  516. this.$refs.inspectionProjectReportRef.open(
  517. {
  518. workData: { ...res, measureUnit: res.sampleMeasureUnit },
  519. list: res.templateList
  520. },
  521. type,
  522. 'inspectionProjectRequest'
  523. );
  524. },
  525. // async craftFiles(id) {
  526. // if (id) {
  527. // const data = await craftFiles(id);
  528. // if (data.length) {
  529. // this.$nextTick(() => {
  530. // this.$refs.fileListRef.open(
  531. // data.map((item) => item.id),
  532. // 'view'
  533. // );
  534. // });
  535. // }
  536. // }
  537. // },
  538. async sampleCollection(row) {
  539. const code = await verificationQualityInspector(row.id);
  540. if (code == '-1') {
  541. return;
  542. }
  543. sampleCollection({ id: row.id }).then((res) => {
  544. this.$message.success('收样成功');
  545. this.reload();
  546. });
  547. },
  548. async openTransfer(row) {
  549. const code = await verificationQualityInspector(row.id);
  550. if (code == '-1') {
  551. return;
  552. }
  553. this.transferVisible = true;
  554. this.transferId = row.id;
  555. },
  556. transferConfirm() {
  557. this.transferVisible = false;
  558. this.$message.success('转派成功');
  559. this.reload();
  560. },
  561. /* 删除 */
  562. remove(row) {
  563. const loading = this.$loading({ lock: true });
  564. removeItem([row.id])
  565. .then((msg) => {
  566. loading.close();
  567. this.$message.success('删除' + msg);
  568. this.reload();
  569. })
  570. .catch((e) => {
  571. loading.close();
  572. });
  573. }
  574. }
  575. };
  576. </script>