index.vue 13 KB

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