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/PlanForm.vue |   91 ++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 80 insertions(+), 11 deletions(-)

diff --git a/culture/src/views/pedigree-chart/components/PlanForm.vue b/culture/src/views/pedigree-chart/components/PlanForm.vue
index df58249..9f834cd 100644
--- a/culture/src/views/pedigree-chart/components/PlanForm.vue
+++ b/culture/src/views/pedigree-chart/components/PlanForm.vue
@@ -4,7 +4,7 @@
         width="40%" :close-on-click-modal="false">
         <el-form :model="planForm" :rules="planRules" ref="planForm" label-position="top">
             <el-form-item label="菌种源" prop="strainSourceStart">
-                <div class="flex-row">
+                <div class="input-group">
                     <div class="input-wrapper">
                         <el-input disabled v-model="planForm.strainSourceStart" class="fixed-width-input"></el-input>
                     </div>
@@ -17,8 +17,8 @@
             </el-form-item>
             <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">
@@ -27,26 +27,41 @@
                     </el-form-item>
                 </el-col>
                 <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() {
         return {
             planDialogVisible: false,
-            planForm: {},
+            planForm: {
+                status: 'add',
+                strainCode: '',
+                strainName: '',
+                strainSourceStart: '',
+                strainSourceEnd: '',
+                generationCount: '',
+                isDiscarded: true
+            },
             planRules: {
-                count: [
+                strainCode: [
+                    { required: true, message: '请输入传代菌种编号', trigger: 'blur' }
+                ],
+                strainName: [
+                    { required: true, message: '请输入传代菌种名称', trigger: 'blur' }
+                ],
+                generationCount: [
                     { required: true, message: '请输入传代计划数', trigger: 'blur' }
                 ]
             }
@@ -54,7 +69,10 @@
     },
     methods: {
         openInitData(value) {
-            this.planForm = value
+            this.planForm = {
+                ...this.planForm,
+                ...value
+            }
             this.openDialog()
         },
         openDialog() {
@@ -62,19 +80,37 @@
         },
         closeDialog() {
             this.planDialogVisible = false
+            // 重置表单数据
+            this.planForm = {
+                status: 'add',
+                strainCode: '',
+                strainName: '',
+                strainSourceStart: '',
+                strainSourceEnd: '',
+                generationCount: '',
+                isDiscarded: true
+            }
+            // 重置表单验证
+            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 {
+.input-group {
     display: flex;
     align-items: center;
     flex-wrap: wrap;
@@ -135,4 +171,37 @@
 .el-input-number--small {
     width: 100%;
 }
+
+.flex-row {
+    width: 370px;
+    display: flex;
+    align-items: center;
+    font-size: 16px;
+    color: #333333;
+    padding: 4px;
+    border-radius: 10px;
+    border: 2px solid rgba(4, 156, 154, 0.5);
+    font-family: 'PingFangSCRegular';
+
+    .flex-row-save {
+        background: #049C9A;
+        color: #fff;
+    }
+
+    div {
+        width: 183px;
+        height: 32px;
+        text-align: center;
+        flex-shrink: 0;
+        cursor: pointer;
+    }
+
+    .active {
+        font-family: 'SourceHanSansCN-Medium';
+        color: #049C9A;
+        background: #EBFEFD;
+        box-shadow: 0px 0px 6px 0px rgba(10, 109, 108, 0.25);
+        border-radius: 10px;
+    }
+}
 </style>
\ No newline at end of file

--
Gitblit v1.7.1