From fd68873f292c7e42bf24039d99b96fa67238618c Mon Sep 17 00:00:00 2001 From: 董国庆 <364620639@qq.com> Date: 星期一, 26 五月 2025 13:47:23 +0800 Subject: [PATCH] Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/leshan-laboratory --- culture/src/views/pedigree-chart/components/AddSublevelPlan.vue | 103 ++++++++++++++++++++++++++------------------------- 1 files changed, 52 insertions(+), 51 deletions(-) diff --git a/culture/src/views/pedigree-chart/components/AddSublevelPlan.vue b/culture/src/views/pedigree-chart/components/AddSublevelPlan.vue index ca656c0..9e7e0bc 100644 --- a/culture/src/views/pedigree-chart/components/AddSublevelPlan.vue +++ b/culture/src/views/pedigree-chart/components/AddSublevelPlan.vue @@ -5,8 +5,8 @@ <el-form :model="planForm" :rules="planRules" ref="planForm" label-position="top"> <el-row :gutter="20"> <el-col :span="10"> - <el-form-item label="传代菌种编号" prop="strainNo"> - <el-input disabled v-model="planForm.strainNo"></el-input> + <el-form-item label="传代菌种编号" prop="strainCode"> + <el-input disabled v-model="planForm.strainCode"></el-input> </el-form-item> </el-col> <el-col :span="10"> @@ -29,8 +29,8 @@ <el-col :span="10"> <el-form-item label="保存/废弃"> <div class="flex-row"> - <div :class="planForm.isDiscarded && 'active'">保存</div> - <div :class="!planForm.isDiscarded && 'active'">废弃</div> + <div :class="planForm.isDiscarded && 'active'" @click="handleStatus('save')">保存</div> + <div :class="!planForm.isDiscarded && 'active'" >废弃</div> </div> </el-form-item> </el-col> @@ -44,18 +44,19 @@ </el-row> <el-row :gutter="20"> <el-col :span="10"> - <el-form-item label="传代计划数" prop="count"> - <el-input-number :disabled="planForm.status === 'detail'" v-model="planForm.count" + <el-form-item label="传代计划数" prop="generationCount"> + <el-input-number :disabled="planForm.status === 'detail'" v-model="planForm.generationCount" :controls="false" :min="1" placeholder="请输入" /> </el-form-item> </el-col> </el-row> </el-form> <div v-if="planForm.status !== 'detail'" class="dialog-footer"> - <el-button type="primary" @click="handleAddPlan">提交签字</el-button> + <el-button type="primary" @click="handleSubmit">提交签字</el-button> </div> </el-dialog> </template> + <script> export default { data() { @@ -63,9 +64,28 @@ planDialogVisible: false, planForm: { status: 'add', + strainCode: '', + strainName: '', + inoculateNo: '', + inoculateName: '', + generationCount: 1, + isDiscarded: true, + inTime: '' }, planRules: { - count: [ + strainCode: [ + { required: true, message: '请输入传代菌种编号', trigger: 'blur' } + ], + strainName: [ + { required: true, message: '请输入传代菌种名称', trigger: 'blur' } + ], + inoculateNo: [ + { required: true, message: '请输入接种菌种编号', trigger: 'blur' } + ], + inoculateName: [ + { required: true, message: '请输入接种菌种名称', trigger: 'blur' } + ], + generationCount: [ { required: true, message: '请输入传代计划数', trigger: 'blur' } ] } @@ -73,7 +93,10 @@ }, methods: { openInitData(value) { - this.planForm = value + this.planForm = { + ...this.planForm, + ...value + } this.openDialog() }, openDialog() { @@ -81,59 +104,37 @@ }, closeDialog() { this.planDialogVisible = false + // 重置表单数据 + this.planForm = { + status: 'add', + strainCode: '', + strainName: '', + inoculateNo: '', + inoculateName: '', + generationCount: 1, + isDiscarded: true, + inTime: '' + } + // 重置表单验证 + this.$refs.planForm && this.$refs.planForm.resetFields() }, - handleAddPlan() { + handleSubmit() { this.$refs.planForm.validate((valid) => { if (valid) { this.$emit('addNodeSign', this.planForm, 2) } }) + }, + handleStatus(status) { + if (this.planForm.status === 'detail') return + this.planForm.isDiscarded = status === 'save' + this.$forceUpdate() } } } </script> + <style scoped lang="less"> -.flex-row { - display: flex; - align-items: center; - flex-wrap: wrap; - - @media (max-width: 768px) { - flex-direction: column; - align-items: flex-start; - width: 100%; - } -} - -.input-wrapper { - @media (min-width: 769px) { - width: 290px; - min-width: 290px; - } - - @media (max-width: 768px) { - width: 100%; - } -} - -.fixed-width-input { - width: 100%; - - @media (min-width: 769px) { - width: 290px !important; - min-width: 290px !important; - } -} - -.form-text { - margin: 0 8px; - white-space: nowrap; - - @media (max-width: 768px) { - margin: 8px 0; - } -} - .dialog-footer { margin-top: 39px; display: flex; -- Gitblit v1.7.1