<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>
|