瀏覽代碼

修改布点的bug

695593266@qq.com 2 月之前
父節點
當前提交
0cf5e3ba89

+ 10 - 4
src/views/productionPlan/components/planDotLine.vue

@@ -270,7 +270,8 @@
 
 
       normalizeRoutingTaskRow(item, index) {
       normalizeRoutingTaskRow(item, index) {
         const plan = this.currentPlan;
         const plan = this.currentPlan;
-        const taskId = item.taskId ?? item.sourceTaskId ?? item.id;
+        const taskId = item.id;
+
         return {
         return {
           ...item,
           ...item,
           _taskKey: item.id ?? `new-${taskId ?? index}-${index}`,
           _taskKey: item.id ?? `new-${taskId ?? index}-${index}`,
@@ -279,7 +280,7 @@
           taskCode: item.code ?? item.taskCode,
           taskCode: item.code ?? item.taskCode,
           taskSort: item.taskSort ?? index + 1,
           taskSort: item.taskSort ?? index + 1,
           type: item.type ?? undefined,
           type: item.type ?? undefined,
-          sourceTaskId: item.sourceTaskId ?? taskId ?? index,
+          sourceTaskId: item.sourceTaskId,
           planId: plan.id,
           planId: plan.id,
           planCode: plan.code,
           planCode: plan.code,
           routingId: plan.produceRoutingId,
           routingId: plan.produceRoutingId,
@@ -380,9 +381,13 @@
               const t = new Date(val).getTime();
               const t = new Date(val).getTime();
               return Number.isNaN(d) || Number.isNaN(t) || t <= d
               return Number.isNaN(d) || Number.isNaN(t) || t <= d
                 ? true
                 ? true
-                : (this.$message.warning(`${label(item)}${name}不能大于计划交付时间`), false);
+                : (this.$message.warning(
+                    `${label(item)}${name}不能大于计划交付时间`
+                  ),
+                  false);
             };
             };
-            if (!checkTime(item.executionStartTime, '执行开始时间')) return false;
+            if (!checkTime(item.executionStartTime, '执行开始时间'))
+              return false;
             if (!checkTime(item.executionEndTime, '执行结束时间')) return false;
             if (!checkTime(item.executionEndTime, '执行结束时间')) return false;
           }
           }
         }
         }
@@ -462,6 +467,7 @@
         this.taskList = [];
         this.taskList = [];
         this.currentPlan = null;
         this.currentPlan = null;
         this.planRoutingPayload = null;
         this.planRoutingPayload = null;
+        this.$emit('success');
       }
       }
     }
     }
   };
   };

+ 20 - 11
src/views/productionPlan/index.vue

@@ -295,13 +295,7 @@
           <el-link
           <el-link
             type="primary"
             type="primary"
             :underline="false"
             :underline="false"
-            v-if="
-              row.status == 2 &&
-              row.splitBatch != 1 &&
-              row.approvalStatus != 1 &&
-              row.approvalStatus != 2 &&
-              $hasPermission('aps:productionplan:release')
-            "
+            v-if="canApprove(row)"
             @click="handleOrderPublish(1, row)"
             @click="handleOrderPublish(1, row)"
           >
           >
             审批
             审批
@@ -380,7 +374,7 @@
           <el-link
           <el-link
             type="primary"
             type="primary"
             :underline="false"
             :underline="false"
-            v-if="planDotLine"
+            v-if="planDotLineEnabled"
             @click="planDotLine(row)"
             @click="planDotLine(row)"
           >
           >
             计划布点
             计划布点
@@ -439,7 +433,7 @@
       @update="reload"
       @update="reload"
     />
     />
 
 
-    <planDotLine ref="planDotLineRef" />
+    <planDotLine ref="planDotLineRef" @success="reload" />
   </div>
   </div>
 </template>
 </template>
 
 
@@ -552,7 +546,7 @@
         cardSpan: 3,
         cardSpan: 3,
         columnsVersion: 1,
         columnsVersion: 1,
         isReview: false,
         isReview: false,
-        planDotLine: false
+        planDotLineEnabled: false
         // homogeneityDialog: false
         // homogeneityDialog: false
       };
       };
     },
     },
