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/ParentForm.vue |  146 +++++++++++++++++++++++++++++++++++-------------
 1 files changed, 107 insertions(+), 39 deletions(-)

diff --git a/culture/src/views/pedigree-chart/components/ParentForm.vue b/culture/src/views/pedigree-chart/components/ParentForm.vue
index f997918..dc309c5 100644
--- a/culture/src/views/pedigree-chart/components/ParentForm.vue
+++ b/culture/src/views/pedigree-chart/components/ParentForm.vue
@@ -1,47 +1,38 @@
 <template>
     <!-- 新增母代弹窗 -->
-    <el-dialog :title="parentForm.status === 'detail' ? '母代详情' : '新增母代'" :visible.sync="addParentDialogVisible"
+    <el-dialog :title="planForm.status === 'detail' ? '母代详情' : '新增母代'" :visible.sync="planDialogVisible"
         width="40%" :close-on-click-modal="false">
-        <el-form :model="parentForm" ref="parentForm" label-position="top">
-            <el-form-item label="菌种源" prop="strainSourceStart">
-                <div class="flex-row">
-                    <div class="input-wrapper">
-                        <el-input disabled v-model="parentForm.strainSourceStart" class="fixed-width-input"></el-input>
-                    </div>
-                    <span class="form-text">代—</span>
-                    <div class="input-wrapper">
-                        <el-input disabled v-model="parentForm.strainSourceEnd" class="fixed-width-input"></el-input>
-                    </div>
-                    <span class="form-text">细胞库</span>
-                </div>
-            </el-form-item>
+        <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="parentForm.strainNo"></el-input>
+                <el-col :span="24">
+                    <el-form-item label="菌种源" prop="strainSourceStart">
+                        <div class="input-group">
+                            <div class="input-wrapper">
+                                <el-input disabled v-model="planForm.strainSourceStart" class="fixed-width-input"></el-input>
+                            </div>
+                            <span class="form-text">代—</span>
+                            <div class="input-wrapper">
+                                <el-input disabled v-model="planForm.strainSourceEnd" class="fixed-width-input"></el-input>
+                            </div>
+                            <span class="form-text">细胞库</span>
+                        </div>
                     </el-form-item>
                 </el-col>
                 <el-col :span="10">
-                    <el-form-item label="代传菌种名称" prop="strainName">
-                        <el-input disabled v-model="parentForm.strainName"></el-input>
-                    </el-form-item>
-                </el-col>
-            </el-row>
-            <el-row v-if="parentForm.status === 'detail'" :gutter="20">
-                <el-col :span="10">
-                    <el-form-item label="接种操作人签字">
-                        <el-image />
+                    <el-form-item label="传代菌种编号" prop="strainCode">
+                        <el-input disabled v-model="planForm.strainCode"></el-input>
                     </el-form-item>
                 </el-col>
                 <el-col :span="10">
-                    <el-form-item label="菌种保藏人签字">
-                        <el-image />
+                    <el-form-item label="传代菌种名称" prop="strainName">
+                        <el-input disabled v-model="planForm.strainName"></el-input>
                     </el-form-item>
                 </el-col>
+                
             </el-row>
         </el-form>
-        <div v-if="parentForm.status !== 'detail'" class="dialog-footer">
-            <el-button type="primary" @click="handleAddParent">提交</el-button>
+        <div v-if="planForm.status !== 'detail'" class="dialog-footer">
+            <el-button type="primary" @click="handleSubmit">提交</el-button>
         </div>
     </el-dialog>
 </template>
@@ -49,29 +40,73 @@
 export default {
     data() {
         return {
-            addParentDialogVisible: false,
-            parentForm: {},
+            planDialogVisible: false,
+            planForm: {
+                strainCode: '',
+                strainName: '',
+                strainSourceStart: '',
+                strainSourceEnd: '',
+                isDiscarded: true
+            },
+            planRules: {
+                strainCode: [
+                    { required: true, message: '请输入传代菌种编号', trigger: 'blur' }
+                ],
+                strainName: [
+                    { required: true, message: '请输入传代菌种名称', trigger: 'blur' }
+                ],
+                strainSourceStart: [
+                    { required: true, message: '请输入菌种源起始', trigger: 'blur' }
+                ],
+                strainSourceEnd: [
+                    { required: true, message: '请输入菌种源结束', trigger: 'blur' }
+                ]
+            }
         }
     },
     methods: {
         openInitData(value) {
-            this.parentForm = value
+            this.planForm = {
+                ...this.planForm,
+                ...value
+            }
             this.openDialog()
         },
         openDialog() {
-            this.addParentDialogVisible = true
+            this.planDialogVisible = true
         },
         closeDialog() {
-            this.addParentDialogVisible = false
+            this.planDialogVisible = false
+            // 重置表单数据
+            this.planForm = {
+                strainCode: '',
+                strainName: '',
+                strainSourceStart: '',
+                strainSourceEnd: '',
+                isDiscarded: true
+            }
+            // 重置表单验证
+            this.$refs.planForm && this.$refs.planForm.resetFields()
         },
-        handleAddParent() {
-            this.$emit('addNodeSign', this.parentForm, 1)
+        handleSubmit() {
+            this.$refs.planForm.validate((valid) => {
+                if (valid) {
+                    console.log(this.planForm,'22');
+                    
+                    this.$emit('addNodeSign', this.planForm, 1)
+                }
+            })
+        },
+        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;
@@ -113,7 +148,7 @@
 }
 
 .dialog-footer {
-    margin-top: 115px;
+    margin-top: 39px;
     display: flex;
     justify-content: center;
 
@@ -124,4 +159,37 @@
         border-radius: 4px;
     }
 }
+
+.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