index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  1. <template>
  2. <ele-modal
  3. :visible.sync="visible"
  4. v-if="visible"
  5. :before-close="handleClose"
  6. :close-on-click-modal="true"
  7. :close-on-press-escape="false"
  8. :maxable="true"
  9. append-to-body
  10. width="90%"
  11. title="质检记录表"
  12. >
  13. <div class="ele-body">
  14. <el-card shadow="never">
  15. <!-- <search ref="search" @search="search"></search> -->
  16. <!-- <seek-page :seekList="seekList" @search="search"></seek-page> -->
  17. <ele-pro-table
  18. ref="table"
  19. :columns="columns"
  20. :datasource="datasource"
  21. :pageSize="20"
  22. :pageSizes="[20, 30, 40, 50, 100]"
  23. cache-key="work-planindex"
  24. >
  25. <!-- <ele-pro-table
  26. ref="table"
  27. :columns="columns"
  28. :datasource="sourceList"
  29. :pageSize="20"
  30. :pageSizes="[20, 30, 40, 50, 100]"
  31. > -->
  32. <!-- 表头工具栏 -->
  33. <!-- <template v-slot:toolbar>-->
  34. <!-- <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="openEdit('add')">-->
  35. <!-- 添加-->
  36. <!-- </el-button>-->
  37. <!-- </template>-->
  38. <template v-slot:code="{ row }">
  39. <el-link
  40. type="primary"
  41. :underline="false"
  42. @click="openEdits('detail', row)"
  43. >{{ row.code }}</el-link
  44. >
  45. </template>
  46. <!-- <template v-slot:qualityPlanName="{ row }">-->
  47. <!-- <div v-if="row.qualityPlanId"> {{ row.qualityPlanName }}</div>-->
  48. <!-- <div v-else><el-tag size="mini">自建</el-tag></div>-->
  49. <!-- </template>-->
  50. <template v-slot:sourceCode="{ row }">
  51. <div>{{
  52. row.qualityPlanCode ? row.qualityPlanCode : row.workOrderCode
  53. }}</div>
  54. <!-- <div v-if="row.qualityType == 1">{{ row.qualityPlanCode }}</div>
  55. <div v-if="row.qualityType == 2">{{ row.workOrderCode }}</div> -->
  56. </template>
  57. <template v-slot:files="scope">
  58. <el-link
  59. v-for="link in scope.row.files"
  60. :key="link.id"
  61. type="primary"
  62. :underline="false"
  63. @click="downloadFile(link)"
  64. >{{ link.name }}</el-link
  65. >
  66. </template>
  67. <template v-slot:qualityType="{ row }">{{
  68. getQualityType(row.qualityType)
  69. }}</template>
  70. <template v-slot:qualityMode="{ row }">{{
  71. getQualityMode(row.qualityMode)
  72. }}</template>
  73. <template v-slot:accessory="scope">
  74. <el-link
  75. v-for="link in scope.row.accessory"
  76. :key="link.id"
  77. type="primary"
  78. :underline="false"
  79. @click="downloadFile(link)"
  80. >{{ link.name }}</el-link
  81. >
  82. </template>
  83. <!-- 操作列 -->
  84. <template v-slot:action="{ row }">
  85. <el-link
  86. type="primary"
  87. :underline="false"
  88. v-if="row.status == 0"
  89. @click="openEdit('edit', row)"
  90. >报工</el-link
  91. >
  92. <el-link
  93. type="primary"
  94. :underline="false"
  95. v-if="row.status == 0"
  96. @click="openTransfer(row.id)"
  97. >转派</el-link
  98. >
  99. <el-link type="primary" :underline="false" @click="openNumber(row)"
  100. >合格证</el-link
  101. >
  102. <jimureportBrowse
  103. style="display: inline-block; margin-left: 5px"
  104. v-if="row.status == 1"
  105. text="质检报告"
  106. :businessId="row.id"
  107. businessCode="qmsqualityinspectionprint"
  108. ></jimureportBrowse>
  109. <!-- 质检报告审批 -->
  110. <el-link
  111. v-if="
  112. row.status == 1 &&
  113. isReportApproval == 1 &&
  114. !row.reportApprovalStatus
  115. "
  116. type="primary"
  117. :underline="false"
  118. @click="reportApprovalSubmit(row)"
  119. >质检报告审批</el-link
  120. >
  121. <el-popconfirm
  122. class="ele-action"
  123. title="确定要关闭吗?"
  124. @confirm="closeWork(row)"
  125. v-if="row.status == 0 && row.qualityType == 2"
  126. >
  127. <template v-slot:reference>
  128. <el-link type="warning" :underline="false"> 关闭 </el-link>
  129. </template>
  130. </el-popconfirm>
  131. <!-- <el-link type="primary" :underline="false">
  132. 质检报告
  133. </el-link>-->
  134. <!-- <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(row)" v-if="row.status == 0">
  135. <template v-slot:reference>
  136. <el-link type="danger" :underline="false" icon="el-icon-delete">
  137. 删除
  138. </el-link>
  139. </template>
  140. </el-popconfirm>-->
  141. </template>
  142. </ele-pro-table>
  143. <!-- -->
  144. <!-- <el-dialog title="修改" :visible.sync="certificateVisible" width="25%" :before-close="handleClose">
  145. <el-form :inline="true" :model="formData" class="demo-form-inline">
  146. <el-form-item label="合格证号">
  147. <el-input v-model="formData.certificateNumber" placeholder="请输入"></el-input>
  148. </el-form-item>
  149. </el-form>
  150. <span slot="footer" class="dialog-footer">
  151. <el-button @click="handleClose">取 消</el-button>
  152. <el-button type="primary" @click="handleSubmit">确 定</el-button>
  153. </span>
  154. </el-dialog>-->
  155. <!-- -->
  156. </el-card>
  157. <Certificate
  158. @search="search"
  159. v-if="addOpen"
  160. :rowData="rowData"
  161. :addOpen="addOpen"
  162. @closeModel="closeModel"
  163. />
  164. <transfer
  165. v-if="transferVisible"
  166. :transferVisible.sync="transferVisible"
  167. @success="transferConfirm"
  168. :id="transferId"
  169. ></transfer>
  170. <process-submit-dialog
  171. api-fun-name="qmsReportApprovalAPI"
  172. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  173. :isCloseRefresh="false"
  174. v-if="processSubmitDialogFlag"
  175. ref="processSubmitDialogRef"
  176. @reload="search"
  177. ></process-submit-dialog>
  178. <edit ref="editRef" @close="close" @done="done" />
  179. <detailsOrder ref="detailsRef" />
  180. <addSample ref="addSampleRef" @reload="search"></addSample>
  181. </div>
  182. </ele-modal>
  183. </template>
  184. <script>
  185. import Certificate from './components/Certificate.vue';
  186. import search from './components/search.vue';
  187. import edit from './edit.vue';
  188. import detailsOrder from './details.vue';
  189. import addSample from './components/addSample.vue';
  190. import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
  191. import transfer from './components/transfer.vue';
  192. import jimureportBrowse from '@/components/jimureport/browseModal.vue';
  193. import {
  194. getList,
  195. removeItem,
  196. updateCertificateNumber,
  197. verificationQualityInspector,
  198. closeWork
  199. } from '@/api/inspectionWork';
  200. import dictMixins from '@/mixins/dictMixins';
  201. import tabMixins from '@/mixins/tableColumnsMixin';
  202. import { queryTodo } from '@/api/bpm/task';
  203. import { getFile } from '@/api/system/file';
  204. import { getByCode } from '@/api/system/dictionary-data';
  205. import { parameterGetByCode } from '@/api/system/dictionary-data';
  206. export default {
  207. mixins: [dictMixins, tabMixins],
  208. components: {
  209. search,
  210. jimureportBrowse,
  211. Certificate,
  212. edit,
  213. detailsOrder,
  214. processSubmitDialog,
  215. addSample,
  216. transfer
  217. },
  218. data() {
  219. return {
  220. columns: [
  221. {
  222. type: 'index',
  223. columnKey: 'index',
  224. align: 'center',
  225. label: '序号',
  226. width: 55,
  227. showOverflowTooltip: true,
  228. fixed: 'left'
  229. },
  230. {
  231. prop: 'code',
  232. label: '质检工单编码',
  233. slot: 'code',
  234. align: 'center',
  235. width: 180,
  236. showOverflowTooltip: true,
  237. fixed: 'left'
  238. },
  239. {
  240. prop: 'name',
  241. slot: 'name',
  242. width: 120,
  243. label: '质检工单名称',
  244. align: 'center',
  245. showOverflowTooltip: true
  246. },
  247. {
  248. label: '来源单号',
  249. prop: 'sourceCode',
  250. slot: 'sourceCode',
  251. align: 'center',
  252. width: 160,
  253. showOverflowTooltip: true
  254. },
  255. {
  256. label: '类型',
  257. prop: 'qualityType',
  258. slot: 'qualityType',
  259. align: 'center',
  260. width: 120,
  261. showOverflowTooltip: true
  262. },
  263. {
  264. label: '质检方式',
  265. prop: 'qualityMode',
  266. slot: 'qualityMode',
  267. align: 'center',
  268. width: 120,
  269. showOverflowTooltip: true
  270. },
  271. {
  272. prop: 'qualityName',
  273. label: '质检人',
  274. align: 'center',
  275. width: 120,
  276. showOverflowTooltip: true,
  277. formatter: (row) => {
  278. if (row.qualityName) {
  279. return row.qualityName;
  280. }
  281. return row.qualityNames || '';
  282. }
  283. },
  284. {
  285. prop: 'qualityTime',
  286. label: '质检时间',
  287. align: 'center',
  288. width: 120,
  289. showOverflowTooltip: true
  290. },
  291. {
  292. prop: 'productCode',
  293. width: 120,
  294. label: '编码',
  295. align: 'center',
  296. showOverflowTooltip: true
  297. },
  298. {
  299. prop: 'productName',
  300. width: 120,
  301. label: '名称',
  302. align: 'center',
  303. showOverflowTooltip: true
  304. },
  305. {
  306. prop: 'batchNo',
  307. label: '批次号',
  308. align: 'center',
  309. width: 120,
  310. showOverflowTooltip: true
  311. },
  312. {
  313. prop: 'specification',
  314. label: '规格',
  315. align: 'center',
  316. showOverflowTooltip: true
  317. },
  318. {
  319. prop: 'brandNo',
  320. label: '牌号',
  321. align: 'center',
  322. showOverflowTooltip: true
  323. },
  324. {
  325. prop: 'produceTaskName',
  326. label: '工序',
  327. align: 'center',
  328. width: 120,
  329. showOverflowTooltip: true
  330. },
  331. {
  332. prop: 'total',
  333. label: '总数量',
  334. align: 'center',
  335. showOverflowTooltip: true
  336. },
  337. {
  338. prop: 'qualifiedNumber',
  339. label: '合格数',
  340. align: 'center',
  341. showOverflowTooltip: true
  342. },
  343. {
  344. prop: 'qualificationRate',
  345. label: '合格率',
  346. align: 'center',
  347. showOverflowTooltip: true
  348. },
  349. {
  350. prop: 'noQualifiedNumber',
  351. label: '不合格数',
  352. align: 'center',
  353. showOverflowTooltip: true
  354. },
  355. {
  356. prop: 'noQualificationRate',
  357. label: '不合格率',
  358. align: 'center',
  359. showOverflowTooltip: true
  360. },
  361. {
  362. prop: 'hours',
  363. label: '工时',
  364. align: 'center',
  365. showOverflowTooltip: true
  366. },
  367. {
  368. label: '附件',
  369. prop: 'accessory',
  370. align: 'center',
  371. slot: 'accessory',
  372. showOverflowTooltip: true
  373. },
  374. {
  375. label: '创建时间',
  376. prop: 'createTime',
  377. align: 'center',
  378. width: 160
  379. },
  380. {
  381. prop: 'status',
  382. label: '状态',
  383. align: 'center',
  384. width: 80,
  385. formatter: (row, column, cellValue) => {
  386. return cellValue == 0
  387. ? '未报工'
  388. : cellValue == 1
  389. ? '已报工'
  390. : cellValue == 2
  391. ? '已关闭'
  392. : '';
  393. },
  394. fixed: 'right'
  395. },
  396. {
  397. columnKey: 'action',
  398. label: '操作',
  399. align: 'center',
  400. width: 200,
  401. resizable: false,
  402. slot: 'action',
  403. fixed: 'right'
  404. }
  405. ],
  406. formData: {
  407. certificateNumber: ''
  408. },
  409. // certificateVisible: false,
  410. rowData: {},
  411. typeList: [], //类型列表
  412. qualityMode: [], //取样类型
  413. statusList: [
  414. {
  415. value: 0,
  416. label: '未报工'
  417. },
  418. {
  419. value: 1,
  420. label: '已报工'
  421. }
  422. ],
  423. addOpen: false,
  424. visible: false,
  425. dataWork: {},
  426. sourceList: [],
  427. listId: [],
  428. transferVisible: false,
  429. transferId: '',
  430. isReportApproval: 0,
  431. processSubmitDialogFlag: false
  432. };
  433. },
  434. created() {
  435. // this.requestDict('质检计划类型');
  436. this.requestDict('不良品处理类型');
  437. // this.requestDict('取样类型');
  438. this.getTnspectionPlanType();
  439. this.getQualityMethodCode();
  440. this.getCode();
  441. // this.getQualityModeList('quality_method_code');
  442. // this.getQualityTypeList('inspection_plan_type');
  443. },
  444. computed: {
  445. seekList() {
  446. return [
  447. {
  448. label: '工单编码:',
  449. value: 'code',
  450. type: 'input',
  451. placeholder: ''
  452. },
  453. {
  454. label: '工单名称:',
  455. value: 'name',
  456. type: 'input',
  457. placeholder: ''
  458. },
  459. {
  460. label: '来源单号:',
  461. value: 'sourceCode',
  462. type: 'input',
  463. placeholder: ''
  464. },
  465. {
  466. label: '类型:',
  467. value: 'qualityType',
  468. type: 'select',
  469. placeholder: '',
  470. planList: this.typeList
  471. },
  472. {
  473. label: '质检方式:',
  474. value: 'qualityMode',
  475. type: 'select',
  476. placeholder: '',
  477. planList: this.qualityMode
  478. },
  479. {
  480. label: '编码:',
  481. value: 'productCode',
  482. type: 'input',
  483. placeholder: ''
  484. },
  485. {
  486. label: '名称:',
  487. value: 'productName',
  488. type: 'input',
  489. placeholder: ''
  490. },
  491. {
  492. label: '状态:',
  493. value: 'status',
  494. type: 'select',
  495. placeholder: '',
  496. planList: this.statusList
  497. }
  498. ];
  499. }
  500. },
  501. methods: {
  502. // datasource({ page, where, limit }) {
  503. // // return getList({
  504. // // ...where,
  505. // // pageNum: page,
  506. // // size: limit
  507. // // });
  508. // return getList({
  509. // // ...where,
  510. // produceSourceTaskId: this.dataWork.taskId,
  511. // sourceCode: this.dataWork.data.code,
  512. // pageNum: page,
  513. // size: limit
  514. // });
  515. // },
  516. // async getQualityModeList(code) {
  517. // const res = await getByCode(code);
  518. // },
  519. // async getQualityTypeList(code) {
  520. // const res = await getByCode(code);
  521. // },
  522. getCode() {
  523. parameterGetByCode({
  524. code: 'qms_report_approval'
  525. }).then((res) => {
  526. this.isReportApproval = res.value;
  527. });
  528. },
  529. async datasource({ page, limit }) {
  530. try {
  531. await queryTodo({});
  532. } catch (err) {
  533. console.error('调用queryTodo失败:', err);
  534. }
  535. const res = await getList({
  536. produceSourceTaskId: this.dataWork.taskId,
  537. workOrderCodeList: this.listId,
  538. pageNum: page,
  539. size: limit
  540. });
  541. return res;
  542. },
  543. search(where) {
  544. this.$refs.table.reload({
  545. limit: 20,
  546. page: 1
  547. });
  548. },
  549. open(req) {
  550. this.listId = [];
  551. this.visible = true;
  552. this.dataWork = req;
  553. this.dataWork.data.forEach((item) => {
  554. this.listId.push(item.code);
  555. });
  556. },
  557. openEdits(type, row) {
  558. this.$refs.detailsRef.open(row);
  559. },
  560. async openEdit(type, row) {
  561. if (type == 'edit') {
  562. const code = await verificationQualityInspector(row.id);
  563. if (code == '-1') {
  564. console.log('不是报工人');
  565. return;
  566. }
  567. }
  568. const req = {
  569. workOrderId: row.id,
  570. data: row,
  571. type
  572. };
  573. this.$refs.editRef.open(req);
  574. },
  575. downloadFile(file) {
  576. getFile({ objectName: file.storePath }, file.name);
  577. },
  578. remove(row) {
  579. removeItem([row.id])
  580. .then((message) => {
  581. this.$message.success(message);
  582. this.done();
  583. })
  584. .catch((e) => {});
  585. },
  586. done() {
  587. // this.datasource({
  588. // page: 1,
  589. // limit: 20
  590. // });
  591. this.search();
  592. },
  593. openNumber(row) {
  594. this.formData.certificateNumber = row.certificateNumber;
  595. this.rowData = row;
  596. this.addOpen = true;
  597. // this.certificateVisible = true
  598. },
  599. closeModel() {
  600. this.addOpen = false;
  601. },
  602. handleClose() {
  603. this.visible = false;
  604. this.$emit('closeWorkPlan', '1');
  605. },
  606. async closeWork(row) {
  607. await closeWork(row);
  608. this.done();
  609. },
  610. close() {
  611. this.done();
  612. },
  613. async getTnspectionPlanType() {
  614. let res = await getByCode('inspection_plan_type');
  615. if (res?.code == 0) {
  616. let list = res.data.map((item) => {
  617. let key = Object.keys(item)[0];
  618. return { value: key, label: item[key] };
  619. });
  620. this.typeList = list;
  621. }
  622. },
  623. async getQualityMethodCode() {
  624. let res = await getByCode('quality_method_code');
  625. if (res?.code == 0) {
  626. let list = res.data.map((item) => {
  627. let key = Object.keys(item)[0];
  628. return { value: key, label: item[key] };
  629. });
  630. this.qualityMode = list;
  631. }
  632. },
  633. reportApprovalSubmit(res) {
  634. this.processSubmitDialogFlag = true;
  635. this.$nextTick(async () => {
  636. let params = {
  637. businessId: res.id,
  638. businessKey: 'qms_report_approval',
  639. formCreateUserId: res.createUserId,
  640. variables: {
  641. businessCode: res.code,
  642. businessName: res.name,
  643. businessType: '质检报告单'
  644. }
  645. };
  646. if (this.clientEnvironmentId == 5) {
  647. const data = await getCategoryByCode(res.productCode);
  648. if (data && data.categoryLevelCodePath?.includes('W3-209')) {
  649. params.businessKey = 'qms_report_approval1';
  650. } else {
  651. params.businessKey = 'qms_report_approval';
  652. }
  653. }
  654. this.$refs.processSubmitDialogRef.init(params);
  655. });
  656. },
  657. getQualityType(num) {
  658. const res = this.typeList.find((item) => item.value == num);
  659. return res ? res.label : '';
  660. },
  661. getQualityMode(num) {
  662. const res = this.qualityMode.find((item) => item.value == num);
  663. return res ? res.label : '';
  664. },
  665. openTransfer(id) {
  666. this.transferVisible = true;
  667. this.transferId = id;
  668. },
  669. transferConfirm(id) {
  670. this.transferVisible = false;
  671. this.$message.success('转派成功');
  672. this.done();
  673. }
  674. }
  675. };
  676. </script>