2 次代碼提交 e2f0e73987 ... e99642885e

作者 SHA1 備註 提交日期
  tanzx e99642885e Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-mes into dev 1 月之前
  tanzx 1b755e47a7 fix: 解决生产订单报工,选择其他步骤无法查看首件两检的问题。 1 月之前
共有 1 個文件被更改,包括 23 次插入 和 1 次删除
  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