695593266@qq.com 2 месяцев назад
Родитель
Сommit
8f9c219ac3

+ 8 - 4
src/views/checklistManagement/checklist.vue

@@ -14,7 +14,11 @@
         @fullscreen-change="fullscreenChange"
       >
         <template v-slot:toolbar>
-          <el-button v-if="!isDetails" type="primary" size="mini" @click="openCheckAdd('add')"
+          <el-button
+            v-if="!isDetails"
+            type="primary"
+            size="mini"
+            @click="openCheckAdd('add')"
             >新建</el-button
           >
         </template>
@@ -32,7 +36,7 @@
             >提交</el-link
           >
           <el-popconfirm
-            v-if="row.approvalStatus != 1"
+            v-if="row.approvalStatus != 1 || row.approvalStatus != 2"
             title="您确定要删除这条数据吗?"
             @confirm="deleteRow(row)"
           >
@@ -308,8 +312,8 @@
           pageNum: page,
           size: limit
         };
-        if(this.isDetails) {
-          return checklistByWorkOrderId(this.workOrderInfo.id)
+        if (this.isDetails) {
+          return checklistByWorkOrderId(this.workOrderInfo.id);
         }
         return checklistrecordPage(body);
       },

+ 2 - 1
src/views/checklistManagement/components/checkDetails.vue

@@ -565,7 +565,8 @@
         this.form = JSON.parse(JSON.stringify(this.formBaseData));
         this.activeComp = 'main';
         this.$nextTick(() => {
-          this.$refs.formRef.clearValidate();
+          // 关闭流程里 visible 可能已变为 false(v-if 卸载整块内容),或当前在 BPM 页签时表单未挂载
+          this.$refs.formRef?.clearValidate();
           this.visible = false;
         });
       },

+ 3 - 0
src/views/produce/components/workPlan/details.vue

@@ -616,6 +616,9 @@
         this.$set(this.form, 'qualifiedNumber', res.qualifiedNumber);
         this.$set(this.form, 'noQualifiedNumber', res.sampleNoQualifiedNumber);
         this.$set(this.form, 'remark', res.remark);
+        this.keyArr.forEach((key) => {
+          this.$set(this.form, key, Number(res[key]) || 0);
+        });
         this.sourceData3 = res.templateList || [];
         this.sourceData1 = res.qualityInventoryList || [];
         this.taskMonadList = res.taskMonadList || [];

+ 17 - 1
src/views/produce/components/workPlan/edit.vue

@@ -463,6 +463,10 @@
           qualityIdList: [],
           sampleMeasureUnit: '',
           conditionType: null,
+          retainedSampleQuantity: 0,
+          retainedSampleUnqualified: 0,
+          lossNumber: 0,
+          lossNumberUnqualified: 0,
           taskMonadInfo: {
             lossNumber: 0,
             lossNumberUnqualified: 0,
@@ -524,7 +528,7 @@
           if (id) {
             this.getDetail();
           } else {
-            this.form = { ...defaultForm() };
+            this.form = { ...this.defaultForm() };
           }
         }
       },
@@ -1138,6 +1142,18 @@
             res.data.executeJobName = res.data.jobList[0].name;
           }
           this.form = res.data;
+          [
+            'retainedSampleQuantity',
+            'retainedSampleUnqualified',
+            'lossNumber',
+            'lossNumberUnqualified'
+          ].forEach((key) => {
+            this.$set(
+              this.form,
+              key,
+              Number(this.form[key]) || 0
+            );
+          });
 
           console.log(this.form, 'this.form');
           this.form.executeUserIdList = this.form.executeUserId

+ 42 - 30
src/views/produceOrder/components/details/index.vue

@@ -47,7 +47,11 @@
           ></el-step>
         </el-steps>
 
-        <el-tabs type="border-card">
+        <el-tabs
+          v-model="detailActiveTab"
+          :key="tabsRenderKey"
+          type="border-card"
+        >
           <el-tab-pane label="领料详情" name="pick">
             <pickDetails
               :isDetails="true"
@@ -119,7 +123,6 @@
   import productionDetails from '@/views//workOrderList/components/productionDetails.vue';
   import pickDetails from '../../details.vue';
   import recordRules from '../recordRules/recordRules.vue';
-  import checkList from '@/views/checklistManagement/checklist.vue';
   import dotLineDetail from './dotLineDetail.vue';
   export default {
     components: {
@@ -129,7 +132,8 @@
       productionDetails,
       pickDetails,
       recordRules,
-      checkList,
+      /** 异步加载,避免 checklist → checkDetails → 本组件 的循环依赖导致 checkList 未注册 */
+      checkList: () => import('@/views/checklistManagement/checklist.vue'),
       dotLineDetail
     },
     data() {
@@ -147,7 +151,10 @@
         routeObj: {
           id: null
         },
-        sourceTaskId: ''
+        sourceTaskId: '',
+        /** 任务数据就绪后递增,强制各 Tab 子组件重挂载以重新拉数 */
+        tabsRenderKey: 0,
+        detailActiveTab: 'pick'
       };
     },
 
@@ -172,37 +179,42 @@
       },
 
       getTaskFn() {
-        getTaskInstanceList(this.workOrderInfo.id).then((res) => {
-          this.routeList = res;
+        getTaskInstanceList(this.workOrderInfo.id)
+          .then((res) => {
+            this.routeList = res;
 
-          console.log(this.routeList, '9999999');
+            console.log(this.routeList, '9999999');
 
-          // 使用findIndex方法查找
-          const index = this.routeList.findIndex(
-            (item) => item.taskId == this.workOrderInfo.taskId
-          );
+            // 使用findIndex方法查找
+            const index = this.routeList.findIndex(
+              (item) => item.taskId == this.workOrderInfo.taskId
+            );
 
-          console.log('index', index);
+            console.log('index', index);
 
-          this.desIndex = index;
-          console.log(this.routeList, '888888');
-          this.newId = this.routeList[this.desIndex]?.taskId || '';
-          this.sourceTaskId = this.routeList[this.desIndex]?.sourceTaskId || '';
+            this.desIndex = index;
+            console.log(this.routeList, '888888');
+            this.newId = this.routeList[this.desIndex]?.taskId || '';
+            this.sourceTaskId =
+              this.routeList[this.desIndex]?.sourceTaskId || '';
 
-          if (this.workOrderInfo.taskId != -2) {
-            // this.curTaskObj = JSON.parse(JSON.stringify(this.routeObj));
-            this.curTaskObj = {
-              taskId: this.workOrderInfo.taskId,
-              id: this.routeObj.id
-            };
-          } else {
-            this.curTaskObj = JSON.parse(JSON.stringify(this.routeList[0]));
-            // this.desIndex = 0;
-          }
-          this.activeIndex = index;
-          console.log('this.curTaskObj', this.curTaskObj);
-          console.log('this.newId', this.newId);
-        });
+            if (this.workOrderInfo.taskId != -2) {
+              // this.curTaskObj = JSON.parse(JSON.stringify(this.routeObj));
+              this.curTaskObj = {
+                taskId: this.workOrderInfo.taskId,
+                id: this.routeObj.id
+              };
+            } else {
+              this.curTaskObj = JSON.parse(JSON.stringify(this.routeList[0]));
+              // this.desIndex = 0;
+            }
+            this.activeIndex = index;
+            console.log('this.curTaskObj', this.curTaskObj);
+            console.log('this.newId', this.newId);
+          })
+          .finally(() => {
+            this.tabsRenderKey += 1;
+          });
       },
 
       deepCopy(obj, hash = new WeakMap()) {