index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  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 type="primary" :underline="false" @click="openNumber(row)"
  93. >合格证</el-link
  94. >
  95. <jimureportBrowse
  96. style="display: inline-block; margin-left: 5px"
  97. v-if="row.status == 1"
  98. text="质检报告"
  99. :businessId="row.id"
  100. businessCode="qmsqualityinspectionprint"
  101. ></jimureportBrowse>
  102. <!-- <el-link type="primary" :underline="false">
  103. 质检报告
  104. </el-link>-->
  105. <!-- <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(row)" v-if="row.status == 0">
  106. <template v-slot:reference>
  107. <el-link type="danger" :underline="false" icon="el-icon-delete">
  108. 删除
  109. </el-link>
  110. </template>
  111. </el-popconfirm>-->
  112. </template>
  113. </ele-pro-table>
  114. <!-- -->
  115. <!-- <el-dialog title="修改" :visible.sync="certificateVisible" width="25%" :before-close="handleClose">
  116. <el-form :inline="true" :model="formData" class="demo-form-inline">
  117. <el-form-item label="合格证号">
  118. <el-input v-model="formData.certificateNumber" placeholder="请输入"></el-input>
  119. </el-form-item>
  120. </el-form>
  121. <span slot="footer" class="dialog-footer">
  122. <el-button @click="handleClose">取 消</el-button>
  123. <el-button type="primary" @click="handleSubmit">确 定</el-button>
  124. </span>
  125. </el-dialog>-->
  126. <!-- -->
  127. </el-card>
  128. <Certificate
  129. @search="search"
  130. v-if="addOpen"
  131. :rowData="rowData"
  132. :addOpen="addOpen"
  133. @closeModel="closeModel"
  134. />
  135. <edit ref="editRef" @close="close" @done="done" />
  136. <detailsOrder ref="detailsRef" />
  137. </div>
  138. </ele-modal>
  139. </template>
  140. <script>
  141. import Certificate from './components/Certificate.vue';
  142. import search from './components/search.vue';
  143. import edit from './edit.vue';
  144. import detailsOrder from './details.vue';
  145. import jimureportBrowse from '@/components/jimureport/browseModal.vue';
  146. import {
  147. getList,
  148. removeItem,
  149. updateCertificateNumber,
  150. verificationQualityInspector
  151. } from '@/api/inspectionWork';
  152. import dictMixins from '@/mixins/dictMixins';
  153. import { getFile } from '@/api/system/file';
  154. import { getByCode } from '@/api/system/dictionary-data';
  155. export default {
  156. mixins: [dictMixins],
  157. components: {
  158. search,
  159. jimureportBrowse,
  160. Certificate,
  161. edit,
  162. detailsOrder
  163. },
  164. data() {
  165. return {
  166. columns: [
  167. {
  168. type: 'index',
  169. columnKey: 'index',
  170. align: 'center',
  171. label: '序号',
  172. width: 55,
  173. showOverflowTooltip: true,
  174. fixed: 'left'
  175. },
  176. {
  177. prop: 'code',
  178. label: '质检工单编码',
  179. slot: 'code',
  180. align: 'center',
  181. width: 180,
  182. showOverflowTooltip: true,
  183. fixed: 'left'
  184. },
  185. {
  186. prop: 'name',
  187. slot: 'name',
  188. width: 120,
  189. label: '质检工单名称',
  190. align: 'center',
  191. showOverflowTooltip: true
  192. },
  193. {
  194. label: '来源单号',
  195. prop: 'sourceCode',
  196. slot: 'sourceCode',
  197. align: 'center',
  198. width: 160,
  199. showOverflowTooltip: true
  200. },
  201. {
  202. label: '类型',
  203. prop: 'qualityType',
  204. slot: 'qualityType',
  205. align: 'center',
  206. width: 120,
  207. showOverflowTooltip: true
  208. },
  209. {
  210. label: '质检方式',
  211. prop: 'qualityMode',
  212. slot: 'qualityMode',
  213. align: 'center',
  214. width: 120,
  215. showOverflowTooltip: true
  216. },
  217. {
  218. prop: 'qualityName',
  219. label: '质检人',
  220. align: 'center',
  221. width: 120,
  222. showOverflowTooltip: true,
  223. formatter: (row) => {
  224. if (row.qualityName) {
  225. return row.qualityName;
  226. }
  227. return row.qualityNames || '';
  228. }
  229. },
  230. {
  231. prop: 'qualityTime',
  232. label: '质检时间',
  233. align: 'center',
  234. width: 120,
  235. showOverflowTooltip: true
  236. },
  237. {
  238. prop: 'productCode',
  239. width: 120,
  240. label: '编码',
  241. align: 'center',
  242. showOverflowTooltip: true
  243. },
  244. {
  245. prop: 'productName',
  246. width: 120,
  247. label: '名称',
  248. align: 'center',
  249. showOverflowTooltip: true
  250. },
  251. {
  252. prop: 'batchNo',
  253. label: '批次号',
  254. align: 'center',
  255. width: 120,
  256. showOverflowTooltip: true
  257. },
  258. {
  259. prop: 'specification',
  260. label: '规格',
  261. align: 'center',
  262. showOverflowTooltip: true
  263. },
  264. {
  265. prop: 'brandNo',
  266. label: '牌号',
  267. align: 'center',
  268. showOverflowTooltip: true
  269. },
  270. {
  271. prop: 'produceTaskName',
  272. label: '工序',
  273. align: 'center',
  274. width: 120,
  275. showOverflowTooltip: true
  276. },
  277. {
  278. prop: 'total',
  279. label: '总数量',
  280. align: 'center',
  281. showOverflowTooltip: true
  282. },
  283. {
  284. prop: 'qualifiedNumber',
  285. label: '合格数',
  286. align: 'center',
  287. showOverflowTooltip: true
  288. },
  289. {
  290. prop: 'qualificationRate',
  291. label: '合格率',
  292. align: 'center',
  293. showOverflowTooltip: true
  294. },
  295. {
  296. prop: 'noQualifiedNumber',
  297. label: '不合格数',
  298. align: 'center',
  299. showOverflowTooltip: true
  300. },
  301. {
  302. prop: 'noQualificationRate',
  303. label: '不合格率',
  304. align: 'center',
  305. showOverflowTooltip: true
  306. },
  307. {
  308. prop: 'hours',
  309. label: '工时',
  310. align: 'center',
  311. showOverflowTooltip: true
  312. },
  313. {
  314. label: '附件',
  315. prop: 'accessory',
  316. align: 'center',
  317. slot: 'accessory',
  318. showOverflowTooltip: true
  319. },
  320. {
  321. label: '创建时间',
  322. prop: 'createTime',
  323. align: 'center',
  324. width: 160
  325. },
  326. {
  327. prop: 'status',
  328. label: '状态',
  329. align: 'center',
  330. width: 80,
  331. formatter: (row, column, cellValue) => {
  332. return cellValue == 0 ? '未报工' : cellValue == 1 ? '已报工' : '';
  333. },
  334. fixed: 'right'
  335. },
  336. {
  337. columnKey: 'action',
  338. label: '操作',
  339. align: 'center',
  340. width: 200,
  341. resizable: false,
  342. slot: 'action',
  343. fixed: 'right'
  344. }
  345. ],
  346. formData: {
  347. certificateNumber: ''
  348. },
  349. // certificateVisible: false,
  350. rowData: {},
  351. typeList: [], //类型列表
  352. qualityMode: [], //取样类型
  353. statusList: [
  354. {
  355. value: 0,
  356. label: '未报工'
  357. },
  358. {
  359. value: 1,
  360. label: '已报工'
  361. }
  362. ],
  363. addOpen: false,
  364. visible: false,
  365. dataWork: {},
  366. sourceList: [],
  367. listId: []
  368. };
  369. },
  370. created() {
  371. // this.requestDict('质检计划类型');
  372. this.requestDict('不良品处理类型');
  373. // this.requestDict('取样类型');
  374. this.getTnspectionPlanType();
  375. this.getQualityMethodCode();
  376. // this.getQualityModeList('quality_method_code');
  377. // this.getQualityTypeList('inspection_plan_type');
  378. },
  379. computed: {
  380. seekList() {
  381. return [
  382. {
  383. label: '工单编码:',
  384. value: 'code',
  385. type: 'input',
  386. placeholder: ''
  387. },
  388. {
  389. label: '工单名称:',
  390. value: 'name',
  391. type: 'input',
  392. placeholder: ''
  393. },
  394. {
  395. label: '来源单号:',
  396. value: 'sourceCode',
  397. type: 'input',
  398. placeholder: ''
  399. },
  400. {
  401. label: '类型:',
  402. value: 'qualityType',
  403. type: 'select',
  404. placeholder: '',
  405. planList: this.typeList
  406. },
  407. {
  408. label: '质检方式:',
  409. value: 'qualityMode',
  410. type: 'select',
  411. placeholder: '',
  412. planList: this.qualityMode
  413. },
  414. {
  415. label: '编码:',
  416. value: 'productCode',
  417. type: 'input',
  418. placeholder: ''
  419. },
  420. {
  421. label: '名称:',
  422. value: 'productName',
  423. type: 'input',
  424. placeholder: ''
  425. },
  426. {
  427. label: '状态:',
  428. value: 'status',
  429. type: 'select',
  430. placeholder: '',
  431. planList: this.statusList
  432. }
  433. ];
  434. }
  435. },
  436. methods: {
  437. // datasource({ page, where, limit }) {
  438. // // return getList({
  439. // // ...where,
  440. // // pageNum: page,
  441. // // size: limit
  442. // // });
  443. // return getList({
  444. // // ...where,
  445. // produceSourceTaskId: this.dataWork.taskId,
  446. // sourceCode: this.dataWork.data.code,
  447. // pageNum: page,
  448. // size: limit
  449. // });
  450. // },
  451. // async getQualityModeList(code) {
  452. // const res = await getByCode(code);
  453. // },
  454. // async getQualityTypeList(code) {
  455. // const res = await getByCode(code);
  456. // },
  457. async datasource({ page, limit }) {
  458. const res = await getList({
  459. produceSourceTaskId: this.dataWork.taskId,
  460. workOrderCodeList: this.listId,
  461. pageNum: page,
  462. size: limit
  463. });
  464. return res;
  465. },
  466. search(where) {
  467. this.$refs.table.reload({
  468. limit: 20,
  469. page: 1
  470. });
  471. },
  472. open(req) {
  473. this.listId = [];
  474. this.visible = true;
  475. this.dataWork = req;
  476. this.dataWork.data.forEach((item) => {
  477. this.listId.push(item.code);
  478. });
  479. },
  480. openEdits(type, row) {
  481. this.$refs.detailsRef.open(row);
  482. },
  483. async openEdit(type, row) {
  484. if (type == 'edit') {
  485. const code = await verificationQualityInspector(row.id);
  486. if (code == '-1') {
  487. console.log('不是报工人');
  488. return;
  489. }
  490. }
  491. const req = {
  492. workOrderId: row.id,
  493. data: row,
  494. type
  495. };
  496. this.$refs.editRef.open(req);
  497. },
  498. downloadFile(file) {
  499. getFile({ objectName: file.storePath }, file.name);
  500. },
  501. remove(row) {
  502. removeItem([row.id])
  503. .then((message) => {
  504. this.$message.success(message);
  505. this.done();
  506. })
  507. .catch((e) => {});
  508. },
  509. done() {
  510. // this.datasource({
  511. // page: 1,
  512. // limit: 20
  513. // });
  514. this.search();
  515. },
  516. openNumber(row) {
  517. this.formData.certificateNumber = row.certificateNumber;
  518. this.rowData = row;
  519. this.addOpen = true;
  520. // this.certificateVisible = true
  521. },
  522. closeModel() {
  523. this.addOpen = false;
  524. },
  525. handleClose() {
  526. this.visible = false;
  527. this.$emit('closeWorkPlan', '1');
  528. },
  529. close() {
  530. console.log('关闭报工界面');
  531. this.done();
  532. },
  533. async getTnspectionPlanType() {
  534. let res = await getByCode('inspection_plan_type');
  535. if (res?.code == 0) {
  536. let list = res.data.map((item) => {
  537. let key = Object.keys(item)[0];
  538. return { value: key, label: item[key] };
  539. });
  540. this.typeList = list;
  541. }
  542. },
  543. async getQualityMethodCode() {
  544. let res = await getByCode('quality_method_code');
  545. if (res?.code == 0) {
  546. let list = res.data.map((item) => {
  547. let key = Object.keys(item)[0];
  548. return { value: key, label: item[key] };
  549. });
  550. this.qualityMode = list;
  551. }
  552. },
  553. getQualityType(num) {
  554. const res = this.typeList.find((item) => item.value == num);
  555. return res ? res.label : '';
  556. },
  557. getQualityMode(num) {
  558. const res = this.qualityMode.find((item) => item.value == num);
  559. return res ? res.label : '';
  560. }
  561. }
  562. };
  563. </script>