<template>
|
<Card class="confirm-detail-page">
|
<el-card class="top-card">
|
<el-row :gutter="24" class="top-info-row">
|
<el-col :span="8" class="info-col">
|
<div class="info-item"><span class="label">菌种来源:</span>{{ detail.strainSource }}</div>
|
<div class="info-item"><span class="label">鉴别菌株编号:</span>{{ detail.identifyingStrainCode }}</div>
|
<div class="info-item"><span class="label">鉴别菌株名称:</span>{{ detail.identifyingStrainName }}</div>
|
</el-col>
|
<el-col :span="8" class="info-col">
|
<div class="info-item"><span class="label">验证实验编号:</span>{{ detail.validationExperimentCode }}</div>
|
<div class="info-item"><span class="label">实验时间:</span>{{ detail.experimentTime | formatDate }}</div>
|
<div class="info-item"></div>
|
</el-col>
|
<el-col :span="8" class="info-col ">
|
<div class="info-item sign-label"><span class="label">菌种实验员签字</span></div>
|
<div class="info-item signature-item">
|
<div class="signature-area">
|
<img v-if="detail.handleSignature" :src="detail.handleSignature" alt="签字" />
|
<span v-else class="waiting-text">暂无签名</span>
|
</div>
|
</div>
|
</el-col>
|
</el-row>
|
</el-card>
|
<div class="section-card" style="margin-top: 24px;">
|
<el-form ref="form" label-width="100px" :model="detail" :rules="rules" label-position="top">
|
<el-form-item label="实验结论" prop="result">
|
<el-input type="textarea" v-model="detail.result" :rows="3" placeholder="请输入" />
|
</el-form-item>
|
<el-form-item label="批准菌株用途" prop="purpose">
|
<el-checkbox-group v-model="detail.purpose">
|
<el-checkbox :label="1">传代</el-checkbox>
|
<el-checkbox :label="2">菌种保藏</el-checkbox>
|
<el-checkbox :label="3">废弃</el-checkbox>
|
</el-checkbox-group>
|
</el-form-item>
|
</el-form>
|
</div>
|
<el-button type="primary" @click="handleAdd" class="el-icon-plus"> 新增</el-button>
|
<EditConditionDialog
|
:visible.sync="dialogVisible"
|
:isEdit="dialogIsEdit"
|
:isFixed="dialogIsFixed"
|
:value="dialogValue"
|
@ok="handleDialogOk"
|
/>
|
|
<div class="section-card" style="margin-top: 12px;">
|
<el-table :data="tableData" border style="width: 100%;" :row-class-name="getRowClassName">
|
<el-table-column prop="conditions" label="菌种培养工艺条件" />
|
<el-table-column prop="record" label="菌种培养工艺实况记录" />
|
<el-table-column prop="workmanship" label="菌种培养标准工艺" />
|
<el-table-column label="操作" width="120">
|
<template #default="{ row }">
|
<el-button type="text" @click="handleEdit(row)">编辑</el-button>
|
<el-button type="text" @click="handleEdit(row)">详情</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<div class="footer-btns">
|
<el-button type="primary" @click="handleSave">保存</el-button>
|
<el-button @click="handleDraft">存稿</el-button>
|
</div>
|
<!-- <DetailConditionDialog
|
:visible.sync="detailDialogVisible"
|
:value="detailDialogValue"
|
/> -->
|
</Card>
|
</template>
|
|
<script>
|
import EditConditionDialog from './EditConditionDialog.vue'
|
import DetailConditionDialog from './DetailConditionDialog.vue'
|
import { detail,confirm } from './service'
|
import moment from 'moment'
|
export default {
|
name: 'ConfirmDetail',
|
components: { EditConditionDialog, DetailConditionDialog },
|
data() {
|
return {
|
detail: {
|
strainSource: '',
|
identifyingStrainCode: '',
|
identifyingStrainName: '',
|
validationExperimentCode: '',
|
experimentTime: '',
|
handleSignature: '', // 签名图片url
|
result:'',
|
purpose: []
|
},
|
activeTab: 'conditions',
|
rules: {
|
result: [
|
{ required: true, message: '请输入实验结论', trigger: 'blur' }
|
],
|
purpose: [
|
{ required: true, message: '请选择菌种用途', trigger: 'change' }
|
]
|
},
|
initialTableData: [
|
{ conditions: '平板培养基', record: '', workmanship: '' },
|
{ conditions: '培养温度', record: '', workmanship: '' },
|
{ conditions: '培养时间', record: '', workmanship: '' },
|
{ conditions: '摇瓶培养基', record: '', workmanship: '' },
|
{ conditions: '接种量', record: '', workmanship: '' },
|
{ conditions: '培养时间', record: '', workmanship: '' },
|
{ conditions: '发酵时间', record: '', workmanship: '' },
|
{ conditions: '检测数据及结果', record: '', workmanship: '' }
|
],
|
tableData: [
|
{ conditions: '平板培养基', record: '', workmanship: '' },
|
{ conditions: '培养温度', record: '', workmanship: '' },
|
{ conditions: '培养时间', record: '', workmanship: '' },
|
{ conditions: '摇瓶培养基', record: '', workmanship: '' },
|
{ conditions: '接种量', record: '', workmanship: '' },
|
{ conditions: '培养时间', record: '', workmanship: '' },
|
{ conditions: '发酵时间', record: '', workmanship: '' },
|
{ conditions: '检测数据及结果', record: '', workmanship: '' }
|
],
|
dialogVisible: false,
|
dialogIsEdit: false,
|
dialogIsFixed: false,
|
dialogValue: {},
|
dialogIndex: null,
|
detailDialogVisible: false,
|
detailDialogValue: {}
|
}
|
},
|
filters: {
|
formatDate(date) {
|
if(date){
|
return moment(date).format('YYYY-MM-DD')
|
}else{
|
return ''
|
}
|
},
|
},
|
mounted() {
|
this.getDetail()
|
},
|
methods: {
|
getDetail() {
|
detail({id: this.$route.query.id}).then(res => {
|
this.detail = {
|
...res,
|
handleSignature: res.handleSignature || '', // 处理签名为空的情况
|
purpose: res.purpose || [] // 处理 purpose 为空的情况
|
}
|
})
|
},
|
handleAdd() {
|
this.dialogVisible = true
|
this.dialogIsEdit = false
|
this.dialogIsFixed = false
|
this.dialogValue = {}
|
this.dialogIndex = null
|
},
|
handleEdit(row) {
|
const idx = this.tableData.indexOf(row)
|
this.dialogVisible = true
|
this.dialogIsEdit = true
|
this.dialogIsFixed = idx < this.initialTableData?.length
|
this.dialogValue = { ...row }
|
this.dialogIndex = idx
|
},
|
handleDetail(row) {
|
this.detailDialogVisible = true
|
this.detailDialogValue = { ...row }
|
},
|
handleSave() {
|
this.$refs.form.validate((valid) => {
|
if (valid) {
|
this.detail.list = this.tableData || []
|
this.detail.purpose = this.detail.purpose.join(',')
|
confirm({...this.detail}).then(res => {
|
if (res.code == 200) {
|
this.$message.success('保存成功');
|
this.$router.back()
|
} else {
|
this.$message.error(res.msg);
|
}
|
})
|
} else {
|
this.$message.error('请填写必填项');
|
return false;
|
}
|
});
|
},
|
handleDraft() {
|
// 存稿逻辑
|
},
|
handleDialogOk(val) {
|
if (this.dialogIsEdit && this.dialogIndex !== null) {
|
this.$set(this.tableData, this.dialogIndex, val)
|
} else {
|
this.tableData.push(val)
|
}
|
},
|
getRowClassName({ rowIndex }) {
|
return rowIndex < this.initialTableData?.length ? 'fixed-row' : '';
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="less">
|
.top-card {
|
margin-bottom: 0;
|
background: rgba(239, 239, 239, 1);
|
border-radius: 16px;
|
}
|
|
.top-info-row {
|
align-items: stretch;
|
}
|
|
.info-col {
|
display: flex;
|
flex-direction: column;
|
|
}
|
|
.info-item {
|
display: flex;
|
font-size: 15px;
|
height: 45px;
|
line-height: 45px;
|
}
|
|
.label {
|
color: #666;
|
font-weight: 500;
|
}
|
|
.sign-col {
|
align-items: center;
|
text-align: center;
|
}
|
|
.sign-label {
|
justify-content: center;
|
}
|
|
.signature-item {
|
justify-content: center;
|
}
|
|
.signature-area {
|
min-height: 80px;
|
min-width: 120px;
|
background: #f5f7fa;
|
border: 1px solid #dcdfe6;
|
border-radius: 4px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
margin-top: 8px;
|
}
|
|
.signature-area img {
|
max-width: 100%;
|
max-height: 100%;
|
display: block;
|
}
|
|
.waiting-text {
|
color: #909399;
|
font-size: 14px;
|
}
|
|
.sign-time {
|
justify-content: center;
|
text-align: center;
|
color: #666;
|
font-size: 14px;
|
}
|
|
.section-card {
|
margin-bottom: 0;
|
}
|
|
.footer-btns {
|
display: flex;
|
justify-content: center;
|
padding: 24px;
|
padding-bottom: 0;
|
gap: 24px;
|
.el-button {
|
width: 150px;
|
}
|
}
|
|
::v-deep(.fixed-row) {
|
background-color: rgb(228, 248, 250) !important;
|
}
|
|
@media (max-width: 900px) {
|
.info-col {
|
height: auto;
|
}
|
}
|
</style>
|