From f21ff302a0d82bf89a41c722603f48a97fa335b4 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 15 一月 2026 16:05:52 +0800
Subject: [PATCH] fix: 生产订单-工艺路线重构

---
 src/views/productionManagement/processRoute/index.vue                  |    3 ++-
 src/views/productionManagement/processRoute/processRouteItem/index.vue |   10 +++++++++-
 src/views/productionManagement/productionOrder/index.vue               |   33 ++++++++++++++++++++++++++++++---
 src/api/productionManagement/productProcessRoute.js                    |    9 +++++++++
 4 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/src/api/productionManagement/productProcessRoute.js b/src/api/productionManagement/productProcessRoute.js
index d756e26..8934b79 100644
--- a/src/api/productionManagement/productProcessRoute.js
+++ b/src/api/productionManagement/productProcessRoute.js
@@ -18,6 +18,15 @@
     });
 }
 
+// 鑾峰彇鐢熶骇璁㈠崟鍏宠仈鐨勫伐鑹鸿矾绾夸富淇℃伅
+export function listMain(orderId) {
+    return request({
+        url: "/productProcessRoute/listMain",
+        method: "get",
+        params: { orderId },
+    });
+}
+
 // 鍒犻櫎瀹㈡埛妗f
 export function deleteRouteItem(ids) {
     return request({
diff --git a/src/views/productionManagement/processRoute/index.vue b/src/views/productionManagement/processRoute/index.vue
index 6bd4900..41103f9 100644
--- a/src/views/productionManagement/processRoute/index.vue
+++ b/src/views/productionManagement/processRoute/index.vue
@@ -175,7 +175,8 @@
       productName: row.productName || '',
       model: row.model || '',
       bomNo: row.bomNo || '',
-      description: row.description || ''
+      description: row.description || '',
+      type: 'route',
     }
   })
 };
diff --git a/src/views/productionManagement/processRoute/processRouteItem/index.vue b/src/views/productionManagement/processRoute/processRouteItem/index.vue
index 31b4a74..d4ad249 100644
--- a/src/views/productionManagement/processRoute/processRouteItem/index.vue
+++ b/src/views/productionManagement/processRoute/processRouteItem/index.vue
@@ -211,6 +211,7 @@
 import { ref, computed, getCurrentInstance, onMounted, onUnmounted, nextTick } from "vue";
 import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
 import { findProcessRouteItemList, addOrUpdateProcessRouteItem, sortProcessRouteItem, batchDeleteProcessRouteItem } from "@/api/productionManagement/processRouteItem.js";
+import { findProductProcessRouteItemList } from "@/api/productionManagement/productProcessRoute.js";
 import { processList } from "@/api/productionManagement/productionProcess.js";
 import { useRoute } from 'vue-router'
 import { ElMessageBox } from 'element-plus'
@@ -220,6 +221,8 @@
 const { proxy } = getCurrentInstance() || {};
 
 const routeId = computed(() => route.query.id);
+const orderId = computed(() => route.query.orderId);
+const pageType = computed(() => route.query.type);
 
 const tableLoading = ref(false);
 const tableData = ref([]);
@@ -277,7 +280,12 @@
 // 鑾峰彇鍒楄〃
 const getList = () => {
   tableLoading.value = true;
-  findProcessRouteItemList({ routeId: routeId.value })
+  const listPromise =
+    pageType.value === "order"
+      ? findProductProcessRouteItemList({ orderId: orderId.value })
+      : findProcessRouteItemList({ routeId: routeId.value });
+
+  listPromise
     .then(res => {
       tableData.value = res.data || [];
       tableLoading.value = false;
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index df7f950..d38bfcd 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -63,9 +63,13 @@
   import { onMounted, ref } from "vue";
   import { ElMessageBox } from "element-plus";
   import dayjs from "dayjs";
+  import { useRouter } from "vue-router";
   import { productOrderListPage } from "@/api/productionManagement/productionOrder.js";
+  import { listMain as getOrderProcessRouteMain } from "@/api/productionManagement/productProcessRoute.js";
   const { proxy } = getCurrentInstance();
   import ProcessRouteItemForm from "@/views/productionManagement/productionOrder/ProcessRouteItemForm.vue";
+
+  const router = useRouter();
 
   const tableColumn = ref([
     {
@@ -163,9 +167,32 @@
 
   const isShowItemModal = ref(false);
   const record = ref({});
-  const showRouteItemModal = row => {
-    isShowItemModal.value = true;
-    record.value = row;
+  const showRouteItemModal = async row => {
+    const orderId = row.id;
+    try {
+      const res = await getOrderProcessRouteMain(orderId);
+      const data = res.data || {};
+      if (!data || !data.id) {
+        proxy.$modal.msgWarning("鏈壘鍒板叧鑱旂殑宸ヨ壓璺嚎");
+        return;
+      }
+      router.push({
+        path: "/productionManagement/processRouteItem",
+        query: {
+          id: data.id,
+          processRouteCode: data.processRouteCode || "",
+          productName: data.productName || "",
+          model: data.model || "",
+          bomNo: data.bomNo || "",
+          description: data.description || "",
+          orderId,
+          type: "order",
+        },
+      });
+    } catch (e) {
+      console.error("鑾峰彇宸ヨ壓璺嚎涓讳俊鎭け璐ワ細", e);
+      proxy.$modal.msgError("鑾峰彇宸ヨ壓璺嚎淇℃伅澶辫触");
+    }
   };
 
   // 瀵煎嚭

--
Gitblit v1.9.3