index.vue 16 KB

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