| | |
| | | <!-- 顶部信息卡片 - 优化排版 --> |
| | | <el-card class="top-card" shadow="never"> |
| | | <el-row :gutter="24" class="top-info-row"> |
| | | <!-- 左列:菌种来源 + 编号 + 名称 --> |
| | | <el-col :span="9" class="info-col"> |
| | | <el-col :span="24" class="info-col source-col"> |
| | | <div class="info-item source-item"> |
| | | <span class="label">菌种来源:</span> |
| | | <el-tooltip |
| | |
| | | <span class="source-text">{{ detail.strainSource || '暂无数据' }}</span> |
| | | </el-tooltip> |
| | | </div> |
| | | </el-col> |
| | | |
| | | <el-col :span="8" class="info-col"> |
| | | <div class="info-item"> |
| | | <span class="label">鉴别菌株编号:</span> |
| | | <span class="value">{{ detail.identifyingStrainCode || '-' }}</span> |
| | |
| | | </div> |
| | | </el-col> |
| | | |
| | | <!-- 中列:验证信息 --> |
| | | <el-col :span="7" class="info-col"> |
| | | <el-col :span="8" class="info-col"> |
| | | <div class="info-item"> |
| | | <span class="label">验证实验编号:</span> |
| | | <span class="value">{{ detail.validationExperimentCode || '-' }}</span> |
| | |
| | | </div> |
| | | </el-col> |
| | | |
| | | <!-- 右列:签名 --> |
| | | <el-col :span="8" class="info-col sign-col"> |
| | | <div class="sign-wrapper"> |
| | | <div class="sign-label-text">菌种实验员签字</div> |
| | |
| | | .then(res => { |
| | | console.log('详情数据返回:', res) |
| | | |
| | | const data = res.data || res |
| | | |
| | | // 处理 purpose |
| | | let purposeArray = [] |
| | | if (res.purpose) { |
| | | if (typeof res.purpose === 'string') { |
| | | purposeArray = res.purpose.split(',').map(item => Number(item.trim())).filter(num => !isNaN(num)) |
| | | } else if (Array.isArray(res.purpose)) { |
| | | purposeArray = res.purpose |
| | | if (data.purpose) { |
| | | if (typeof data.purpose === 'string') { |
| | | purposeArray = data.purpose.split(',').map(item => Number(item.trim())).filter(num => !isNaN(num)) |
| | | } else if (Array.isArray(data.purpose)) { |
| | | purposeArray = data.purpose |
| | | } |
| | | } |
| | | |
| | | // 处理 tableData |
| | | const tableList = res.list && res.list.length > 0 ? res.list : this.initialTableData.map(item => ({ ...item })) |
| | | const tableList = data.list && data.list.length > 0 ? data.list : this.initialTableData.map(item => ({ ...item })) |
| | | |
| | | // 更新数据 |
| | | this.detail = { |
| | | ...res, |
| | | handleSignature: res.handleSignature || '', |
| | | purpose: purposeArray || [] |
| | | ...data, |
| | | handleSignature: data.handleSignature || '', |
| | | purpose: purposeArray |
| | | } |
| | | this.tableData = tableList |
| | | |
| | |
| | | handleSave() { |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | this.detail.list = this.tableData || [] |
| | | this.detail.purpose = this.detail.purpose.join(',') |
| | | this.detail.isDraft = 0 |
| | | confirm({ ...this.detail }).then(res => { |
| | | const payload = { |
| | | ...this.detail, |
| | | list: this.tableData || [], |
| | | purpose: (this.detail.purpose || []).join(','), |
| | | isDraft: 0 |
| | | } |
| | | confirm(payload).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('保存成功') |
| | | this.cacheForm = null |
| | | this.cacheFormtableData = null |
| | | this.$router.back() |
| | | this.$closeCurrentView('/strain/validation/primitive-cell') |
| | | } else { |
| | | this.$message.error(res.msg || '保存失败') |
| | | } |
| | |
| | | handleDraft() { |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | this.detail.list = this.tableData || [] |
| | | this.detail.purpose = this.detail.purpose.join(',') |
| | | const payload = { |
| | | ...this.detail, |
| | | list: this.tableData || [], |
| | | purpose: (this.detail.purpose || []).join(',') |
| | | } |
| | | |
| | | saveDraft({ ...this.detail }).then(res => { |
| | | saveDraft(payload).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('存稿成功') |
| | | this.cacheForm = null |
| | | this.cacheFormtableData = null |
| | | this.$router.back() |
| | | this.$closeCurrentView('/strain/validation/primitive-cell') |
| | | } else { |
| | | this.$message.error(res.msg || '存稿失败') |
| | | } |