From f3cd8f9805aea1f99b9491af4496a81537c9a778 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期三, 08 四月 2026 14:51:38 +0800
Subject: [PATCH] 质检模块跳转页面问题

---
 src/pages/cooperativeOffice/customerManage/detail.vue     |    8 ----
 src/pages/qualityManagement/processInspection/detail.vue  |   17 ++++----
 src/pages/qualityManagement/finalInspection/add.vue       |   19 ++++-----
 src/pages/qualityManagement/materialInspection/add.vue    |   19 ++++-----
 src/pages/qualityManagement/materialInspection/detail.vue |   16 +++----
 src/pages/qualityManagement/processInspection/add.vue     |   18 ++++-----
 src/pages/qualityManagement/finalInspection/detail.vue    |   16 +++----
 7 files changed, 48 insertions(+), 65 deletions(-)

diff --git a/src/pages/cooperativeOffice/customerManage/detail.vue b/src/pages/cooperativeOffice/customerManage/detail.vue
index e08e729..34e9acb 100644
--- a/src/pages/cooperativeOffice/customerManage/detail.vue
+++ b/src/pages/cooperativeOffice/customerManage/detail.vue
@@ -170,14 +170,6 @@
   import { onLoad, onShow } from "@dcloudio/uni-app";
   import dayjs from "dayjs";
 
-  // 鑾峰彇椤甸潰鍙傛暟
-  const getPageId = () => {
-    const pages = getCurrentPages();
-    const currentPage = pages[pages.length - 1];
-    const options = currentPage.options || {};
-    return options.id || "";
-  };
-
   // 璇︽儏鏁版嵁
   const detailData = ref({});
 
diff --git a/src/pages/qualityManagement/finalInspection/add.vue b/src/pages/qualityManagement/finalInspection/add.vue
index a56b388..9b605c7 100644
--- a/src/pages/qualityManagement/finalInspection/add.vue
+++ b/src/pages/qualityManagement/finalInspection/add.vue
@@ -302,7 +302,7 @@
 
 <script setup>
   import { ref, computed, onMounted, nextTick } from "vue";
-  import { onShow } from "@dcloudio/uni-app";
+  import { onShow, onLoad } from "@dcloudio/uni-app";
   import PageHeader from "@/components/PageHeader.vue";
   import dayjs from "dayjs";
   import { getOptions } from "@/api/procurementManagement/procurementLedger.js";
@@ -454,7 +454,7 @@
 
   // 鏄惁涓虹紪杈戞ā寮�
   const isEdit = computed(() => {
-    const id = getPageId();
+    const id = optionsId.value;
     return !!id;
   });
 
@@ -463,13 +463,6 @@
     const v = form.value || {};
     return !!(v.productMainId != null || v.purchaseLedgerId != null);
   });
-
-  // 鑾峰彇椤甸潰ID
-  const getPageId = () => {
-    const pages = getCurrentPages();
-    const currentPage = pages[pages.length - 1];
-    return currentPage.options.id;
-  };
 
   // 杩斿洖涓婁竴椤�
   const goBack = () => {
@@ -737,7 +730,7 @@
 
   // 鍒濆鍖栬〃鍗�
   const initForm = async () => {
-    const id = getPageId();
+    const id = optionsId.value;
     if (id) {
       // 缂栬緫妯″紡锛屽姞杞芥暟鎹�
       // 鍏堥噸缃〃鍗曟暟鎹�
@@ -890,6 +883,12 @@
   onShow(() => {
     initForm();
   });
+
+  const optionsId = ref("");
+  onLoad(options => {
+    optionsId.value = options.id || "";
+    getDetail();
+  });
 </script>
 
 <style scoped lang="scss">
diff --git a/src/pages/qualityManagement/finalInspection/detail.vue b/src/pages/qualityManagement/finalInspection/detail.vue
index 9af42a7..0e5bba6 100644
--- a/src/pages/qualityManagement/finalInspection/detail.vue
+++ b/src/pages/qualityManagement/finalInspection/detail.vue
@@ -131,7 +131,7 @@
 
 <script setup>
   import { ref, onMounted } from "vue";
-  import { onShow } from "@dcloudio/uni-app";
+  import { onShow, onLoad } from "@dcloudio/uni-app";
   import PageHeader from "@/components/PageHeader.vue";
   import dayjs from "dayjs";
   import { qualityInspectParamInfo } from "@/api/qualityManagement/materialInspection.js";
@@ -204,16 +204,9 @@
     }, 1500);
   };
 
