| | |
| | | </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"> |
| | |
| | | <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> |
| | |
| | | activated() { |
| | | if (this.cacheForm) { |
| | | this.form = this.cacheForm; |
| | | return; |
| | | } |
| | | |
| | | if (this.$route.query.id && !this.cacheForm) { |
| | | detail({ id: this.$route.query.id }).then(res => { |
| | | if (res) { |
| | | // 这里根据实际接口返回字段做适配 |
| | | this.form = res |
| | | this.projectData = res.tprojectTeamList |
| | | } |
| | | }) |
| | | } |
| | | if (this.$route.query.id) { |
| | | this.loadDetailData(); |
| | | } |
| | | }, |
| | | deactivated() { |
| | | this.cacheForm = JSON.parse(JSON.stringify(this.form)); |
| | |
| | | // 编辑 |
| | | edit({ ...submitData, id }).then(() => { |
| | | this.cacheForm = null |
| | | this.$router.back(); |
| | | this.$closeCurrentView('/strain/validation/primitive-cell'); |
| | | }); |
| | | } else { |
| | | // 新增 |
| | | add(submitData).then(() => { |
| | | this.cacheForm = null |
| | | this.$router.back(); |
| | | this.$closeCurrentView('/strain/validation/primitive-cell'); |
| | | }); |
| | | } |
| | | } else { |
| | | // 存草稿 |
| | | add(submitData).then(() => { |
| | | this.cacheForm = null |
| | | this.$router.back(); |
| | | this.$closeCurrentView('/strain/validation/primitive-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); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | .form-actions { |
| | | margin-top: 48px; |
| | | } |
| | | |
| | | .strain-form { |
| | | padding: 0 40px; |
| | | |