wenminjie
2026-07-14 79230b8e4e3143eeb68f90a2644dbe906d0f13e2
修复了菌种库的已知BUG
29个文件已修改
1307 ■■■■■ 已修改文件
culture/src/App.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/deliveryAssessment/projectTeamIntegral/index.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/pedigree-chart/add.vue 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/pedigree-chart/index.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/projectList/index.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strain-library/breeding-record/add.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strain-library/breeding-record/index.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strain-library/main-cell-library/add.vue 189 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strain-library/production-cell-grandson/add.vue 190 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strain-library/production-cell-library/add.vue 196 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strain-library/strain-library-manage/add.vue 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strain-library/validation/chief-cell/DetailConditionDialog.vue 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strain-library/validation/chief-cell/add.vue 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strain-library/validation/chief-cell/confirm-detail.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strain-library/validation/chief-cell/index.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strain-library/validation/primitive-cell/add.vue 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strain-library/validation/primitive-cell/confirm-detail.vue 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strain-library/validation/primitive-cell/index.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strainReportLibrary/reportLibraryOne/add.vue 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strainReportLibrary/reportLibraryOne/index.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strainReportLibrary/reportLibraryOneFour/add.vue 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strainReportLibrary/reportLibraryOneFour/index.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strainReportLibrary/reportLibraryOneTWO/add.vue 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strainReportLibrary/reportLibraryOneTWO/index.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strainReportLibrary/reportLibraryOneThree/add.vue 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/strainReportLibrary/reportLibraryOneThree/index.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/system/operation-log/index.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/system/role/index.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/views/system/user/index.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/App.vue
@@ -1,6 +1,8 @@
<template>
  <div id="app">
    <router-view :key="$route.fullPath"/>
    <keep-alive>
      <router-view :key="$route.fullPath"/>
    </keep-alive>
  </div>
