From ecb306c5612f474a5911af20a567f3f4d4db33d1 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期三, 24 九月 2025 15:02:23 +0800
Subject: [PATCH] 原材料订单拆分功能v1

---
 src/views/business/inspectionTask/inspection.vue |   92 ++++++++++++++++++++++++++++-----------------
 1 files changed, 57 insertions(+), 35 deletions(-)

diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue
index d750b75..b425ec8 100644
--- a/src/views/business/inspectionTask/inspection.vue
+++ b/src/views/business/inspectionTask/inspection.vue
@@ -749,7 +749,6 @@
         size: 10,
         current: 0,
       },
-      tableLoading: false,
       // 鏂囦欢鍒楄〃鐩稿叧--缁撴潫
       // 浠诲姟鍒囨崲鍒楄〃--寮�濮�
       tableData0: [],
@@ -784,6 +783,7 @@
       },
       tableLoading0: false,
       // 浠诲姟鍒囨崲鍒楄〃--缁撴潫
+      isSplit: 0, // 鏄惁鏄媶鍗曡繃鏉ョ殑
     };
   },
   // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭�
@@ -794,7 +794,7 @@
     },
   },
   created() {
-    let { sonLaboratory, orderId, state, inspectorList, typeSource } =
+    let { sonLaboratory, orderId, state, inspectorList, typeSource,isSplit } =
       this.$route.query;
     this.sonLaboratory = sonLaboratory;
     this.orderId = orderId;
@@ -802,6 +802,7 @@
     this.state = state;
     this.inspectorList = inspectorList;
     this.typeSource = typeSource;
+    this.isSplit = isSplit;
   },
   mounted() {
     this.getTypeDicts(); // 鑾峰彇绱ф�ョ▼搴︿笅鎷夋閫夐」
@@ -2620,6 +2621,26 @@
     openAddVerifyDia() {
       this.addVerifyDia = true;
     },
+    confirmSubmit(registerInsResults){
+      submitPlan({
+        orderId: this.orderId,
+        laboratory: this.sonLaboratory,
+        verifyUser: this.verifyUser,
+        entrustCode: this.insOrder.entrustCode,
+        registerInsResults: registerInsResults
+      }).then((res) => {
+        if (res.code === 200) {
+          this.$message.success("鎿嶄綔鎴愬姛");
+          this.goback();
+          this.submitLoading = false;
+          this.addVerifyDia = false;
+        }
+      })
+        .catch((error) => {
+          console.error(error);
+          this.submitLoading = false;
+        });
+    },
     submit() {
       if (this.verifyUser === null || this.verifyUser === "") {
         this.$message.error("璇锋寚瀹氬鏍镐汉鍛�");
@@ -2638,26 +2659,26 @@
         orderId: this.orderId,
         laboratory: this.sonLaboratory,
       }).then((res) => {
+        console.log(res)
         if (res.code === 200) {
-          if (!res.data || res.data.length == 0) {
+          if (!res.data || res.data.errorMsg.length == 0) {
             this.submitLoading = true;
-            submitPlan({
-              orderId: this.orderId,
-              laboratory: this.sonLaboratory,
-              verifyUser: this.verifyUser,
-              entrustCode: this.insOrder.entrustCode,
-            }).then((res) => {
-              if (res.code === 200) {
-                this.$message.success("鎿嶄綔鎴愬姛");
-                this.goback();
-                this.submitLoading = false;
-                this.addVerifyDia = false;
-              }
-            })
-              .catch((error) => {
-                console.error(error);
-                this.submitLoading = false;
+            //妫�楠岀被鍨嬩负鍘熸潗鏂�
+            if(this.typeSource==1 && res.data.unInsOrderCount==0 && this.isSplit==1){
+              const htmlStr = "鏄惁鐧昏IFS閲囪喘妫�楠岀粨鏋滃苟绉诲簱锛熻鎿嶄綔浼氱櫥璁�<span style='color:#ff4949'>鍚屼竴闆朵欢鍚屼竴璁㈠崟鐨勬墍鏈夋媶鍒嗘壒娆�</span>锛岃璋ㄦ厧閫夋嫨銆�"
+              this.$confirm(htmlStr, '鎻愮ず', {
+                confirmButtonText: '鏄�',
+                cancelButtonText: '鍚�',
+                type: 'warning',
+                dangerouslyUseHTMLString: true
+              }).then(() => {
+                this.confirmSubmit(true)
+              }).catch(() => {
+                this.confirmSubmit(false)
               });
+            }else{
+              this.confirmSubmit(false)
+            }
           } else {
             let newData = [];
             const h = this.$createElement;
@@ -2693,22 +2714,23 @@
             })
               .then(() => {
                 this.submitLoading = true;
-                submitPlan({
-                  orderId: this.orderId,
-                  laboratory: this.sonLaboratory,
-                  verifyUser: this.verifyUser,
-                }).then((res) => {
-                  if (res.code === 200) {
-                    this.$message.success("鎿嶄綔鎴愬姛");
-                    this.addVerifyDia = false;
-                    this.goback();
-                  }
-                  this.submitLoading = false;
-                })
-                  .catch((error) => {
-                    console.error(error);
-                    this.submitLoading = false;
-                  });
+                this.confirmSubmit(false)
+                // submitPlan({
+                //   orderId: this.orderId,
+                //   laboratory: this.sonLaboratory,
+                //   verifyUser: this.verifyUser,
+                // }).then((res) => {
+                //   if (res.code === 200) {
+                //     this.$message.success("鎿嶄綔鎴愬姛");
+                //     this.addVerifyDia = false;
+                //     this.goback();
+                //   }
+                //   this.submitLoading = false;
+                // })
+                //   .catch((error) => {
+                //     console.error(error);
+                //     this.submitLoading = false;
+                //   });
               })
               .catch(() => { });
           }

--
Gitblit v1.9.3