@@ -608,6 +602,21 @@
       this.getplannedReleaseRequire('planned_release_require');
       this.getplannedReleaseRequire('planned_release_require');
     },
     },
     methods: {
     methods: {
+      canApprove(row) {
+        const canRelease =
+          row.status == 2 &&
+          row.splitBatch != 1 &&
+          row.approvalStatus != 1 &&
+          row.approvalStatus != 2 &&
+          this.$hasPermission('aps:productionplan:release');
+
+        // 开启计划布点参数时,必须完成布点才允许审批
+        if (this.planDotLineEnabled) {
+          return canRelease && row.dotLineStatus == 1;
+        }
+
+        return canRelease;
+      },
       setColumns() {
       setColumns() {
         let clientEnvironmentId =
         let clientEnvironmentId =
           this.$store.state.user.info.clientEnvironmentId;
           this.$store.state.user.info.clientEnvironmentId;
@@ -1002,7 +1011,7 @@
           code: 'plan_dot_line'
           code: 'plan_dot_line'
         }).then((res) => {
         }).then((res) => {
           if (res) {
           if (res) {
-            this.planDotLine = res.value == '1' ? true : false;
+            this.planDotLineEnabled = res.value == '1' ? true : false;
           }
           }
         });
         });
       },
       },

+ 20 - 5
src/views/workOrder/mixins/planDotLineRelease.js

@@ -172,7 +172,7 @@ export default {
           res.forEach((item, index) => {
           res.forEach((item, index) => {
             isExist = isExist
             isExist = isExist
               ? isExist
               ? isExist
-              : item.taskId === this.current.firstTaskId;
+              : item.sourceTaskId === this.current.firstTaskId;
             // 如果有首工序id 存储它的下标
             // 如果有首工序id 存储它的下标
             if (isExist) {
             if (isExist) {
               if (!firstTaskindex && firstTaskindex !== 0) {
               if (!firstTaskindex && firstTaskindex !== 0) {
@@ -180,7 +180,7 @@ export default {
               }
               }
             }
             }
             let obj = {
             let obj = {
-              id: item.taskId, //工序 id
+              id: item.sourceTaskId, //工序 id
               name: item.taskName, //工序 名称
               name: item.taskName, //工序 名称
               executionTeamName: item.executionTeamName || '', // 工序执行班组
               executionTeamName: item.executionTeamName || '', // 工序执行班组
               assignType: 1, // 默认的指派数据
               assignType: 1, // 默认的指派数据
@@ -197,7 +197,10 @@ export default {
                 staffDis: false, // 人员按钮
                 staffDis: false, // 人员按钮
                 lineDis: false // 产线按钮
                 lineDis: false // 产线按钮
               },
               },
-              isDisable: teamIdSet.has(item.executionTeamId),
+              isDisable:
+                teamIdSet.has(item.executionTeamId) &&
+                this.$store.state.user.info.userId ==
+                  item.executionTeamLeaderId,
               startDate: '', // 开始日期 (当前工序中最早的计划开始时间)
               startDate: '', // 开始日期 (当前工序中最早的计划开始时间)
               endDate: '', // 结束日期 (当前工序中最晚的计划结束时间)
               endDate: '', // 结束日期 (当前工序中最晚的计划结束时间)
               workCenterId: item.workCenterId,
               workCenterId: item.workCenterId,
@@ -212,7 +215,7 @@ export default {
           // 存在首工序报工
           // 存在首工序报工
           if (isExist) {
           if (isExist) {
             this.processList = list;
             this.processList = list;
-            this.processId = res[0].taskId;
+            this.processId = res[0].sourceTaskId;
             // this.handleClick({ name: res[0].taskId });
             // this.handleClick({ name: res[0].taskId });
             this.initializeQuery();
             this.initializeQuery();
           } else {
           } else {
@@ -248,6 +251,10 @@ export default {
         if (res && res.length > 0) {
         if (res && res.length > 0) {
           res.map((el) => {
           res.map((el) => {
             let index = processMap[el.taskId];
             let index = processMap[el.taskId];
+            if (index === undefined || index === null) {
+              console.warn('initializeQuery skip unknown taskId:', el.taskId);
+              return;
+            }
             if (index === 0 && el.assignees && el.assignees.length > 0) {
             if (index === 0 && el.assignees && el.assignees.length > 0) {
               isFirstData = true; // 操作过
               isFirstData = true; // 操作过
             }
             }
@@ -686,7 +693,7 @@ export default {
         }
         }
       } catch (err) {
       } catch (err) {
         this.toolbarLoading = false;
         this.toolbarLoading = false;
-        // this.$message.error(err.message);
+        this.$message.error(err.message);
       }
       }
     },
     },
     // 下达
     // 下达
@@ -897,6 +904,14 @@ export default {
     // },
     // },
     operationalData(index, res, list) {
     operationalData(index, res, list) {
       const dataRow = this.processList[index];
       const dataRow = this.processList[index];
+      if (!dataRow) {
+        console.warn('operationalData skip invalid process index:', index);
+        return;
+      }
+      if (!Array.isArray(res) || !res[0] || !Array.isArray(res[0].assignees)) {
+        console.warn('operationalData skip invalid assignees payload');
+        return;
+      }
       let arrMap = {};
       let arrMap = {};
       let codeT = null;
       let codeT = null;