2 Commits e2f0e73987 ... e99642885e

Author SHA1 Message Date
  tanzx e99642885e Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-mes into dev 1 month ago
  tanzx 1b755e47a7 fix: 解决生产订单报工,选择其他步骤无法查看首件两检的问题。 1 month ago
1 changed files with 23 additions and 1 deletions
  1. 23 1
      src/views/produceOrder/workReport.vue

+ 23 - 1
src/views/produceOrder/workReport.vue

@@ -716,6 +716,20 @@
           null
         );
       },
+      // 当前所选工序对应的“工序实例id”,随顶部步骤条切换而变化
+      getCurrentTaskInstanceId() {
+        const routeItem = this.getCurrentRouteItem();
+        const candidates = [
+          routeItem && routeItem.taskId,
+          this.newId,
+          this.workOrderInfo && this.workOrderInfo.taskId
+        ];
+        // 过滤空值与完结态(-2),避免把无效工序实例id传给首件两检接口
+        return candidates.find(
+          (id) =>
+            id !== undefined && id !== null && id !== '' && String(id) !== '-2'
+        );
+      },
       checkCurrentTaskTeamPermission(actionName) {
         const deny = (message) => {
           this.operationType = null;
@@ -1454,8 +1468,16 @@
             this.workOrderInfo.id
           );
 
+          // 首件两检按“顶部步骤条当前所选工序”取数:
+          // workOrderInfo.taskId 是进入抽屉时的定位工序,切换工序后不会变,
+          // 这里用当前工序的实例id覆盖,保证 produceTaskInstanceId 跟随步骤条
+          const curWorkOrder = {
+            ...this.workOrderInfo,
+            taskId: this.getCurrentTaskInstanceId()
+          };
+
           this.$refs.qualityInspectionRef.open(
-            this.workOrderInfo,
+            curWorkOrder,
             this.taskObj,
             '',
             req