From c19ec73d40519d87414b3e8a77972fefc9ef8d67 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 05 十一月 2026 10:17:57 +0800
Subject: [PATCH] feat(outsourcingOrder): 新增外协订单独立路由并修复相关页面逻辑

---
 src/views/business/outsourcingOrder/index.vue               |    6 +-
 src/views/business/rawMaterialInspection/index.vue          |    2 
 src/views/business/inspectionTask/inspection.vue            |   29 +++++++++-----
 src/router/index.js                                         |   32 ++++++++++++++++
 src/views/business/materialOrder/customsInspectionOrder.vue |    2 
 5 files changed, 56 insertions(+), 15 deletions(-)

diff --git a/src/router/index.js b/src/router/index.js
index 28b3e63..e83fba1 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -226,6 +226,38 @@
     ],
   },
   {
+    path: "/outsourcingOrder",
+    component: Layout,
+    hidden: true,
+    permissions: ["business:order"],
+    children: [
+      {
+        path: "rawOrder",
+        component: () => import("@/views/business/materialOrder/customsInspectionOrder"),
+        name: "OutsourceRawOrder",
+        meta: { title: "杩涜澶栧崗璁㈠崟涓嬪崟" },
+      },
+      {
+        path: "productOrder",
+        component: () => import("@/views/business/materialOrder/customsInspectionOrder"),
+        name: "OutsourceProductOrder",
+        meta: { title: "杩涜澶栧崗鎴愬搧涓嬪崟" },
+      },
+      {
+        path: "orderView",
+        component: () => import("@/views/business/materialOrder/customsInspectionView"),
+        name: "OutsourceOrderView",
+        meta: { title: "鏌ョ湅澶栧崗璁㈠崟璇︽儏" },
+      },
+      {
+        path: "copperView",
+        component: () => import("@/views/business/materialOrder/copperView"),
+        name: "OutsourceCopperView",
+        meta: { title: "鏌ョ湅澶栧崗閾滄潗鏂欎笅鍗曡鎯�" },
+      },
+    ],
+  },
+  {
     // 妫�楠屼换鍔�
     path: "/inspectionTask",
     component: Layout,
diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue
index 6db42c7..3501191 100644
--- a/src/views/business/inspectionTask/inspection.vue
+++ b/src/views/business/inspectionTask/inspection.vue
@@ -385,7 +385,7 @@
             placeholder="璇烽�夋嫨"
             size="small"
             @change="
-              (m) => handleChangeCableTag(currentSample.id, 4, 'cableTag', m)
+              (m) => handleChangeCableTag(currentSample.id, 4, 'rawMaterialTag', m)
             "
             @focus="getRawMaterialTag(currentSample.id)"
           >
@@ -2472,24 +2472,25 @@
     },
     // 鏍规嵁绫诲瀷銆佷换鍔d銆佸疄楠屽鏉ヨ幏鍙栨牱鍝佺殑妫�楠岄」淇℃伅
     async getCurrentProduct(id, type, cableTag) {
-      if (cableTag === undefined) {
-        cableTag = "";
-      }
+      const selectedCableTag = cableTag || this.temCableTag;
       this.tableLoading = true;
-      type = this.typeSource == "1" ? 5 : type;
+      // 澶栬喘鍘嗗彶鍗曞彲鑳芥浘璇涓哄師鏉愭枡锛岄�夋嫨绾胯姱鏃朵粛搴旀寜棰滆壊鏌ヨ銆�
+      const usesCableItems = selectedCableTag && (
+        this.effectiveOrderType === "02wg" ||
+        ["03incoming", "04subcontract"].includes(this.insOrder.ifsOrderType)
+      );
+      type = this.typeSource == "1" && !usesCableItems ? 5 : type;
       this.type = type;
       let res = await getInsProduct({
         id: id,
         type: type,
         laboratory: this.sonLaboratory,
-        cableTag: cableTag ? cableTag : this.temCableTag,
+        cableTag: selectedCableTag,
         rawMaterialTag: this.rawMaterialTag,
         repetitionTag: this.repetitionTag,
       });
       this.tableLoading = false;
-      if (res.data.length > 0) {
-        return res.data;
-      }
+      return res.data || [];
     },
     // 鍒囨崲鏍峰搧
     async handleChangeSample(row, column, event) {
@@ -2498,6 +2499,9 @@
       this.sampleVisible = false;
       // 璧嬪�兼牱鍝�
       this.currentSample = this.HaveJson(row);
+      this.currentTab = null;
+      this.temCableTag = "";
+      this.repetitionTag = "";
       let list = await this.getCurrentProduct(row.id, 0);
       // 璧嬪�兼牱鍝佹楠岄」
       this.currentSample.insProduct = this.HaveJson(list);
@@ -2517,7 +2521,6 @@
       // 澶勭悊椤甸潰鍒楄〃鏁版嵁
       this.getTableLists();
       this.currentKey = row.index;
-      this.currentTab = null;
       // 鍚戝绾跨▼鍘讳繚瀛橀〉闈㈠垪琛ㄦ暟鎹�,鍚庣浼犲弬,褰撳墠妯℃澘淇℃伅
       this.worker.postMessage(
         JSON.stringify({
@@ -2535,6 +2538,12 @@
       if (num === "cableTag") {
         cableTag = m2;
         this.temCableTag = cableTag;
+        this.repetitionTag = "";
+        this.getRepetitionTag();
+      } else if (num === "rawMaterialTag") {
+        this.currentTab = null;
+        this.temCableTag = "";
+        this.repetitionTag = "";
         this.getRepetitionTag();
       }
       if (num === "repetitionTag") {
diff --git a/src/views/business/materialOrder/customsInspectionOrder.vue b/src/views/business/materialOrder/customsInspectionOrder.vue
index 17292ed..0bca276 100644
--- a/src/views/business/materialOrder/customsInspectionOrder.vue
+++ b/src/views/business/materialOrder/customsInspectionOrder.vue
@@ -688,7 +688,7 @@
   methods: {
     // 姣忔杩涘叆涓嬪崟椤甸潰鏄庣‘璁剧疆鏉ユ簮锛岄伩鍏嶅鐢ㄧ紦瀛橀〉闈㈡椂娌跨敤涓婁竴寮犺鍗曘��
     initOrderSource() {
-      if (this.active !== 1) return
+      if (Number(this.active) !== 1) return
       this.addObj.typeSource = this.isOutsourcing === 't' ? 0 : 1
       if (this.isOutsourcing === 't') {
         this.addObj.appointed = dateFormat(new Date(),'yyyy-MM-dd')
diff --git a/src/views/business/outsourcingOrder/index.vue b/src/views/business/outsourcingOrder/index.vue
index 4185fad..0c65efb 100644
--- a/src/views/business/outsourcingOrder/index.vue
+++ b/src/views/business/outsourcingOrder/index.vue
@@ -1353,7 +1353,7 @@
         }
         const isProduct = orderType === '04subcontract' && row.materialProp === '鎴愬搧'
         this.$router.push({
-          path: isProduct ? '/outsourcingFinishProduct/customsInspectionOrder' : '/materialOrder/customsInspectionOrder',
+          path: isProduct ? '/outsourcingOrder/productOrder' : '/outsourcingOrder/rawOrder',
           query: { isOutsourcing: isProduct ? 't' : 'f', orderType: 0, customsInspection: row, active: 1 }
         })
       }).catch(error => {
@@ -1364,10 +1364,10 @@
     selectAllByOne(row) {
       if (row.isCopper == 1) {
         this.currentId = row.enterOrderId
-        this.$router.push({ path: "/materialOrder/CopperView", query: { customsInspection: row, active: 2, currentId: this.currentId } });
+        this.$router.push({ path: "/outsourcingOrder/copperView", query: { customsInspection: row, active: 2, currentId: this.currentId } });
       } else {
         this.currentId = row.insOrderId
-        this.$router.push({ path: "/materialOrder/customsInspectionView", query: { customsInspection: row, active: 2, currentId: this.currentId } });
+        this.$router.push({ path: "/outsourcingOrder/orderView", query: { customsInspection: row, active: 2, currentId: this.currentId } });
       }
     },
     // 鎵撳紑鍏嶆寮规
diff --git a/src/views/business/rawMaterialInspection/index.vue b/src/views/business/rawMaterialInspection/index.vue
index e5e29bd..8bade39 100644
--- a/src/views/business/rawMaterialInspection/index.vue
+++ b/src/views/business/rawMaterialInspection/index.vue
@@ -787,7 +787,7 @@
     },
     // 鍒囨崲璁㈠崟鍒嗙被鏃舵竻闄や笉閫傜敤鐨勭墿鏂欏睘鎬с��
     changeOrderType(form) {
-      if (!this.getMaterialProps(form.orderType).some(item => item.dictValue === form.materialProp)) {
+      if (form.orderType === '04subcontract' && !['鍗婃垚鍝�', '鎴愬搧'].includes(form.materialProp)) {
         form.materialProp = null
       }
     },

--
Gitblit v1.9.3