puzhibing
6 天以前 0db8c9b94a9ac655549d5eba5c2a6c92ac386c06
laboratory/src/views/dataManagement/SampleDeliveryRecord/deliveryRecord.vue
@@ -259,6 +259,7 @@
      showReceivedColumns: false,
      schedulingData: [],
      schedulingTotal: 0,
      loadedId: null, // 当前已加载记录的id,用于 keep-alive 重新进入时判断是否需要重新拉取
      form: {
        sampleCode: "",
        id: "",
@@ -296,9 +297,19 @@
    const { id } = this.$route.query;
    if (id) {
      this.form.id = id;
      this.loadedId = id;
      this.getDetailData(id);
    }
  },
  activated() {
    const routeId = this.$route.query.id;
    // 页面被 keep-alive 缓存,再次打开其他记录时重新加载,避免显示上一次的旧数据
    if (routeId && routeId !== this.loadedId) {
      this.loadedId = routeId;
      this.form.id = routeId;
      this.getDetailData(routeId);
    }
  },
  methods: {
    async getDetailData(id) {
      try {