puzhibing
6 天以前 0db8c9b94a9ac655549d5eba5c2a6c92ac386c06
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"]),
  // },