-  // 鑾峰彇椤甸潰ID
-  const getPageId = () => {
-    const pages = getCurrentPages();
-    const currentPage = pages[pages.length - 1];
-    return currentPage.options.id;
-  };
-
   // 鑾峰彇璇︽儏鏁版嵁
   const getDetail = () => {
-    const id = getPageId();
+    const id = optionsId.value;
     if (!id) {
       showToast("鍙傛暟閿欒");
       return;
@@ -262,6 +255,11 @@
   onMounted(() => {
     getDetail();
   });
+  const optionsId = ref("");
+  onLoad(options => {
+    optionsId.value = options.id || "";
+    getDetail();
+  });
 </script>
 
 <style scoped lang="scss">
diff --git a/src/pages/qualityManagement/materialInspection/add.vue b/src/pages/qualityManagement/materialInspection/add.vue
index 0309813..63a94ef 100644
--- a/src/pages/qualityManagement/materialInspection/add.vue
+++ b/src/pages/qualityManagement/materialInspection/add.vue
@@ -309,7 +309,7 @@
 
 <script setup>
   import { ref, computed, onMounted, nextTick } from "vue";
-  import { onShow } from "@dcloudio/uni-app";
+  import { onShow, onLoad } from "@dcloudio/uni-app";
   import PageHeader from "@/components/PageHeader.vue";
   import dayjs from "dayjs";
   import { getOptions } from "@/api/procurementManagement/procurementLedger.js";
@@ -460,7 +460,7 @@
 
   // 鏄惁涓虹紪杈戞ā寮�
   const isEdit = computed(() => {
-    const id = getPageId();
+    const id = optionsId.value;
     return !!id;
   });
 
@@ -469,13 +469,6 @@
     const v = form.value || {};
     return !!(v.productMainId != null || v.purchaseLedgerId != null);
   });
-
-  // 鑾峰彇椤甸潰ID
-  const getPageId = () => {
-    const pages = getCurrentPages();
-    const currentPage = pages[pages.length - 1];
-    return currentPage.options.id;
-  };
 
   // 杩斿洖涓婁竴椤�
   const goBack = () => {
@@ -743,7 +736,7 @@
 
   // 鍒濆鍖栬〃鍗�
   const initForm = async () => {
-    const id = getPageId();
+    const id = optionsId.value;
     if (id) {
       // 缂栬緫妯″紡锛屽姞杞芥暟鎹�
       // 鍏堥噸缃〃鍗曟暟鎹�
@@ -896,6 +889,12 @@
   onShow(() => {
     initForm();
   });
+
+  const optionsId = ref("");
+  onLoad(options => {
+    optionsId.value = options.id || "";
+    initForm();
+  });
 </script>
 
 <style scoped lang="scss">
diff --git a/src/pages/qualityManagement/materialInspection/detail.vue b/src/pages/qualityManagement/materialInspection/detail.vue
index 4064577..e45b9c0 100644
--- a/src/pages/qualityManagement/materialInspection/detail.vue
+++ b/src/pages/qualityManagement/materialInspection/detail.vue
@@ -131,7 +131,7 @@
 
 <script setup>
   import { ref, onMounted } from "vue";
-  import { onShow } from "@dcloudio/uni-app";
+  import { onShow, onLoad } from "@dcloudio/uni-app";
   import PageHeader from "@/components/PageHeader.vue";
   import dayjs from "dayjs";
   import { qualityInspectParamInfo } from "@/api/qualityManagement/materialInspection.js";
@@ -204,16 +204,9 @@
     }, 1500);
   };
 
