index.vue 13 KB

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