Forráskód Böngészése

fix: 解决生产订单报工,选择其他步骤无法查看首件两检的问题。

tanzx 1 hónapja
szülő
commit
1b755e47a7
1 módosított fájl, 23 hozzáadás és 1 törlés
  1. 23 1
      src/views/produceOrder/workReport.vue

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

@@ -714,6 +714,20 @@
           null
           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) {
       checkCurrentTaskTeamPermission(actionName) {
         const deny = (message) => {
         const deny = (message) => {
           this.operationType = null;
           this.operationType = null;
@@ -1452,8 +1466,16 @@
             this.workOrderInfo.id
             this.workOrderInfo.id
           );
           );
 
 
+          // 首件两检按“顶部步骤条当前所选工序”取数:
+          // workOrderInfo.taskId 是进入抽屉时的定位工序,切换工序后不会变,
+          // 这里用当前工序的实例id覆盖,保证 produceTaskInstanceId 跟随步骤条
+          const curWorkOrder = {
+            ...this.workOrderInfo,
+            taskId: this.getCurrentTaskInstanceId()
+          };
+
           this.$refs.qualityInspectionRef.open(
           this.$refs.qualityInspectionRef.open(
-            this.workOrderInfo,
+            curWorkOrder,
             this.taskObj,
             this.taskObj,
             '',
             '',
             req
             req