董国庆
2025-05-26 fd68873f292c7e42bf24039d99b96fa67238618c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<template>
    <!-- 新增母代弹窗 -->
    <el-dialog :title="planForm.status === 'detail' ? '母代详情' : '新增母代'" :visible.sync="planDialogVisible"
        width="40%" :close-on-click-modal="false">
        <el-form :model="planForm" :rules="planRules" ref="planForm" label-position="top">
            <el-row :gutter="20">
                <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="strainCode">
                        <el-input disabled v-model="planForm.strainCode"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="10">
                    <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="planForm.status !== 'detail'" class="dialog-footer">
            <el-button type="primary" @click="handleSubmit">提交</el-button>
        </div>
    </el-dialog>
</template>
<script>
export default {
    data() {
        return {
            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.planForm = {
                ...this.planForm,
                ...value
            }
            this.openDialog()
        },
        openDialog() {
            this.planDialogVisible = true
        },
        closeDialog() {
            this.planDialogVisible = false
            // 重置表单数据
            this.planForm = {
                strainCode: '',
                strainName: '',
                strainSourceStart: '',
                strainSourceEnd: '',
                isDiscarded: true
            }
            // 重置表单验证
            this.$refs.planForm && this.$refs.planForm.resetFields()
        },
        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">
.input-group {
    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;
    justify-content: center;
 
    .el-button--primary {
        width: 150px;
        height: 40px;
        background: #049C9A;
        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>