index.vue 18 KB

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