From 0db8c9b94a9ac655549d5eba5c2a6c92ac386c06 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 08 十月 2026 11:20:56 +0800
Subject: [PATCH] 提交最新代码
---
culture/src/views/strain-library/validation/chief-cell/add.vue | 69 ++++++++++++++++++----------------
1 files changed, 37 insertions(+), 32 deletions(-)
diff --git a/culture/src/views/strain-library/validation/chief-cell/add.vue b/culture/src/views/strain-library/validation/chief-cell/add.vue
index e2382ef..4df9dad 100644
--- a/culture/src/views/strain-library/validation/chief-cell/add.vue
+++ b/culture/src/views/strain-library/validation/chief-cell/add.vue
@@ -26,8 +26,8 @@
</Table>
<el-form :model="form" :rules="rules" ref="strainForm" label-position="top" class="strain-form">
<div class="form-row">
- <el-form-item label="菌种来源" prop="strainSource">
- <el-input type="textarea" style="width:790px;" v-model="form.strainSource" placeholder="请输入" :rows="3"></el-input>
+ <el-form-item label="菌种来源" prop="strainSource" class="full-width">
+ <el-input type="textarea" v-model="form.strainSource" placeholder="请输入" :rows="3"></el-input>
</el-form-item>
</div>
<div class="form-row three-columns">
@@ -44,12 +44,12 @@
<el-input v-model="form.validationExperimentCode" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="实验时间" prop="experimentTime">
- <el-date-picker :prefix-icon="' '" style="width: 290px;" v-model="form.experimentTime" type="date"
+ <el-date-picker :prefix-icon="' '" style="width: 100%;" v-model="form.experimentTime" type="date"
placeholder="请选择实验时间"></el-date-picker>
</el-form-item>
<div class="form-item-placeholder"></div>
</div>
- <div class="end-btn" style="margin-top: 400px">
+ <div class="end-btn form-actions">
<el-button type="primary" @click="handleSubmit">提交</el-button>
<el-button @click="handleDraft" v-if="roleType != 1">存草稿</el-button>
</div>
@@ -103,25 +103,18 @@
}
}
},
- mounted() {
- if (this.$route.query.id) {
- detail({ id: this.$route.query.id }).then(res => {
- if (res) {
- // 这里根据实际接口返回字段做适配
- this.form = res
- this.projectData = res.tprojectTeamList
- }
- })
- }
+ activated() {
+ if (this.cacheForm) {
+ this.form = this.cacheForm;
+ return;
+ }
+
+ if (this.$route.query.id) {
+ this.loadDetailData();
+ }
},
deactivated() {
this.cacheForm = JSON.parse(JSON.stringify(this.form));
- },
-
- activated() {
- if (this.cacheForm) {
- this.form = this.cacheForm;
- }
},
methods: {
getProjectData(data) {
@@ -150,31 +143,39 @@
if (id) {
// 编辑
edit({ ...submitData, id }).then(() => {
- this.$router.back();
+ this.cacheForm = null
+ this.$closeCurrentView('/strain/validation/chief-cell');
});
} else {
// 新增
add(submitData).then(() => {
- this.$router.back();
+ this.cacheForm = null
+ this.$closeCurrentView('/strain/validation/chief-cell');
});
}
} else {
// 存草稿
add(submitData).then(() => {
- this.$router.back();
+ this.cacheForm = null
+ this.$closeCurrentView('/strain/validation/chief-cell');
});
}
},
- mounted() {
+ async loadDetailData() {
const id = this.$route.query.id || this.$route.params.id;
- if (id) {
- // 编辑或详情回显
- detail({ id }).then(res => {
- if (res && res.data) {
- // 这里根据实际接口返回字段做适配
- Object.assign(this.form, res.data);
- }
- });
+ try {
+ const res = await detail({ id });
+ if (!res || !res.id) {
+ throw new Error('未获取到验证资料详情');
+ }
+ this.form = { ...this.form, ...res };
+ this.projectData = Array.isArray(res.tprojectTeamList) ? res.tprojectTeamList : [];
+ } catch (error) {
+ console.error('获取母代菌种库验证资料失败:', error);
+ const message = error instanceof Error && error.message
+ ? error.message
+ : '获取编辑数据失败,请返回列表后重试';
+ this.$message.error(message);
}
}
}
@@ -226,6 +227,10 @@
}
}
+.form-actions {
+ margin-top: 48px;
+}
+
.strain-form {
padding: 0 40px;
--
Gitblit v1.7.1