</template>
culture/src/views/deliveryAssessment/projectTeamIntegral/index.vue
@@ -74,6 +74,9 @@
    created() {
        this.reset()
        this.getList()
    },activated() {
        this.reset()
        this.getList()
    },
    methods: {
        goDetail(id) {
culture/src/views/pedigree-chart/add.vue
@@ -211,6 +211,7 @@
      nodeData: {},
      nodeType: "", //1母代 2计划数 3子孙代
      tableData: [],
      cacheData: null,  // 👈 添加这一行
      confirmStorageDialogVisible: false,
      storageVisible: false,
      editBoolean: false,
@@ -247,7 +248,43 @@
    this.initGraph();
    this.initEvents();
  },
  created() {
  deactivated() {
    // 缓存数据
    this.cacheData = {
      form: JSON.parse(JSON.stringify(this.form)),
      graphData: JSON.parse(JSON.stringify(this.graphData)),
      nodeCount: this.nodeCount,
      selectedNode: this.selectedNode ? JSON.parse(JSON.stringify(this.selectedNode)) : null,
      tableData: JSON.parse(JSON.stringify(this.tableData)),
      newTableData: JSON.parse(JSON.stringify(this.newTableData)),
      total: this.total,
      newTotal: this.newTotal,
      projectData: JSON.parse(JSON.stringify(this.projectData)),
      treeData: JSON.parse(JSON.stringify(this.treeData)),
      nodeTreeStatus: this.nodeTreeStatus
    };
  },
  activated() {
    if (this.cacheData) {
      // 恢复数据
      this.form = JSON.parse(JSON.stringify(this.cacheData.form));
      this.graphData = JSON.parse(JSON.stringify(this.cacheData.graphData));
      this.nodeCount = this.cacheData.nodeCount;
      this.selectedNode = this.cacheData.selectedNode;
      this.tableData = this.cacheData.tableData || [];
      this.newTableData = this.cacheData.newTableData || [];
      this.total = this.cacheData.total || 0;
      this.newTotal = this.cacheData.newTotal || 0;
      this.projectData = this.cacheData.projectData || [];
      this.treeData = this.cacheData.treeData || [];
      this.nodeTreeStatus = this.cacheData.nodeTreeStatus || 1;
      // 更新图表
      if (this.graphData.nodes.length > 0) {
        this.updateGraphData();
      }
      return;
    }
    if (this.$route.query.id) {
      this.reloadData();
    }
@@ -630,6 +667,7 @@
        // 更新图表
        this.updateGraphData();
        this.cacheData = null;
      });
    },
    addNodeSign(value, type) {
@@ -718,6 +756,7 @@
            edit({ ...baseData }).then((res) => {
              if (res.code == 200) {
                this.$message.success("编辑成功");
                this.cacheData = null;  // 👈 添加这一行
                this.$router.back();
              }
            });
@@ -726,6 +765,7 @@
          add(baseData).then((res) => {
            if (res.code == 200) {
              this.$message.success("保存成功");
              this.cacheData = null;
              this.$router.back();
            }
          });
culture/src/views/pedigree-chart/index.vue
@@ -121,10 +121,8 @@
      currentApprovalData: null,
    };
  },
  created() {
  activated() {
    this.getTableData();
  },
  mounted() {
    this.fetchTeamList()
  },
  methods: {
culture/src/views/projectList/index.vue
@@ -123,6 +123,9 @@
  created() {
    this.getList();
  },
  activated() {
    this.getList();
  },
  methods: {
    handleProject(type, id) {
      if (type == "add") {
culture/src/views/strain-library/breeding-record/add.vue
@@ -432,19 +432,16 @@
      return this.form.culturePreservations.slice(start, start + pageSize);
    }
  },
  mounted() {
    if (this.$route.query.id) {
  activated() {
    if (this.cacheForm) {
      this.form = this.cacheForm;
    }
    if (this.$route.query.id && !this.cacheForm) {
      this.getDetail()
    }
  },
  deactivated() {
    this.cacheForm = JSON.parse(JSON.stringify(this.form));
  },
  activated() {
    if (this.cacheForm) {
      this.form = this.cacheForm;
    }
  },
  methods: {
    getProjectData(data) {
@@ -575,6 +572,7 @@
            edit(this.form).then(res => {
              if (res.code === 200) {
                this.$message.success('编辑成功');
                this.cacheForm = null
                this.$router.back();
              } else {
                this.$message.error('编辑失败');
@@ -584,6 +582,7 @@
            add(this.form).then(res => {
              if (res.code === 200) {
                this.$message.success('添加成功');
                this.cacheForm = null
                this.$router.back();
              } else {
                this.$message.error('添加失败');
culture/src/views/strain-library/breeding-record/index.vue
@@ -157,7 +157,7 @@
      roleType: Number(JSON.parse(sessionStorage.getItem('userInfo')).roleType),
    };
  },
  created() {
  activated() {
    this.getTableData();
    this.fetchTeamList();
  },
culture/src/views/strain-library/main-cell-library/add.vue
@@ -21,7 +21,24 @@
                </el-select>
              </el-form-item>
                <el-form-item label="菌种编号" prop="strainCode">
                    <el-input v-model="form.strainCode" placeholder="请输入"></el-input>
<!--                    <el-input v-model="form.strainCode" placeholder="请输入"></el-input>-->
                  <div class="strain-code-wrapper">
                    <el-input
                        v-model="form.strainCode"
                        placeholder="请输入前缀"
                        class="strain-code-input"
                    />
                    <span class="strain-code-separator">-</span>
                    <el-input
                        :value="displayStrainSeq"
                        placeholder="序号"
                        class="strain-seq-input"
                        maxlength="3"
                        @input="handleSeqInput"
                        @blur="formatSeq"
                        @focus="handleFocus"
                    />
                  </div>
                </el-form-item>
                <el-form-item label="菌种名称" prop="strainName">
                    <el-input v-model="form.strainName" placeholder="请输入"></el-input>
@@ -112,6 +129,7 @@
      batchForm: {
        count: ''
      },
      displayStrainSeq: '', // 显示用的序号(可能包含前导零)
      form: {
        strainCode: '',
        strainName: '',
@@ -144,24 +162,31 @@
      }
    }
  },
  async created() {
  async activated() {
    await this.fetchTeamList()
    this.resetForm()
    if (this.$route.query.id) {
      getDetail({ id: this.$route.query.id }).then(res => {
        this.form = res
      })
    }
  },
  activated() {
    console.log("activated")
    if (this.cacheForm) {
      this.form = this.cacheForm;
    }
    if (this.$route.query.id && !this.cacheForm) {
      getDetail({ id: this.$route.query.id }).then(res => {
        this.form = res
        if (res.strainCode) {
          const parts = res.strainCode.split('-');
          if (parts.length > 1) {
            const seq = parts.pop();
            this.displayStrainSeq = seq.replace(/^0+/, '');
            this.form.strainCode = parts.join('-');
          } else {
            this.form.strainCode = res.strainCode;
          }
        }
      })
    }
  },
  deactivated() {
    console.log("deactivated")
    this.cacheForm = JSON.parse(JSON.stringify(this.form));
  },
  watch: {
@@ -179,6 +204,80 @@
    }
  },
  methods: {
    // 处理输入:只允许数字
    handleSeqInput(value) {
      console.log('输入值:', value);
      // 如果是空字符串,清空所有
      if (value === '') {
        this.form.strainSeq = '';
        this.displayStrainSeq = '';
        return;
      }
      // 只保留数字,限制3位
      let numStr = value.replace(/\D/g, '').slice(0, 3);
      if (numStr) {
        const num = parseInt(numStr);
        if (!isNaN(num) && num >= 0 && num <= 999) {
          // 存储时去除前导零
          this.form.strainSeq = String(num);
          // 显示时保留用户输入的内容(不补零,让用户看到自己输入的内容)
          this.displayStrainSeq = numStr;
        }
      } else {
        this.form.strainSeq = '';
        this.displayStrainSeq = '';
      }
      console.log('存储值:', this.form.strainSeq);
      console.log('显示值:', this.displayStrainSeq);
    },
    // 失去焦点时:补零到3位
    formatSeq() {
      console.log('失去焦点, 当前值:', this.form.strainSeq);
      if (this.form.strainSeq) {
        const num = parseInt(this.form.strainSeq);
        if (!isNaN(num) && num >= 0 && num <= 999) {
          // 保持存储值为数字字符串
          this.form.strainSeq = String(num);
          // 显示时补零到3位
          this.displayStrainSeq = String(num).padStart(3, '0');
        } else {
          this.form.strainSeq = '';
          this.displayStrainSeq = '';
        }
      } else {
        this.displayStrainSeq = '';
      }
      console.log('格式化后存储值:', this.form.strainSeq);
      console.log('格式化后显示值:', this.displayStrainSeq);
    },
    // 获取焦点时:显示原始数字(去除前导零,便于编辑)
    handleFocus() {
      console.log('获取焦点, 当前值:', this.form.strainSeq);
      if (this.form.strainSeq) {
        // 显示原始数字,去除前导零
        this.displayStrainSeq = this.form.strainSeq;
      } else {
        this.displayStrainSeq = '';
      }
    },
    getFullStrainCode() {
      const prefix = this.form.strainCode || '';
      const seq = this.displayStrainSeq || '';
      if (prefix && seq) {
        const paddedSeq = String(seq).padStart(3, '0');
        return `${prefix}-${paddedSeq}`;
      }
      return prefix;
    },
    // 获取项目组列表
    async fetchTeamList() {
      if (this.teamList.length > 0) return // 已有数据不再重复请求
@@ -238,9 +337,10 @@
      })
    },
    async handleSignatureConfirm(signatureImage) {
      const fullStrainCode = this.getFullStrainCode();
      let requestData = {
        projectId: this.form.projectId,
        strainCode: this.form.strainCode,
        strainCode: fullStrainCode,
        strainName: this.form.strainName,
        strainSource: this.form.strainSource,
        appraisalMethod: this.form.appraisalMethod,
@@ -327,6 +427,71 @@
.strain-form {
    padding: 0 40px;
  // 菌种编号表单项样式
  .strain-code-form-item {
    // 关键:让表单项占满宽度
    flex: 1;
    min-width: 280px;
    :deep(.el-form-item__content) {
      display: flex;
      align-items: center;
      width: 100%;
      line-height: 36px;
    }
  }
  .strain-code-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex: 1;
    .strain-code-input {
      flex: 1; // 改为 flex:1 自适应
      min-width: 0; // 防止溢出
      :deep(.el-input__inner) {
        height: 36px;
        line-height: 36px;
        border-radius: 4px;
        width: 100%;
      }
    }
    .strain-code-separator {
      color: #909399;
      font-size: 16px;
      font-weight: bold;
      user-select: none;
      flex-shrink: 0;
      line-height: 36px;
      padding: 0 2px;
    }
    .strain-seq-input {
      width: 90px; // 固定宽度
      flex-shrink: 0; // 不被压缩
      :deep(.el-input__inner) {
        height: 36px;
        line-height: 36px;
        text-align: center;
        padding: 0 5px;
        border-radius: 4px;
        width: 100%;
        &::-webkit-inner-spin-button,
        &::-webkit-outer-spin-button {
          -webkit-appearance: none;
          margin: 0;
        }
        -moz-appearance: textfield;
      }
    }
  }
    .form-row {
        display: flex;
        flex-wrap: wrap;
culture/src/views/strain-library/production-cell-grandson/add.vue
@@ -20,8 +20,25 @@
                  />
                </el-select>
              </el-form-item>
                <el-form-item label="菌种编号" prop="strainCode">
                    <el-input v-model="form.strainCode" placeholder="请输入"></el-input>
                <el-form-item label="菌种编号" prop="strainCode" class="strain-code-form-item">
<!--                    <el-input v-model="form.strainCode" placeholder="请输入"></el-input>-->
                  <div class="strain-code-wrapper">
                    <el-input
                        v-model="form.strainCode"
                        placeholder="请输入前缀"
                        class="strain-code-input"
                    />
                    <span class="strain-code-separator">-</span>
                    <el-input
                        :value="displayStrainSeq"
                        placeholder="序号"
                        class="strain-seq-input"
                        maxlength="3"
                        @input="handleSeqInput"
                        @blur="formatSeq"
                        @focus="handleFocus"
                    />
                  </div>
                </el-form-item>
                <el-form-item label="菌种名称" prop="strainName">
                    <el-input v-model="form.strainName" placeholder="请输入"></el-input>
@@ -114,6 +131,7 @@
            batchForm: {
                count: ''
            },
          displayStrainSeq: '',
          cacheForm: null,
            form: {
              projectId: '',
@@ -147,7 +165,7 @@
            }
        }
    },
    async mounted() {
    async activated() {
      await this.fetchTeamList();
      this.form = {
@@ -160,20 +178,30 @@
        preservationMethod: '',
        remark: ''
      }
      if (this.$route.query.id) {
      if (this.cacheForm) {
        this.form = this.cacheForm;
      }
      if (this.$route.query.id && !this.cacheForm) {
        getDetail({id: this.$route.query.id}).then(res => {
          this.form = res
          if (res.strainCode) {
            const parts = res.strainCode.split('-');
            if (parts.length > 1) {
              const seq = parts.pop();
              this.displayStrainSeq = seq.replace(/^0+/, '');
              this.form.strainCode = parts.join('-');
            } else {
              this.form.strainCode = res.strainCode;
            }
          }
        })
      }
    },
  deactivated() {
    this.cacheForm = JSON.parse(JSON.stringify(this.form));
  },
  activated() {
    if (this.cacheForm) {
      this.form = this.cacheForm;
    }
  },
    watch: {
        '$route.query.id'() {
@@ -190,6 +218,80 @@
        }
    },
    methods: {
      // 处理输入:只允许数字
      handleSeqInput(value) {
        console.log('输入值:', value);
        // 如果是空字符串,清空所有
        if (value === '') {
          this.form.strainSeq = '';
          this.displayStrainSeq = '';
          return;
        }
        // 只保留数字,限制3位
        let numStr = value.replace(/\D/g, '').slice(0, 3);
        if (numStr) {
          const num = parseInt(numStr);
          if (!isNaN(num) && num >= 0 && num <= 999) {
            // 存储时去除前导零
            this.form.strainSeq = String(num);
            // 显示时保留用户输入的内容(不补零,让用户看到自己输入的内容)
            this.displayStrainSeq = numStr;
          }
        } else {
          this.form.strainSeq = '';
          this.displayStrainSeq = '';
        }
        console.log('存储值:', this.form.strainSeq);
        console.log('显示值:', this.displayStrainSeq);
      },
      // 失去焦点时:补零到3位
      formatSeq() {
        console.log('失去焦点, 当前值:', this.form.strainSeq);
        if (this.form.strainSeq) {
          const num = parseInt(this.form.strainSeq);
          if (!isNaN(num) && num >= 0 && num <= 999) {
            // 保持存储值为数字字符串
            this.form.strainSeq = String(num);
            // 显示时补零到3位
            this.displayStrainSeq = String(num).padStart(3, '0');
          } else {
            this.form.strainSeq = '';
            this.displayStrainSeq = '';
          }
        } else {
          this.displayStrainSeq = '';
        }
        console.log('格式化后存储值:', this.form.strainSeq);
        console.log('格式化后显示值:', this.displayStrainSeq);
      },
      // 获取焦点时:显示原始数字(去除前导零,便于编辑)
      handleFocus() {
        console.log('获取焦点, 当前值:', this.form.strainSeq);
        if (this.form.strainSeq) {
          // 显示原始数字,去除前导零
          this.displayStrainSeq = this.form.strainSeq;
        } else {
          this.displayStrainSeq = '';
        }
      },
      getFullStrainCode() {
        const prefix = this.form.strainCode || '';
        const seq = this.displayStrainSeq || '';
        if (prefix && seq) {
          const paddedSeq = String(seq).padStart(3, '0');
          return `${prefix}-${paddedSeq}`;
        }
        return prefix;
      },
      // 获取项目组列表
      async fetchTeamList() {
        if (this.teamList.length > 0) return // 已有数据不再重复请求
@@ -236,9 +338,10 @@
            })
        },
        async handleSignatureConfirm(signatureImage) {
          const fullStrainCode = this.getFullStrainCode();
            let requestData = {
              projectId: this.form.projectId,
                strainCode: this.form.strainCode,
                strainCode: fullStrainCode,
                strainName: this.form.strainName,
                strainSource: this.form.strainSource,
                appraisalMethod: this.form.appraisalMethod,
@@ -322,6 +425,71 @@
.strain-form {
    padding: 0 40px;
  // 菌种编号表单项样式
  .strain-code-form-item {
    // 关键:让表单项占满宽度
    flex: 1;
    min-width: 280px;
    :deep(.el-form-item__content) {
      display: flex;
      align-items: center;
      width: 100%;
      line-height: 36px;
    }
  }
  .strain-code-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex: 1;
    .strain-code-input {
      flex: 1; // 改为 flex:1 自适应
      min-width: 0; // 防止溢出
      :deep(.el-input__inner) {
        height: 36px;
        line-height: 36px;
        border-radius: 4px;
        width: 100%;
      }
    }
    .strain-code-separator {
      color: #909399;
      font-size: 16px;
      font-weight: bold;
      user-select: none;
      flex-shrink: 0;
      line-height: 36px;
      padding: 0 2px;
    }
    .strain-seq-input {
      width: 90px; // 固定宽度
      flex-shrink: 0; // 不被压缩
      :deep(.el-input__inner) {
        height: 36px;
        line-height: 36px;
        text-align: center;
        padding: 0 5px;
        border-radius: 4px;
        width: 100%;
        &::-webkit-inner-spin-button,
        &::-webkit-outer-spin-button {
          -webkit-appearance: none;
          margin: 0;
        }
        -moz-appearance: textfield;
      }
    }
  }
    .form-row {
        display: flex;
        flex-wrap: wrap;
culture/src/views/strain-library/production-cell-library/add.vue
@@ -20,8 +20,25 @@
                  />
                </el-select>
              </el-form-item>
                <el-form-item label="菌种编号" prop="strainCode">
                    <el-input v-model="form.strainCode" placeholder="请输入"></el-input>
                <el-form-item label="菌种编号" prop="strainCode" class="strain-code-form-item">
<!--                    <el-input v-model="form.strainCode" placeholder="请输入"></el-input>-->
                  <div class="strain-code-wrapper">
                    <el-input
                        v-model="form.strainCode"
                        placeholder="请输入前缀"
                        class="strain-code-input"
                    />
                    <span class="strain-code-separator">-</span>
                    <el-input
                        :value="displayStrainSeq"
                        placeholder="序号"
                        class="strain-seq-input"
                        maxlength="3"
                        @input="handleSeqInput"
                        @blur="formatSeq"
                        @focus="handleFocus"
                    />
                  </div>
                </el-form-item>
                <el-form-item label="菌种名称" prop="strainName">
                    <el-input v-model="form.strainName" placeholder="请输入"></el-input>
@@ -114,6 +131,7 @@
            batchForm: {
                count: ''
            },
          displayStrainSeq: '', // 显示用的序号(可能包含前导零)
          cacheForm: null,
            form: {
                strainCode: '',
@@ -147,7 +165,10 @@
            }
        }
    },
    async mounted() {
  deactivated() {
    this.cacheForm = JSON.parse(JSON.stringify(this.form));
  },
    async activated() {
      await this.fetchTeamList();
      this.form = {
@@ -160,21 +181,28 @@
        preservationMethod: '',
        remark: ''
      }
      if (this.$route.query.id) {
      if (this.cacheForm) {
        this.form = this.cacheForm;
      }
      if (this.$route.query.id && !this.cacheForm) {
        getDetail({id: this.$route.query.id}).then(res => {
          this.form = res
          if (res.strainCode) {
            const parts = res.strainCode.split('-');
            if (parts.length > 1) {
              const seq = parts.pop();
              this.displayStrainSeq = seq.replace(/^0+/, '');
              this.form.strainCode = parts.join('-');
            } else {
              this.form.strainCode = res.strainCode;
            }
          }
        })
      }
    },
  deactivated() {
    this.cacheForm = JSON.parse(JSON.stringify(this.form));
  },
  activated() {
    if (this.cacheForm) {
      this.form = this.cacheForm;
    }
  },
    watch: {
        '$route.query.id'() {
            this.form = {
@@ -191,6 +219,80 @@
        }
    },
    methods: {
      // 处理输入:只允许数字
      handleSeqInput(value) {
        console.log('输入值:', value);
        // 如果是空字符串,清空所有
        if (value === '') {
          this.form.strainSeq = '';
          this.displayStrainSeq = '';
          return;
        }
        // 只保留数字,限制3位
        let numStr = value.replace(/\D/g, '').slice(0, 3);
        if (numStr) {
          const num = parseInt(numStr);
          if (!isNaN(num) && num >= 0 && num <= 999) {
            // 存储时去除前导零
            this.form.strainSeq = String(num);
            // 显示时保留用户输入的内容(不补零,让用户看到自己输入的内容)
            this.displayStrainSeq = numStr;
          }
        } else {
          this.form.strainSeq = '';
          this.displayStrainSeq = '';
        }
        console.log('存储值:', this.form.strainSeq);
        console.log('显示值:', this.displayStrainSeq);
      },
      // 失去焦点时:补零到3位
      formatSeq() {
        console.log('失去焦点, 当前值:', this.form.strainSeq);
        if (this.form.strainSeq) {
          const num = parseInt(this.form.strainSeq);
          if (!isNaN(num) && num >= 0 && num <= 999) {
            // 保持存储值为数字字符串
            this.form.strainSeq = String(num);
            // 显示时补零到3位
            this.displayStrainSeq = String(num).padStart(3, '0');
          } else {
            this.form.strainSeq = '';
            this.displayStrainSeq = '';
          }
        } else {
          this.displayStrainSeq = '';
        }
        console.log('格式化后存储值:', this.form.strainSeq);
        console.log('格式化后显示值:', this.displayStrainSeq);
      },
      // 获取焦点时:显示原始数字(去除前导零,便于编辑)
      handleFocus() {
        console.log('获取焦点, 当前值:', this.form.strainSeq);
        if (this.form.strainSeq) {
          // 显示原始数字,去除前导零
          this.displayStrainSeq = this.form.strainSeq;
        } else {
          this.displayStrainSeq = '';
        }
      },
      getFullStrainCode() {
        const prefix = this.form.strainCode || '';
        const seq = this.displayStrainSeq || '';
        if (prefix && seq) {
          const paddedSeq = String(seq).padStart(3, '0');
          return `${prefix}-${paddedSeq}`;
        }
        return prefix;
      },
      // 获取项目组列表
      async fetchTeamList() {
        if (this.teamList.length > 0) return // 已有数据不再重复请求
@@ -237,9 +339,10 @@
            })
        },
        async handleSignatureConfirm(signatureImage) {
          const fullStrainCode = this.getFullStrainCode();
            let requestData = {
              projectId: this.form.projectId,
                strainCode: this.form.strainCode,
                strainCode: fullStrainCode,
                strainName: this.form.strainName,
                strainSource: this.form.strainSource,
                appraisalMethod: this.form.appraisalMethod,
@@ -323,6 +426,71 @@
.strain-form {
    padding: 0 40px;
  // 菌种编号表单项样式
  .strain-code-form-item {
    // 关键:让表单项占满宽度
    flex: 1;
    min-width: 280px;
    :deep(.el-form-item__content) {
      display: flex;
      align-items: center;
      width: 100%;
      line-height: 36px;
    }
  }
  .strain-code-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex: 1;
    .strain-code-input {
      flex: 1; // 改为 flex:1 自适应
      min-width: 0; // 防止溢出
      :deep(.el-input__inner) {
        height: 36px;
        line-height: 36px;
        border-radius: 4px;
        width: 100%;
      }
    }
    .strain-code-separator {
      color: #909399;
      font-size: 16px;
      font-weight: bold;
      user-select: none;
      flex-shrink: 0;
      line-height: 36px;
      padding: 0 2px;
    }
    .strain-seq-input {
      width: 90px; // 固定宽度
      flex-shrink: 0; // 不被压缩
      :deep(.el-input__inner) {
        height: 36px;
        line-height: 36px;
        text-align: center;
        padding: 0 5px;
        border-radius: 4px;
        width: 100%;
        &::-webkit-inner-spin-button,
        &::-webkit-outer-spin-button {
          -webkit-appearance: none;
          margin: 0;
        }
        -moz-appearance: textfield;
      }
    }
  }
    .form-row {
        display: flex;
        flex-wrap: wrap;
culture/src/views/strain-library/strain-library-manage/add.vue
@@ -135,6 +135,7 @@
        count: ''
      },
      displayStrainSeq: '', // 显示用的序号(可能包含前导零)
      cacheForm: null,
      form: {
        projectId: '',
        strainCode: '',
@@ -185,7 +186,11 @@
      }
    }
  },
  async mounted() {
  deactivated() {
    this.cacheForm = JSON.parse(JSON.stringify(this.form));
  },
  async activated() {
    console.log('mounted')
    await this.fetchTeamList();
    this.form = {
@@ -200,7 +205,12 @@
      remark: ''
    }
    this.displayStrainSeq = 0
    if (this.$route.query.id) {
    if (this.cacheForm) {
      this.form = this.cacheForm;
    }
    if (this.$route.query.id && !this.cacheForm) {
      getDetail({id: this.$route.query.id}).then(res => {
        this.form = {...res}
culture/src/views/strain-library/validation/chief-cell/DetailConditionDialog.vue
@@ -8,8 +8,17 @@
    <el-card class="top-card">
      <el-row :gutter="24" class="top-info-row">
        <el-col :span="6" class="info-col">
          <div class="info-item">
            <span class="label">菌种来源:</span>{{ detail.strainSource }}
          <div class="info-item source-item">
            <span class="label">菌种来源:</span>
            <el-tooltip
              :content="detail.strainSource || '暂无数据'"
              placement="top"
              :disabled="!detail.strainSource || detail.strainSource.length < 30"
              popper-class="source-tooltip"
              effect="dark"
          >
            <span class="source-text">{{ detail.strainSource || '暂无数据' }}</span>
          </el-tooltip>
          </div>
          <div class="info-item">
            <span class="label">鉴别菌株编号:</span>{{ detail.identifyingStrainCode }}
@@ -261,6 +270,36 @@
  flex-shrink: 0;
}
// 或者直接覆盖所有 .el-tooltip__popper
/deep/ .source-tooltip {
  max-width: 320px !important;
  min-width: 120px !important;
  word-break: break-word;
  line-height: 1.6;
  padding: 10px 14px;
  font-size: 13px;
}
.source-item {
  flex: 1;
  min-width: 0;
  .source-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #303133;
    cursor: pointer;
    padding: 0 4px;
    &:hover {
      color: #409EFF;
    }
  }
}
.sign-col {
  align-items: center;
  text-align: center;
culture/src/views/strain-library/validation/chief-cell/add.vue
@@ -103,8 +103,12 @@
            }
        }
    },
    mounted() {
        if (this.$route.query.id) {
    activated() {
      if (this.cacheForm) {
        this.form = this.cacheForm;
      }
        if (this.$route.query.id && this.cacheForm) {
            detail({ id: this.$route.query.id }).then(res => {
                if (res) {
                    // 这里根据实际接口返回字段做适配
@@ -116,12 +120,6 @@
    },
  deactivated() {
    this.cacheForm = JSON.parse(JSON.stringify(this.form));
  },
  activated() {
    if (this.cacheForm) {
      this.form = this.cacheForm;
    }
  },
    methods: {
      getProjectData(data) {
@@ -150,17 +148,20 @@
                if (id) {
                    // 编辑
                    edit({ ...submitData, id }).then(() => {
                      this.cacheForm = null
                        this.$router.back();
                    });
                } else {
                    // 新增
                    add(submitData).then(() => {
                      this.cacheForm = null
                        this.$router.back();
                    });
                }
            } else {
                // 存草稿
                add(submitData).then(() => {
                  this.cacheForm = null
                    this.$router.back();
                });
            }
culture/src/views/strain-library/validation/chief-cell/confirm-detail.vue
@@ -98,6 +98,7 @@
  components: { EditConditionDialog, DetailConditionDialog },
  data() {
    return {
      cacheForm: null,
      detail: {
        strainSource: '',
        identifyingStrainCode: '',
@@ -155,8 +156,16 @@
      }
    },
  },
  mounted() {
    this.getDetail()
  activated() {
    if (this.cacheForm) {
      this.detail = this.cacheForm;
    }
    if (this.$route.query.id && !this.cacheForm) {
      this.getDetail();
    }
  },
  deactivated() {
    this.cacheForm = JSON.parse(JSON.stringify(this.detail));
  },
  methods: {
    getFullUrl(url) {
@@ -198,9 +207,11 @@
        if (valid) {
          this.detail.list = this.tableData || []
          this.detail.purpose = this.detail.purpose.join(',')
          this.detail.isDraft = 0
          confirm({...this.detail}).then(res => {
            if (res.code == 200) {
              this.$message.success('保存成功');
              this.cacheForm = null
              this.$router.back()
            } else {
              this.$message.error(res.msg);
culture/src/views/strain-library/validation/chief-cell/index.vue
@@ -86,7 +86,7 @@
        </el-table-column>
        <el-table-column label="操作" width="200">
          <template #default="{ row }">
            <el-button type="text" v-if="row.status == 1 && roleType == 3 && currentType != 'draft'"
            <el-button type="text" v-if="row.status == 1 && roleType == 3"
              style="margin-right: 10px;"
              @click="$router.push('/strain/validation/confirm-detail?id=' + row.id)">确认</el-button>
            <el-button type="text" style="margin-right: 10px;" v-if="roleType == 4"
@@ -261,7 +261,8 @@
      this.searchData();
    },
  },
  mounted() {
  activated() {
    this.searchData();
  },
};
culture/src/views/strain-library/validation/primitive-cell/add.vue
@@ -104,8 +104,12 @@
            }
        }
    },
    mounted() {
        if (this.$route.query.id) {
  activated() {
    if (this.cacheForm) {
      this.form = this.cacheForm;
    }
        if (this.$route.query.id && !this.cacheForm) {
            detail({ id: this.$route.query.id }).then(res => {
                if (res) {
                    // 这里根据实际接口返回字段做适配
@@ -117,12 +121,6 @@
    },
  deactivated() {
    this.cacheForm = JSON.parse(JSON.stringify(this.form));
  },
  activated() {
    if (this.cacheForm) {
      this.form = this.cacheForm;
    }
  },
    methods: {
      getProjectData(data) {
culture/src/views/strain-library/validation/primitive-cell/confirm-detail.vue
@@ -159,7 +159,6 @@
        result: '',
        purpose: []
      },
      activeTab: 'conditions',
      rules: {
        result: [
          { required: true, message: '请输入实验结论', trigger: 'blur' }
@@ -178,23 +177,19 @@
        { conditions: '发酵时间', record: '', workmanship: '' },
        { conditions: '检测数据及结果', record: '', workmanship: '' }
      ],
      tableData: [
        { conditions: '平板培养基', record: '', workmanship: '' },
        { conditions: '培养温度', record: '', workmanship: '' },
        { conditions: '培养时间', record: '', workmanship: '' },
        { conditions: '摇瓶培养基', record: '', workmanship: '' },
        { conditions: '接种量', record: '', workmanship: '' },
        { conditions: '培养时间', record: '', workmanship: '' },
        { conditions: '发酵时间', record: '', workmanship: '' },
        { conditions: '检测数据及结果', record: '', workmanship: '' }
      ],
      tableData: [],
      dialogVisible: false,
      dialogIsEdit: false,
      dialogIsFixed: false,
      dialogValue: {},
      dialogIndex: null,
      detailDialogVisible: false,
      detailDialogValue: {}
      detailDialogValue: {},
      cacheForm: null,
      cacheFormtableData: null,
      isFirstLoad: true,
      isLoading: false,
    }
  },
  filters: {
@@ -205,9 +200,46 @@
      return ''
    }
  },
  mounted() {
    this.getDetail()
  // ========== 只使用 activated ==========
  activated() {
    console.log('activated, isFirstLoad:', this.isFirstLoad)
    // 1. 首次加载 - 初始化数据并请求
    if (this.isFirstLoad) {
      this.isFirstLoad = false
      // 初始化表格数据(显示默认行)
      this.tableData = this.initialTableData.map(item => ({ ...item }))
      if (this.$route.query.id) {
        this.getDetail()
      }
      return
    }
    // 2. 从缓存恢复数据(非首次加载)
    if (this.cacheForm) {
      this.detail = JSON.parse(JSON.stringify(this.cacheForm))
      this.tableData = JSON.parse(JSON.stringify(this.cacheFormtableData))
      this.restorePurpose()
    }
    // 3. 如果路由参数变化,重新加载数据
    if (this.$route.query.id && this.detail.id && this.$route.query.id !== String(this.detail.id)) {
      this.getDetail()
    }
  },
  deactivated() {
    // 缓存当前数据
    this.cacheForm = JSON.parse(JSON.stringify(this.detail))
    this.cacheFormtableData = JSON.parse(JSON.stringify(this.tableData))
    console.log('deactivated - 数据已缓存')
  },
  // ========== 移除 mounted,或保留仅用于调试 ==========
  mounted() {
    // 不做任何初始化,所有逻辑都在 activated 中
    console.log('mounted - 仅用于调试,无初始化逻辑')
  },
  // ========== 方法 ==========
  methods: {
    getFullUrl(url) {
      if (url) {
@@ -215,15 +247,78 @@
      }
      return ''
    },
    getDetail() {
      detail({ id: this.$route.query.id }).then(res => {
        this.detail = {
          ...res,
          handleSignature: res.handleSignature || '',
          purpose: res.purpose || []
        }
      })
    restorePurpose() {
      if (!this.detail.purpose) {
        this.detail.purpose = []
        return
      }
      let purposeArray = []
      if (typeof this.detail.purpose === 'string') {
        purposeArray = this.detail.purpose.split(',').map(item => Number(item.trim())).filter(num => !isNaN(num))
      } else if (Array.isArray(this.detail.purpose)) {
        purposeArray = this.detail.purpose
      }
      this.detail.purpose = purposeArray
    },
    getDetail() {
      if (this.isLoading) {
        console.log('正在加载中,跳过重复请求')
        return
      }
      const id = this.$route.query.id
      if (!id) {
        console.warn('缺少 id 参数')
        return
      }
      this.isLoading = true
      console.log('开始请求详情数据, id:', id)
      detail({ id })
          .then(res => {
            console.log('详情数据返回:', res)
            // 处理 purpose
            let purposeArray = []
            if (res.purpose) {
              if (typeof res.purpose === 'string') {
                purposeArray = res.purpose.split(',').map(item => Number(item.trim())).filter(num => !isNaN(num))
              } else if (Array.isArray(res.purpose)) {
                purposeArray = res.purpose
              }
            }
            // 处理 tableData
            const tableList = res.list && res.list.length > 0 ? res.list : this.initialTableData.map(item => ({ ...item }))
            // 更新数据
            this.detail = {
              ...res,
              handleSignature: res.handleSignature || '',
              purpose: purposeArray || []
            }
            this.tableData = tableList
            // 更新缓存
            this.cacheForm = JSON.parse(JSON.stringify(this.detail))
            this.cacheFormtableData = JSON.parse(JSON.stringify(this.tableData))
          })
          .catch(err => {
            console.error('获取详情失败:', err)
            this.$message.error('加载数据失败,请重试')
            // 加载失败时使用初始数据
            this.tableData = this.initialTableData.map(item => ({ ...item }))
          })
          .finally(() => {
            this.isLoading = false
          })
    },
    handleAdd() {
      this.dialogVisible = true
      this.dialogIsEdit = false
@@ -231,6 +326,7 @@
      this.dialogValue = {}
      this.dialogIndex = null
    },
    handleEdit(row) {
      const idx = this.tableData.indexOf(row)
      this.dialogVisible = true
@@ -239,21 +335,26 @@
      this.dialogValue = { ...row }
      this.dialogIndex = idx
    },
    handleDetail(row) {
      this.detailDialogVisible = true
      this.detailDialogValue = { ...row }
    },
    handleSave() {
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.detail.list = this.tableData || []
          this.detail.purpose = this.detail.purpose.join(',')
          this.detail.isDraft = 0
          confirm({ ...this.detail }).then(res => {
            if (res.code == 200) {
              this.$message.success('保存成功')
              this.cacheForm = null
              this.cacheFormtableData = null
              this.$router.back()
            } else {
              this.$message.error(res.msg)
              this.$message.error(res.msg || '保存失败')
            }
          })
        } else {
@@ -262,25 +363,27 @@
        }
      })
    },
    handleDraft() {
      this.$refs.form.validate((valid) => {
        if (valid) {
          //todo 存稿逻辑
          this.detail.list = this.tableData || []
          this.detail.purpose = this.detail.purpose.join(',')
          console.log('this.detail: ',this.detail)
          saveDraft({ ...this.detail }).then(res => {
            if (res.code == 200) {
              this.$message.success('保存成功')
              this.$message.success('存稿成功')
              this.cacheForm = null
              this.cacheFormtableData = null
              this.$router.back()
            } else {
              this.$message.error(res.msg)
              this.$message.error(res.msg || '存稿失败')
            }
          })
        }
      })
    },
    handleDialogOk(val) {
      if (this.dialogIsEdit && this.dialogIndex !== null) {
        this.$set(this.tableData, this.dialogIndex, val)
@@ -288,6 +391,7 @@
        this.tableData.push(val)
      }
    },
    getRowClassName({ rowIndex }) {
      return rowIndex < this.initialTableData?.length ? 'fixed-row' : ''
    }
culture/src/views/strain-library/validation/primitive-cell/index.vue
@@ -87,7 +87,7 @@
        </el-table-column>
        <el-table-column label="操作" width="200">
          <template #default="{ row }">
            <el-button  style="margin-right: 10px" type="text" v-if="row.status == 1 && roleType == 3&&currentType != 'draft'"
            <el-button  style="margin-right: 10px" type="text" v-if="row.status == 1 && roleType == 3"
              @click="$router.push('/strain/validation/confirm-detail?id=' + row.id)">确认</el-button>
            <el-button  style="margin-right: 10px" type="text" v-if="roleType == 4" @click="handleDetail(row)">详情</el-button>
            <el-button  style="margin-right: 10px" type="text" v-if="roleType != 4" @click="handleDetail2(row)">详情</el-button>
@@ -258,7 +258,7 @@
      }
    },
  },
  async mounted() {
  async activated() {
    await this.fetchTeamList();
    await this.searchData();
  },
culture/src/views/strainReportLibrary/reportLibraryOne/add.vue
@@ -181,7 +181,7 @@
                approver: "",
                approveTime: ""
            },
          cacheForm: null,
          cacheData: null,
            projectData: [], // 存储选中的项目组数据
            fileList: [], // 附件列表
            showChoose: false,
@@ -244,12 +244,40 @@
        }
    },
  deactivated() {
    this.cacheForm = JSON.parse(JSON.stringify(this.form));
    // 缓存所有数据
    this.cacheData = {
      form: JSON.parse(JSON.stringify(this.form)),
      fileList: JSON.parse(JSON.stringify(this.fileList)),
      assessmentTable: JSON.parse(JSON.stringify(this.assessmentTable)),
      selectedMember: this.selectedMember ? JSON.parse(JSON.stringify(this.selectedMember)) : null,
      projectData: JSON.parse(JSON.stringify(this.projectData)),
      reportContent: this.$refs.materialEditor ? this.$refs.materialEditor.getContent() : ''
    };
  },
  activated() {
    if (this.cacheForm) {
      this.form = this.cacheForm;
    if (this.cacheData) {
      // 恢复表单数据
      this.form = JSON.parse(JSON.stringify(this.cacheData.form));
      // 恢复文件列表
      this.fileList = JSON.parse(JSON.stringify(this.cacheData.fileList || []));
      // 恢复考核表数据
      this.assessmentTable = JSON.parse(JSON.stringify(this.cacheData.assessmentTable || []));
      // 恢复选中的成员
      this.selectedMember = this.cacheData.selectedMember ? JSON.parse(JSON.stringify(this.cacheData.selectedMember)) : null;
      // 恢复项目数据
      this.projectData = JSON.parse(JSON.stringify(this.cacheData.projectData || []));
      // 恢复编辑器内容(需要在nextTick中设置)
      this.$nextTick(() => {
        if (this.$refs.materialEditor && this.cacheData.reportContent) {
          this.$refs.materialEditor.setContent(this.cacheData.reportContent);
        }
      });
      return;
    }
    // 没有缓存时,如果有id则加载详情
    if (this.$route.query.id) {
      this.getDetailData();
    }
  },
    mounted() {
@@ -258,7 +286,7 @@
            window.scrollTo(0, 0);
        });
        if (this.$route.query.id) {
        if (this.$route.query.id  && !this.cacheData) {
            getDetail(this.$route.query.id).then(res => {
                const data = res.data || res;
@@ -294,6 +322,41 @@
        }
    },
    methods: {
      // 👇 添加这个方法
      getDetailData() {
        getDetail(this.$route.query.id).then(res => {
          const data = res.data || res;
          this.form = {
            ...this.form,
            ...data,
            processData: []
          };
          let arr = data.evaluate.split(',')
          this.fileList = (data.enclosureUrl ? JSON.parse(data.enclosureUrl) : [])
          this.assessmentTable = this.assessmentTable.map((item, index) => {
            item.selectedScore = Number(arr[index])
            return item
          })
          this.selectedMember = [{
            nickName: data.experimentName,
            userId: data.experimentId
          }]
          this.projectData = data.projectTeam ?
              [{ ...data.projectTeam, staffName: data.projectTeam.staff || '' }] :
              [];
          // 设置编辑器内容
          if (this.$refs.materialEditor && data.reportContent) {
            this.$refs.materialEditor.setContent(data.reportContent);
          }
        }).catch(err => {
          this.$message.error('获取详情失败');
        });
      },
        handlePreview(file) {
            if (file && file.url) {
                // 判断是否为图片文件
@@ -411,7 +474,8 @@
                        this.submitLoading = false;
                        if (res.code == 200) {
                            this.$message.success('编辑成功');
                            this.$router.back()
                          this.cacheData = null;
                          this.$router.back()
                        } else {
                            this.$message.error(res.msg || '编辑失败');
                            this.submitLoading = false;
@@ -424,7 +488,8 @@
                    this.submitLoading = false;
                    if (res.code == 200) {
                        this.$message.success('发送成功');
                        this.$router.push('/strainReportLibrary/reportLibraryOne');
                      this.cacheData = null;
                      this.$router.push('/strainReportLibrary/reportLibraryOne');
                    } else {
                        this.$message.error(res.msg || '发送失败');
                        this.submitLoading = false;
culture/src/views/strainReportLibrary/reportLibraryOne/index.vue
@@ -138,6 +138,9 @@
    mounted() {
        this.getLists()
    },
  activated() {
        this.getLists()
    },
    methods: {
        viewDetail(row) {
            this.obj = row
culture/src/views/strainReportLibrary/reportLibraryOneFour/add.vue
@@ -168,6 +168,7 @@
    components: { AiEditor, ChooseProject, SelectMember },
    data() {
        return {
          cacheData: null,  // 👈 添加这一行
            form: {
                planName: "",
                planCode: "",
@@ -243,12 +244,51 @@
            return this.assessmentTable.reduce((sum, row) => sum + Number(row.selectedScore), 0)
        }
    },
  // 👇 添加这两个钩子
  activated() {
    if (this.cacheData) {
      // 恢复表单数据
      this.form = JSON.parse(JSON.stringify(this.cacheData.form));
      // 恢复文件列表
      this.fileList = JSON.parse(JSON.stringify(this.cacheData.fileList || []));
      // 恢复考核表数据
      this.assessmentTable = JSON.parse(JSON.stringify(this.cacheData.assessmentTable || []));
      // 恢复选中的成员
      this.selectedMember = this.cacheData.selectedMember ? JSON.parse(JSON.stringify(this.cacheData.selectedMember)) : null;
      // 恢复项目数据
      this.projectData = JSON.parse(JSON.stringify(this.cacheData.projectData || []));
      // 恢复编辑器内容
      this.$nextTick(() => {
        if (this.$refs.materialEditor && this.cacheData.reportContent) {
          this.$refs.materialEditor.setContent(this.cacheData.reportContent);
        }
      });
      return;
    }
    // 没有缓存时,如果有id则加载详情
    if (this.$route.query.id) {
      this.getDetailData();
    }
  },
  deactivated() {
    // 缓存所有数据
    this.cacheData = {
      form: JSON.parse(JSON.stringify(this.form)),
      fileList: JSON.parse(JSON.stringify(this.fileList)),
      assessmentTable: JSON.parse(JSON.stringify(this.assessmentTable)),
      selectedMember: this.selectedMember ? JSON.parse(JSON.stringify(this.selectedMember)) : null,
      projectData: JSON.parse(JSON.stringify(this.projectData)),
      reportContent: this.$refs.materialEditor ? this.$refs.materialEditor.getContent() : ''
    };
  },
    mounted() {
        // 滚动到页面顶部
        this.$nextTick(() => {
            window.scrollTo(0, 0);
        });
        if (this.$route.query.id) {
      if (this.$route.query.id && !this.cacheData) {
            getDetail(this.$route.query.id).then(res => {
                const data = res.data || res;
                this.form = {
@@ -288,6 +328,47 @@
        }
    },
    methods: {
      // 👇 添加这个方法
      getDetailData() {
        getDetail(this.$route.query.id).then(res => {
          const data = res.data || res;
          this.form = {
            ...this.form,
            ...data,
            processData: []
          };
          let arr = [];
          if (data.evaluate) {
            arr = data.evaluate.split(',');
          } else {
            arr = this.assessmentTable.map(() => 0);
          }
          this.fileList = (data.enclosureUrl ? JSON.parse(data.enclosureUrl) : []);
          this.assessmentTable = this.assessmentTable.map((item, index) => {
            item.selectedScore = Number(arr[index] ?? 0);
            return item;
          });
          this.selectedMember = [{
            nickName: data.experimentName,
            userId: data.experimentId
          }];
          this.projectData = data.projectTeam ?
              [{ ...data.projectTeam, staffName: data.projectTeam.staff || '' }] :
              [];
          // 设置编辑器内容
          if (this.$refs.materialEditor && data.reportContent) {
            this.$refs.materialEditor.setContent(data.reportContent);
          }
        }).catch(err => {
          this.$message.error('获取详情失败');
        });
      },
        handlePreview(file) {
            if (file && file.url) {
                // 判断是否为图片文件
@@ -429,6 +510,7 @@
                            this.submitLoading = false;
                            if (res.code == 200) {
                                this.$message.success('编辑成功');
                              this.cacheData = null;  // 👈 添加这一行
                                this.$router.back()
                            }
                        }).catch(() => {
@@ -440,6 +522,7 @@
                        this.submitLoading = false;
                        if (res.code == 200) {
                            this.$message.success('发送成功');
                          this.cacheData = null;  // 👈 添加这一行
                            this.$router.push('/strainReportLibrary/reportLibraryFour');
                        }
                    }).catch(() => {
@@ -464,7 +547,7 @@
                        const params = {
                            isDraft: 1,
                            projectId: this.projectData[0].id,
                            experimentId: this.selectedMember[0].userId,
                            // experimentId: this.selectedMember[0].userId,
                            enclosureUrl: this.fileList.length && JSON.stringify(this.fileList),
                            // reportCode: this.form.reportCode,
                            reportContent: this.$refs.materialEditor.getContent(),
@@ -479,6 +562,7 @@
                                this.submitLoading = false;
                                if (res.code == 200) {
                                    this.$message.success('编辑成功');
                                  this.cacheData = null;  // 👈 添加这一行
                                    this.$router.back()
                                }
                            }).catch(() => {
@@ -490,6 +574,7 @@
                            this.draftLoading = false;
                            if (res.code == 200) {
                                this.$message.success('保存成功');
                              this.cacheData = null;  // 👈 添加这一行
                                this.$router.push('/strainReportLibrary/reportLibraryFour');
                            }
                        }).catch(() => {
culture/src/views/strainReportLibrary/reportLibraryOneFour/index.vue
@@ -143,6 +143,8 @@
    },
    mounted() {
        this.getLists()
    },activated() {
        this.getLists()
    },
    methods: {
        viewEvaluate() {
culture/src/views/strainReportLibrary/reportLibraryOneTWO/add.vue
@@ -167,6 +167,7 @@
    components: { AiEditor, ChooseProject, SelectMember },
    data() {
        return {
          cacheData: null,
            form: {
                planName: "",
                planCode: "",
@@ -241,12 +242,50 @@
            return this.assessmentTable.reduce((sum, row) => sum + Number(row.selectedScore), 0)
        }
    },
  // 👇 添加这两个钩子
  activated() {
    if (this.cacheData) {
      // 恢复表单数据
      this.form = JSON.parse(JSON.stringify(this.cacheData.form));
      // 恢复文件列表
      this.fileList = JSON.parse(JSON.stringify(this.cacheData.fileList || []));
      // 恢复考核表数据
      this.assessmentTable = JSON.parse(JSON.stringify(this.cacheData.assessmentTable || []));
      // 恢复选中的成员
      this.selectedMember = this.cacheData.selectedMember ? JSON.parse(JSON.stringify(this.cacheData.selectedMember)) : null;
      // 恢复项目数据
      this.projectData = JSON.parse(JSON.stringify(this.cacheData.projectData || []));
      // 恢复编辑器内容
      this.$nextTick(() => {
        if (this.$refs.materialEditor && this.cacheData.reportContent) {
          this.$refs.materialEditor.setContent(this.cacheData.reportContent);
        }
      });
      return;
    }
    // 没有缓存时,如果有id则加载详情
    if (this.$route.query.id) {
      this.getDetailData();
    }
  },
  deactivated() {
    // 缓存所有数据
    this.cacheData = {
      form: JSON.parse(JSON.stringify(this.form)),
      fileList: JSON.parse(JSON.stringify(this.fileList)),
      assessmentTable: JSON.parse(JSON.stringify(this.assessmentTable)),
      selectedMember: this.selectedMember ? JSON.parse(JSON.stringify(this.selectedMember)) : null,
      projectData: JSON.parse(JSON.stringify(this.projectData)),
      reportContent: this.$refs.materialEditor ? this.$refs.materialEditor.getContent() : ''
    };
  },
    mounted() {
        // 滚动到页面顶部
        this.$nextTick(() => {
            window.scrollTo(0, 0);
        });
        if (this.$route.query.id) {
      if (this.$route.query.id && !this.cacheData) {
            getDetail(this.$route.query.id).then(res => {
                const data = res.data || res;
                this.form = {
@@ -287,6 +326,48 @@
        }
    },
    methods: {
      // 👇 添加这个方法
      getDetailData() {
        getDetail(this.$route.query.id).then(res => {
          const data = res.data || res;
          this.form = {
            ...this.form,
            ...data,
            processData: []
          };
          // 添加空值判断
          let arr = [];
          if (data.evaluate) {
            arr = data.evaluate.split(',');
          } else {
            arr = this.assessmentTable.map(() => 0);
          }
          this.selectedMember = [{
            nickName: data.experimentName,
            userId: data.experimentId
          }];
          this.fileList = (data.enclosureUrl ? JSON.parse(data.enclosureUrl) : []);
          this.assessmentTable = this.assessmentTable.map((item, index) => {
            item.selectedScore = Number(arr[index] ?? 0);
            return item;
          });
          this.projectData = data.projectTeam ?
              [{ ...data.projectTeam, staffName: data.projectTeam.staff || '' }] :
              [];
          // 设置编辑器内容
          if (this.$refs.materialEditor && data.reportContent) {
            this.$refs.materialEditor.setContent(data.reportContent);
          }
        }).catch(err => {
          console.log(err);
          this.$message.error('获取详情失败');
        });
      },
      handlePreview(file) {
      if (file && file.url) {
        // 判断是否为图片文件
@@ -432,6 +513,7 @@
                        if (res.code == 200) {
                            this.$message.success('编辑成功');
                            this.$router.back()
                          this.cacheData = null;
                        } else {
                            this.$message.error(res.message || '编辑失败');
                        }
@@ -447,6 +529,7 @@
                    if (res.code == 200) {
                        this.$message.success('发送成功');
                        this.$router.back()
                      this.cacheData = null;
                    } else {
                        this.$message.error(res.message || '发送失败');
                    }
culture/src/views/strainReportLibrary/reportLibraryOneTWO/index.vue
@@ -142,6 +142,9 @@
    mounted() {
        this.getLists()
    },
  activated() {
        this.getLists()
    },
    methods: {
        viewEvaluate() {
            this.obj.viewDetail = true
culture/src/views/strainReportLibrary/reportLibraryOneThree/add.vue
@@ -158,9 +158,9 @@
<script>
import AiEditor from '@/components/AiEditor'
import ChooseProject from '@/components/chooseProject/index.vue'
import { customUploadRequest, getFullUrl, downloadFileByUrl, getAllocateIp, isImageFile } from "@/utils/utils";
import {customUploadRequest, downloadFileByUrl, getAllocateIp, getFullUrl, isImageFile} from "@/utils/utils";
import SelectMember from '@/components/SelectMember'
import { add, getDetail, update } from './service'
import {add, getDetail, update} from './service'
export default {
    components: { AiEditor, ChooseProject, SelectMember },
@@ -191,7 +191,8 @@
            },
            status: "1",
            remark: "",
            queryForm: {
          cacheData: null,  // 👈 添加这一行
          queryForm: {
            },
            assessmentTable: [
@@ -241,12 +242,50 @@
            return this.assessmentTable.reduce((sum, row) => sum + Number(row.selectedScore), 0)
        }
    },
  // 👇 添加这两个钩子
  activated() {
    if (this.cacheData) {
      // 恢复表单数据
      this.form = JSON.parse(JSON.stringify(this.cacheData.form));
      // 恢复文件列表
      this.fileList = JSON.parse(JSON.stringify(this.cacheData.fileList || []));
      // 恢复考核表数据
      this.assessmentTable = JSON.parse(JSON.stringify(this.cacheData.assessmentTable || []));
      // 恢复选中的成员
      this.selectedMember = this.cacheData.selectedMember ? JSON.parse(JSON.stringify(this.cacheData.selectedMember)) : null;
      // 恢复项目数据
      this.projectData = JSON.parse(JSON.stringify(this.cacheData.projectData || []));
      // 恢复编辑器内容
      this.$nextTick(() => {
        if (this.$refs.materialEditor && this.cacheData.reportContent) {
          this.$refs.materialEditor.setContent(this.cacheData.reportContent);
        }
      });
      return;
    }
    // 没有缓存时,如果有id则加载详情
    if (this.$route.query.id) {
      this.getDetailData();
    }
  },
  deactivated() {
    // 缓存所有数据
    this.cacheData = {
      form: JSON.parse(JSON.stringify(this.form)),
      fileList: JSON.parse(JSON.stringify(this.fileList)),
      assessmentTable: JSON.parse(JSON.stringify(this.assessmentTable)),
      selectedMember: this.selectedMember ? JSON.parse(JSON.stringify(this.selectedMember)) : null,
      projectData: JSON.parse(JSON.stringify(this.projectData)),
      reportContent: this.$refs.materialEditor ? this.$refs.materialEditor.getContent() : ''
    };
  },
    mounted() {
        // 滚动到页面顶部
        this.$nextTick(() => {
            window.scrollTo(0, 0);
        });
        if (this.$route.query.id) {
      if (this.$route.query.id && !this.cacheData) {
            getDetail(this.$route.query.id).then(res => {
                const data = res.data || res;
                this.form = {
@@ -285,6 +324,47 @@
        }
    },
    methods: {
      // 👇 添加这个方法
      getDetailData() {
        getDetail(this.$route.query.id).then(res => {
          const data = res.data || res;
          this.form = {
            ...this.form,
            ...data,
            processData: []
          };
          let arr = [];
          if (data.evaluate) {
            arr = data.evaluate.split(',');
          } else {
            arr = this.assessmentTable.map(() => 0);
          }
          this.fileList = (data.enclosureUrl ? JSON.parse(data.enclosureUrl) : []);
          this.assessmentTable = this.assessmentTable.map((item, index) => {
            item.selectedScore = Number(arr[index] ?? 0);
            return item;
          });
          this.selectedMember = [{
            nickName: data.experimentName,
            userId: data.experimentId
          }];
          this.projectData = data.projectTeam ?
              [{ ...data.projectTeam, staffName: data.projectTeam.staff || '' }] :
              [];
          // 设置编辑器内容
          if (this.$refs.materialEditor && data.reportContent) {
            this.$refs.materialEditor.setContent(data.reportContent);
          }
        }).catch(err => {
          this.$message.error('获取详情失败');
        });
      },
        handlePreview(file) {
            if (file && file.url) {
                // 判断是否为图片文件
@@ -445,6 +525,7 @@
                        if (res.code == 200) {
                            this.$message.success('编辑成功');
                            this.$router.back()
                          this.cacheData = null;
                        }
                    }).catch(() => {
                        this.submitLoading = false;
@@ -456,6 +537,7 @@
                    if (res.code == 200) {
                        this.$message.success('发送成功');
                        this.$router.push('/strainReportLibrary/reportLibraryThree');
                      this.cacheData = null;
                    } else {
                        this.$message.error(res.msg || '发送失败');
                    }
@@ -468,20 +550,24 @@
        },
        saveData() {
            if (this.saveLoading) return;
            this.saveLoading = true;
            this.$refs.form.validate(async (valid) => {
                if (!valid) { this.saveLoading = false; return; }
                let str = []
          this.saveLoading = true;
          this.$refs.form.validate(async (valid) => {
            if (!valid) {
              this.saveLoading = false;
              return;
            }
            console.log('5');
            let str = [];
                str = this.assessmentTable.map(item => {
                    return item.selectedScore
                })
            console.log('6');
                try {
                    const params = {
                        isDraft: 1,
                        projectId: this.projectData[0].id,
                        experimentId: this.selectedMember[0].userId,
                        // experimentId: this.selectedMember[0].userId,
                        enclosureUrl: this.fileList.length && JSON.stringify(this.fileList),
                        // reportCode: this.form.reportCode,
                        reportContent: this.$refs.materialEditor.getContent(),
@@ -490,17 +576,21 @@
                        evaluate: str.join(','),
                        reportType: 3
                    };
                  console.log('7');
                    add(params).then(res => {
                        if (res.code == 200) {
                      console.log('8', res);
                      if (res.code == 200) {
                            this.$message.success('保存成功');
                            this.$router.back()
                        } else {
                          console.log('接口报错', res.msg);
                            this.$message.error(res.msg || '保存失败');
                        }
                    }).catch(() => {
                        this.$message.error('保存失败');
                    }).finally(() => {
                        this.saveLoading = false;
                      console.log('报错:')
                      this.saveLoading = false;
                    });
                } catch (e) {
                    this.$message.error('保存失败');
culture/src/views/strainReportLibrary/reportLibraryOneThree/index.vue
@@ -143,6 +143,8 @@
    },
    mounted() {
        this.getLists()
    },activated() {
        this.getLists()
    },
    methods: {
        viewEvaluate() {
culture/src/views/system/operation-log/index.vue
@@ -30,6 +30,9 @@
  created() {
    this.fetchData()
  },
  activated() {
    this.fetchData()
  },
  methods: {
    handleSizeChange(val) {
      this.queryForm.pageSize = val
culture/src/views/system/role/index.vue
@@ -65,6 +65,9 @@
  created() {
    this.getListData()
  },
  activated() {
    this.getListData()
  },
  mounted() { },
  methods: {
    add() {
culture/src/views/system/user/index.vue
@@ -131,6 +131,10 @@
    this.getRoleList()
    this.getListData()
  },
  activated() {
    this.getRoleList()
    this.getListData()
  },
  mounted() { },
  methods: {
    // getTypeList() {