Selaa lähdekoodia

修改多个工单质检操作的时候第二条数据报工会有错误

695593266@qq.com 4 kuukautta sitten
vanhempi
commit
aa0f1d4e67

+ 18 - 0
src/api/inspectionWork/index.js

@@ -185,3 +185,21 @@ export async function getQmsReportTemplatePageList(params) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+export async function getBadTypeList(data) {
+  let par = new URLSearchParams(data);
+  const res = await request.get(`/qms/badtype/page?` + par, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+export async function getBadNameList(data) {
+  let par = new URLSearchParams(data);
+  const res = await request.get(`/qms/badname/page?` + par, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 5 - 2
src/views/produce/components/feeding/index.vue

@@ -571,8 +571,11 @@
         }).then((res) => {
           if (res.value == '1') {
             const dateTime = this.getNowTime();
-            this.List.forEach((item) => {
-              item.executorTime = dateTime;
+
+            this.$nextTick(() => {
+              this.List.forEach((item) => {
+                this.$set(item, 'executorTime', dateTime);
+              });
             });
           }
         });

+ 24 - 7
src/views/produce/components/jobBooking/index.vue

@@ -812,16 +812,33 @@
           this.isReportTime = res.value == '1' ? true : false;
         });
 
-        await parameterGetByCode({
+        const res = await parameterGetByCode({
           code: 'mes_order_feed_by_default_date'
-        }).then((res) => {
-          if (res.value == '1') {
-            const dateTime = this.getNowTime();
+        });
+
+        if (res.value == '1') {
+          const dateTime = this.getNowTime();
+
+          this.$nextTick(() => {
             this.List.forEach((item) => {
-              item.workReportInfo.executorTime = dateTime;
+              if (!item.workReportInfo) {
+                this.$set(item, 'workReportInfo', {});
+              }
+              this.$set(item.workReportInfo, 'executorTime', dateTime);
             });
-          }
-        });
+          });
+        }
+
+        // await parameterGetByCode({
+        //   code: 'mes_order_feed_by_default_date'
+        // }).then((res) => {
+        //   if (res.value == '1') {
+        //     const dateTime = this.getNowTime();
+        //     this.List.forEach((item) => {
+        //       item.workReportInfo.executorTime = dateTime;
+        //     });
+        //   }
+        // });
 
         await parameterGetByCode({
           code: 'choose_engrave'

+ 49 - 1
src/views/produce/components/workPlan/components/newQualityContentTabs.vue

@@ -623,7 +623,9 @@
     exeReportWork,
     queryQualitySamplContent,
     queryQualityTempleContent,
-    queryQualityInventory
+    queryQualityInventory,
+    getBadNameList,
+    getBadTypeList
   } from '@/api/inspectionWork';
   import { getQualityTemplateByIds } from '@/api/produce/workPlan.js';
   import { getCodeList } from '@/api/login';
@@ -675,6 +677,11 @@
     },
     data() {
       return {
+        // 不良品类型列表
+        fileTableList: [],
+        badTypeList: [],
+        // 不良名称列表
+        badNameList: [],
         disposeTypeList: {
           0: '未处置',
           1: '返工',
@@ -1313,6 +1320,8 @@
       this.activeNameKK = this.activeName;
       this.reload({ qualityWorkerId: this.ids });
       let direction = this.$getDirection();
+      this.getBadTypeList();
+      this.getBadNameList();
 
       direction.on('keyup', function (e, val) {
         if (e.keyCode == 39) {
@@ -1357,6 +1366,45 @@
         });
       },
 
+      // 不良类型改变
+      badTypeChange(row) {
+        row.badTypeName = null;
+        // 赋值badTypeName
+        const badType = this.badTypeList.find(
+          (item) => item.id === row.badTypeId
+        );
+        if (badType) {
+          row.badTypeName = badType.name;
+        }
+        this.getBadNameList(row.badTypeId);
+      },
+      // 不良名称改变
+      badNameChange(row) {
+        // 赋值badNameName
+        const badItem = this.badNameList.find(
+          (item) => item.id === row.badNameId
+        );
+        if (badItem) {
+          row.badNameName = badItem.name;
+        }
+      },
+      // 查询不良类型
+      async getBadTypeList() {
+        const res = await getBadTypeList({
+          pageNum: 1,
+          size: 999
+        });
+        this.badTypeList = res.list;
+      },
+      // 查询不良名称
+      async getBadNameList() {
+        const res = await getBadNameList({
+          pageNum: 1,
+          size: 999
+        });
+        this.badNameList = res.list;
+      },
+
       getRowKey(row) {
         // 优先使用后端 id
         if (row.id && row.id !== '') return row.id;

+ 22 - 8
src/views/produce/components/workPlan/edit.vue

@@ -547,14 +547,15 @@
         },
         deep: true,
         immediate: true
-      },
-      'form.qualityResults': {
-        handler(newVal, oldVal) {
-          if (!newVal && oldVal) {
-            this.form.qualityResults = oldVal;
-          }
-        }
       }
+      // 'form.qualityResults': {
+      //   handler(newVal, oldVal) {
+      //     console.log(newVal, oldVal, '质检结果数据');
+      //     if (!newVal && oldVal) {
+      //       this.form.qualityResults = oldVal;
+      //     }
+      //   }
+      // }
     },
 
     created() {
@@ -1137,6 +1138,7 @@
             // this.execute = res.data.jobList[0].userVOList;
           }
           this.form = res.data;
+          console.log(this.form.qualityResults, '返回的结果');
           this.form.executeUserIdList = this.form.executeUserId
             ? this.form.executeUserId.split(',')
             : [];
@@ -1552,6 +1554,7 @@
             .then((msg) => {
               this.loading = false;
               this.$message.success(msg);
+              this.restForm();
               this.visible = false;
               this.$emit('done');
             })
@@ -1596,9 +1599,19 @@
           });
       },
       restForm() {
+        // this.form = { ...this.defaultForm() };
+        // this.$nextTick(() => {
+        //   this.$refs.baseInfoRefs.$refs.form1.clearValidate();
+        // });
         this.form = { ...this.defaultForm() };
+
         this.$nextTick(() => {
-          this.$refs.baseInfoRefs.$refs.form1.clearValidate();
+          const baseInfo = this.$refs.baseInfoRefs;
+          const form1 = baseInfo?.$refs?.form1;
+
+          if (form1) {
+            form1.clearValidate();
+          }
         });
       },
       cancel() {
@@ -1755,6 +1768,7 @@
           exeReportWork(params)
             .then((msg) => {
               this.loading = false;
+              this.restForm();
               this.$message.success(msg);
               this.visible = false;
               this.$emit('done');

+ 12 - 0
src/views/produceOrder/index.vue

@@ -999,6 +999,10 @@
             this.$set(this.taskNameMap, row.id, []);
           }
         }
+
+        this.$nextTick(() => {
+          this.$refs.table?.doLayout?.();
+        });
       },
 
       getTaskTagTypeByStatus(status) {
@@ -1048,6 +1052,14 @@
         let res = await URL({ ...params, statusList });
 
         this.loadTaskNames(res.list);
+        // let res = await URL({ ...params, statusList });
+
+        // await Promise.all(
+        //   res.list.map(async (row) => {
+        //     const tasks = await getTaskInstanceList(row.id);
+        //     row._taskList = tasks;
+        //   })
+        // );
 
         return res;
       },