Просмотр исходного кода

merge dev into test: 同步首件两检、footBtn、jobBom 等修复

xieyong 1 месяц назад
Родитель
Сommit
f48c261e7a

+ 1 - 1
src/views/batchRecord/components/tables/qualityInspection.vue

@@ -232,7 +232,7 @@
       },
 
       reportClick(row, type, mode) {
-        this.$refs.selfReportingRef.open(row, type, mode);
+        this.$refs.selfReportingRef.open(row, type, mode, 'dialog');
       }
     }
   };

+ 9 - 0
src/views/entrust/components/goodsDetail.vue

@@ -236,6 +236,13 @@
         ];
       }
     },
+    watch:{
+      visible(newVal, oldVal) {
+        if(!newVal) {
+          this.goodsList = [];
+        }
+      }
+    },
 
     methods: {
       // 根据后端 status 返回对应的展示文案和 el-tag 类型,未匹配时回落为驳回
@@ -276,6 +283,8 @@
           // isReceiptDetail 在 open() 里已经重置,此处只处理 params
         }
 
+        if(this.type === "add") return;
+
         await pleaseEntrustGoodsDetail(params).then(async (res) => {
           this.goodsList = [];
           res.data.forEach((item) => {

+ 2 - 2
src/views/produce/components/footBtn.vue

@@ -397,10 +397,10 @@
                 '请先完成领料、投料后再进行首件两检'
             };
           }
-          // 当前工序已分配给他人时,禁用领料/投料/报工/委外请托
+          // 当前工序已分配给他人时,禁用投料/报工
           if (
             this.isSomeoneDisabled &&
-            ['pick', 'feed', 'job', 'Outsourcing'].includes(i.type)
+            ['feed', 'job'].includes(i.type)
           ) {
             return {
               ...i,

+ 1 - 1
src/views/produce/components/jobBooking/components/jobBom.vue

@@ -281,7 +281,7 @@
             const result = finalList.reduce(
               (acc, item) => {
                 const qty = getQty(item);
-
+                if(isDetails) return acc;
                 if (item.extInfo.isLoss == 1) {
                   // 损耗计入损耗数量
                   acc.lossNum = this.add(acc.lossNum, qty);

Разница между файлами не показана из-за своего большого размера
+ 848 - 421
src/views/produce/components/qualityInspection/components/selfInspectionReporting.vue


+ 50 - 13
src/views/produce/components/workPlan/components/inspectionProjectReport.vue

@@ -62,10 +62,9 @@
       <template v-slot:sampleNoQualifiedNumber="{ row }">
         <el-input
           v-model="row.sampleNoQualifiedNumber"
-          @input="formSampleNoQualifiedNumberChange"
-          placeholder="请输入"
+          placeholder="自动取值(质检项中最大不合格数)"
           type="number"
-          :disabled="type == 'detail'"
+          disabled
         >
           <template slot="append">{{ form.measureUnit }}</template>
         </el-input>
@@ -214,6 +213,7 @@
           placeholder="请选择"
           style="width: 100%"
           :disabled="type == 'detail'"
+          @change="handleQualityResultChange(row, $index)"
         >
           <el-option
             v-for="item in qualityResultsList"
@@ -756,6 +756,30 @@
         return this.form.sampleQuantity;
       }
     },
+    watch: {
+      // 任意质检项的不合格数变更时,自动同步最大不合格数到样品不合格数
+      tableData: {
+        deep: true,
+        handler(list) {
+          if (!Array.isArray(list) || !list.length) {
+            this.$set(this.form, 'sampleNoQualifiedNumber', 0);
+          } else {
+            const maxNoQualified = list.reduce(
+              (max, item) =>
+                Math.max(max, Number(item.noQualifiedQuantity) || 0),
+              0
+            );
+            this.$set(this.form, 'sampleNoQualifiedNumber', maxNoQualified);
+          }
+          const total = Number(this.form.sampleQuantity) || 0;
+          this.$set(
+            this.form,
+            'sampleQualifiedNumber',
+            Math.max(total - (Number(this.form.sampleNoQualifiedNumber) || 0), 0)
+          );
+        }
+      }
+    },
 
     created() {
       this.requestDict('质检计划类型');
@@ -887,16 +911,14 @@
             ]);
           });
         }
-        this.form.sampleQualifiedNumber = this.form.sampleQuantity;
-        this.form.sampleNoQualifiedNumber = 0;
-      },
-      formSampleNoQualifiedNumberChange() {
-        if (+this.form.sampleNoQualifiedNumber < 0) {
-          this.form.sampleNoQualifiedNumber = 0;
-        }
-        if (+this.form.sampleNoQualifiedNumber > this.form.sampleQuantity) {
-          this.form.sampleNoQualifiedNumber = this.form.sampleQuantity;
-        }
+        // 样品数变化后,重新计算合格数/不合格数
+        this.form.sampleNoQualifiedNumber = this.tableData.length
+          ? this.tableData.reduce(
+              (max, item) =>
+                Math.max(max, Number(item.noQualifiedQuantity) || 0),
+              0
+            )
+          : 0;
         this.form.sampleQualifiedNumber =
           this.form.sampleQuantity - this.form.sampleNoQualifiedNumber;
       },
@@ -906,6 +928,21 @@
           this.$set(this.tableData[index], 'qualityResults', 1);
         });
       },
+      // 切换质检结果(合格/不合格)时,若合格数与不合格数其一为 0,则互换两个数值
+      handleQualityResultChange(row, index) {
+        const qualified = Number(row.qualifiedQuantity) || 0;
+        const noQualified = Number(row.noQualifiedQuantity) || 0;
+        // 切换为合格:noQualifiedQuantity -> qualifiedQuantity
+        if (row.qualityResults == 1 && qualified === 0 && noQualified > 0) {
+          this.$set(this.tableData[index], 'qualifiedQuantity', noQualified);
+          this.$set(this.tableData[index], 'noQualifiedQuantity', 0);
+        }
+        // 切换为不合格:qualifiedQuantity -> noQualifiedQuantity
+        if (row.qualityResults == 2 && noQualified === 0 && qualified > 0) {
+          this.$set(this.tableData[index], 'qualifiedQuantity', 0);
+          this.$set(this.tableData[index], 'noQualifiedQuantity', qualified);
+        }
+      },
 
       handleClose() {
         this.visible = false;

+ 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

Некоторые файлы не были показаны из-за большого количества измененных файлов