-  // 鑾峰彇椤甸潰ID
-  const getPageId = () => {
-    const pages = getCurrentPages();
-    const currentPage = pages[pages.length - 1];
-    return currentPage.options.id;
-  };
-
   // 鑾峰彇璇︽儏鏁版嵁
   const getDetail = () => {
-    const id = getPageId();
+    const id = optionsId.value;
     if (!id) {
       showToast("鍙傛暟閿欒");
       return;
@@ -261,6 +254,11 @@
   onMounted(() => {
     getDetail();
   });
+  const optionsId = ref("");
+  onLoad(options => {
+    optionsId.value = options.id || "";
+    getDetail();
+  });
 </script>
 
 <style scoped lang="scss">
diff --git a/src/pages/qualityManagement/processInspection/add.vue b/src/pages/qualityManagement/processInspection/add.vue
index 87a3feb..f146fe1 100644
--- a/src/pages/qualityManagement/processInspection/add.vue
+++ b/src/pages/qualityManagement/processInspection/add.vue
@@ -302,7 +302,7 @@
 
 <script setup>
   import { ref, computed, onMounted, nextTick } from "vue";
-  import { onShow } from "@dcloudio/uni-app";
+  import { onShow, onLoad } from "@dcloudio/uni-app";
   import PageHeader from "@/components/PageHeader.vue";
   import dayjs from "dayjs";
   import { getOptions } from "@/api/procurementManagement/procurementLedger.js";
@@ -454,7 +454,7 @@
 
   // 鏄惁涓虹紪杈戞ā寮�
   const isEdit = computed(() => {
-    const id = getPageId();
+    const id = optionsId.value;
     return !!id;
   });
 
@@ -463,13 +463,6 @@
     const v = form.value || {};
     return !!(v.productMainId != null || v.purchaseLedgerId != null);
   });
-
-  // 鑾峰彇椤甸潰ID
-  const getPageId = () => {
-    const pages = getCurrentPages();
-    const currentPage = pages[pages.length - 1];
-    return currentPage.options.id;
-  };
 
   // 杩斿洖涓婁竴椤�
   const goBack = () => {
@@ -737,7 +730,7 @@
 
   // 鍒濆鍖栬〃鍗�
   const initForm = async () => {
-    const id = getPageId();
+    const id = optionsId.value;
     if (id) {
       // 缂栬緫妯″紡锛屽姞杞芥暟鎹�
       // 鍏堥噸缃〃鍗曟暟鎹�
@@ -890,6 +883,11 @@
   onShow(() => {
     initForm();
   });
+  const optionsId = ref("");
+  onLoad(options => {
+    optionsId.value = options.id || "";
+    initForm();
+  });
 </script>
 
 <style scoped lang="scss">
diff --git a/src/pages/qualityManagement/processInspection/detail.vue b/src/pages/qualityManagement/processInspection/detail.vue
index 6f1ec64..721bb2a 100644
--- a/src/pages/qualityManagement/processInspection/detail.vue
+++ b/src/pages/qualityManagement/processInspection/detail.vue
@@ -131,7 +131,7 @@
 
 <script setup>
   import { ref, onMounted } from "vue";
-  import { onShow } from "@dcloudio/uni-app";
+  import { onShow, onLoad } from "@dcloudio/uni-app";
   import PageHeader from "@/components/PageHeader.vue";
   import dayjs from "dayjs";
   import { qualityInspectParamInfo } from "@/api/qualityManagement/materialInspection.js";
@@ -204,16 +204,9 @@
     }, 1500);
   };
 
-  // 鑾峰彇椤甸潰ID
-  const getPageId = () => {
-    const pages = getCurrentPages();
-    const currentPage = pages[pages.length - 1];
-    return currentPage.options.id;
-  };
-
   // 鑾峰彇璇︽儏鏁版嵁
   const getDetail = () => {
-    const id = getPageId();
+    const id = optionsId.value;
     if (!id) {
       showToast("鍙傛暟閿欒");
       return;
@@ -263,6 +256,12 @@
   onMounted(() => {
     getDetail();
   });
+
+  const optionsId = ref("");
+  onLoad(options => {
+    optionsId.value = options.id || "";
+    getDetail();
+  });
 </script>
 
 <style scoped lang="scss">

--
Gitblit v1.9.3