index.vue 13 KB

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