From 0db8c9b94a9ac655549d5eba5c2a6c92ac386c06 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 08 十月 2026 11:20:56 +0800
Subject: [PATCH] 提交最新代码

---
 laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue b/laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue
index 41f094f..a343381 100644
--- a/laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue
+++ b/laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue
@@ -1,4 +1,4 @@
-<template>
+<template>
   <Card>
     <div class="header-title-left">
       <img src="@/assets/public/headercard.png" />
@@ -99,6 +99,7 @@
       },
       selectedScheduling: null, // 添加选中的实验调度数据
       currentTestItem: null, // 当前编辑的检测项
+      sheetId: '', // 当前已加载确认单的id,用于keep-alive重新进入时判断是否需要重新拉取
       formData: {
         id: '', // 确认单ID
         dispatchId: '', // 实验调度ID
@@ -124,9 +125,19 @@
     // 判断是否是编辑模式
     const id = this.$route.query.id
     if (id) {
+      this.sheetId = id
       this.getDetailData(id)
     }
   },
+  activated() {
+    const routeId = this.$route.query.id
+    // 页面被 keep-alive 缓存,再次打开其他确认单时重新加载,避免显示上一次的旧数据
+    if (routeId && routeId !== this.sheetId) {
+      this.sheetId = routeId
+      this.getDetailData(routeId)
+    }
+    // 新增(无id)场景保留用户填写的数据
+  },
   // computed: {
   //   ...mapState(["tagList", "isFold"]),
   // },

--
Gitblit v1.7.1