|
|
|
@ -2,7 +2,8 @@ |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div class="detail-container"> |
|
|
|
<div class="detail-title"><img src="@/assets/images/detail-title.png">{{ getTemplateName() }}<img src="@/assets/images/detail-title.png" /></div> |
|
|
|
<div class="detail-title"><img src="@/assets/images/detail-title.png">{{ getTemplateName() }}<img |
|
|
|
src="@/assets/images/detail-title.png" /></div> |
|
|
|
<div class="detail-content"> |
|
|
|
<div class="content"> |
|
|
|
<BaseInfoFormPackage label="试验基本信息" ref="baseInfoRef" :formConfig="baseInfoFormConfig" |
|
|
|
@ -30,11 +31,15 @@ |
|
|
|
:ref="`ladderStepFormPackageRef_${ladderIndex}`" :formConfig="ladderStepFormConfig" |
|
|
|
@blur="onHandleBlur" :formData="ladderConfig" fieldItemLabel="阶梯配制" |
|
|
|
:prefixKey="'ladder_' + ladderIndex" /> |
|
|
|
<CustomTable @blur="(e)=>onHandleTableBlur('ladder', ladderIndex,e)" :ref="`ladderStepTableRef_${ladderIndex}`" |
|
|
|
:columns="ladderStepColumns" :formData="ladderConfig" :prefixKey="'ladder_' + ladderIndex" |
|
|
|
fieldItemLabel="阶梯配制"> |
|
|
|
<CustomTable @blur="(e) => onHandleTableBlur('ladder', ladderIndex, e)" |
|
|
|
:ref="`ladderStepTableRef_${ladderIndex}`" :columns="ladderStepColumns" |
|
|
|
:formData="ladderConfig" :prefixKey="'ladder_' + ladderIndex" fieldItemLabel="阶梯配制"> |
|
|
|
<template slot="operation" slot-scope="{ row, rowIndex, columns }"> |
|
|
|
<TableOpertaion @printTag="(e) => printTag(e,'ladderConfigs',ladderIndex)" :fillType="fillType" :row="row" :rowIndex="rowIndex" :columns="columns" |
|
|
|
<TableOpertaion @printTag="(e) => printTag(e, 'ladderConfigs', ladderIndex)" |
|
|
|
@startConfig="(val) => startConfig(val, 'ladderConfigs', ladderIndex)" |
|
|
|
@configComplete="(val) => configComplete(val, 'ladderConfigs', ladderIndex)" |
|
|
|
@subPackageSubmit="(val) => subPackageSubmit(val, 'ladderConfigs', ladderIndex)" |
|
|
|
:fillType="fillType" :row="row" :rowIndex="rowIndex" :columns="columns" |
|
|
|
@deleteRow="(rowIndex) => deleteRow(rowIndex, 'ladder', ladderIndex)"> |
|
|
|
</TableOpertaion> |
|
|
|
</template> |
|
|
|
@ -60,12 +65,15 @@ |
|
|
|
:ref="`paralleStepFormPackageRef_${paralleIndex}`" :formConfig="paralleStepFormConfig" |
|
|
|
@blur="onHandleBlur" :formData="paralleConfig" :prefixKey="'paralle' + paralleIndex" |
|
|
|
fieldItemLabel="平行配制" /> |
|
|
|
<CustomTable @blur="(e)=>onHandleTableBlur('paralle', paralleIndex,e)" :ref="`paralleStepTableRef_${paralleIndex}`" |
|
|
|
:columns="paralleStepColumns" :formData="paralleConfig" |
|
|
|
@clickable="(col,rowIndex) => handleTableClickable('paralle', paralleIndex, col,rowIndex)" |
|
|
|
:prefixKey="'paralle' + paralleIndex" fieldItemLabel="平行配制"> |
|
|
|
<CustomTable @blur="(e) => onHandleTableBlur('paralle', paralleIndex, e)" |
|
|
|
:ref="`paralleStepTableRef_${paralleIndex}`" :columns="paralleStepColumns" |
|
|
|
:formData="paralleConfig" :prefixKey="'paralle' + paralleIndex" fieldItemLabel="平行配制"> |
|
|
|
<template slot="operation" slot-scope="{ row, rowIndex, columns }"> |
|
|
|
<TableOpertaion @printTag="(e) => printTag(e,'paralleConfigs',paralleIndex)" :fillType="fillType" :row="row" :rowIndex="rowIndex" :columns="columns" |
|
|
|
<TableOpertaion @printTag="(e) => printTag(e, 'paralleConfigs', paralleIndex)" |
|
|
|
@startConfig="(val) => startConfig(val, 'paralleConfigs', paralleIndex)" |
|
|
|
@configComplete="(val) => configComplete(val, 'paralleConfigs', paralleIndex)" |
|
|
|
@subPackageSubmit="(val) => subPackageSubmit(val, 'paralleConfigs', paralleIndex)" |
|
|
|
:fillType="fillType" :row="row" :rowIndex="rowIndex" :columns="columns" |
|
|
|
@deleteRow="(rowIndex) => deleteRow(rowIndex, 'paralle', paralleIndex)"> |
|
|
|
</TableOpertaion> |
|
|
|
</template> |
|
|
|
@ -82,8 +90,7 @@ |
|
|
|
</div> |
|
|
|
<!-- <button @click="onSave">保存</button> --> |
|
|
|
</div> |
|
|
|
<SelectReagentDialog @submit="onSelectReagentSubmit" |
|
|
|
ref="selectReagentDialogRef"> |
|
|
|
<SelectReagentDialog @submit="onSelectReagentSubmit" ref="selectReagentDialogRef"> |
|
|
|
</SelectReagentDialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
@ -98,7 +105,7 @@ import templateMixin from "../../mixins/templateMixin"; |
|
|
|
import CustomTable from '@/components/Template/CustomTable.vue'; |
|
|
|
import SelectReagentDialog from '../../dialog/SelectReagentDialog.vue'; |
|
|
|
import TableOpertaion from "@/components/Template/operation/TableOpertaion.vue"; |
|
|
|
import {getExpireDate} from "@/utils/index.js"; |
|
|
|
import { getExpireDate } from "@/utils/index.js"; |
|
|
|
import moment from "moment"; |
|
|
|
import { getLadderColumnsConfig, getParallelColumnsConfig, getLadderFormConfig, getBaseInfoFormConfig, getRemarkFormConfig, getStorageConditionFormConfig, getParalleStepFormConfig } from "../../formConfig/paralleAndLadderConfig.js"; |
|
|
|
export default { |
|
|
|
@ -125,7 +132,7 @@ export default { |
|
|
|
formData: { |
|
|
|
immediate: true, |
|
|
|
handler(v) { |
|
|
|
if(v &&this.fillType === "actFill"){ |
|
|
|
if (v && this.fillType === "actFill") { |
|
|
|
this.handleUpdateCode(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -168,94 +175,115 @@ export default { |
|
|
|
dataSource: [], |
|
|
|
currentTableIndex: "",//当前点击的表格索引 |
|
|
|
currentTableKey: "",//当前点击的表格key |
|
|
|
targetAcSolutionFromTable:true,//是否从表格中获取实际原始溶液浓度 |
|
|
|
targetAcSolutionFromTable: true,//是否从表格中获取实际原始溶液浓度 |
|
|
|
}; |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getTemplateName(){ |
|
|
|
if(this.templateData.templateMc){ |
|
|
|
methods: { |
|
|
|
subPackageSubmit(val, configType, index) { |
|
|
|
// const { rowData } = val; |
|
|
|
// let postData = { |
|
|
|
// bh: rowData.targetSolutionCode + rowData.subTargetSolutionCode, |
|
|
|
// } |
|
|
|
// this.startConfigRequest(postData); |
|
|
|
}, |
|
|
|
configComplete(val) { |
|
|
|
const { rowData, headerSelectFields } = val; |
|
|
|
//计算实际目标溶液体积(实际起始溶液体积+实际稀释液体积) |
|
|
|
const { total, unit } = addTj([rowData.actStartSolutionVolume, rowData.actDiluentVolume], [headerSelectFields.actStartSolutionVolumeUnit, headerSelectFields.actDiluentVolumeUnit]) |
|
|
|
let postData = { |
|
|
|
mc: null, |
|
|
|
bh: rowData.targetSolutionCode + rowData.subTargetSolutionCode, |
|
|
|
nd: rowData.actSolutionConcentration,//实际目标溶液浓度 |
|
|
|
nddw: headerSelectFields.actSolutionConcentrationUnit, |
|
|
|
kc: total, |
|
|
|
kcdw: unit, |
|
|
|
} |
|
|
|
this.configCompleteRequest(postData); |
|
|
|
}, |
|
|
|
getTemplateName() { |
|
|
|
if (this.templateData.templateMc) { |
|
|
|
return this.templateData.templateMc |
|
|
|
} |
|
|
|
const o = { |
|
|
|
"SP004":"生物样品内标工作液制备表", |
|
|
|
"SP005":"生物样品质控工作液制备表", |
|
|
|
"SP006":"生物样品标准曲线/质控样品制备表", |
|
|
|
"SP004": "生物样品内标工作液制备表", |
|
|
|
"SP005": "生物样品质控工作液制备表", |
|
|
|
"SP006": "生物样品标准曲线/质控样品制备表", |
|
|
|
} |
|
|
|
return o[this.sn]; |
|
|
|
}, |
|
|
|
//标签打印 |
|
|
|
printTag(e,configType,index){ |
|
|
|
printTag(e, configType, index) { |
|
|
|
const { nickName, name } = this.$store.getters; |
|
|
|
const {printCode,row,type} = e; |
|
|
|
const { printCode, row, type } = e; |
|
|
|
const currentForm = this.formData[configType][index]; |
|
|
|
const {stepStorageCondition,startDate,expireDate,paralleStepStorageCondition} = currentForm; |
|
|
|
const { stepStorageCondition, startDate, expireDate, paralleStepStorageCondition } = currentForm; |
|
|
|
const targetSolutionExpirationDate = row.targetSolutionExpirationDate; |
|
|
|
const lang = this.$i18n.locale; |
|
|
|
const printConfig = { |
|
|
|
"品名":"暂时还不知道品名是哪个字段", |
|
|
|
"存储条件":stepStorageCondition || paralleStepStorageCondition, |
|
|
|
"配制日期":moment(startDate).format("YYYY-MM-DD"), |
|
|
|
"有效期至":moment(targetSolutionExpirationDate || expireDate).format("YYYY-MM-DD HH:mm"), |
|
|
|
"配置者":lang === "zh_CN" ? nickName : name, |
|
|
|
"品名": "暂时还不知道品名是哪个字段", |
|
|
|
"存储条件": stepStorageCondition || paralleStepStorageCondition, |
|
|
|
"配制日期": moment(startDate).format("YYYY-MM-DD"), |
|
|
|
"有效期至": moment(targetSolutionExpirationDate || expireDate).format("YYYY-MM-DD HH:mm"), |
|
|
|
"配置者": lang === "zh_CN" ? nickName : name, |
|
|
|
//type==="subPackage"从分装打印过来的, |
|
|
|
//type==="row" 从列表上点过来的 |
|
|
|
"编号":type === "subPackage" ? printCode : (row.targetSolutionCode+row.subTargetSolutionCode), |
|
|
|
"编号": type === "subPackage" ? printCode : (row.targetSolutionCode + row.subTargetSolutionCode), |
|
|
|
} |
|
|
|
console.log(printConfig, "printConfig") |
|
|
|
EventBus.$emit('showTagPrintDialog', {printConfig}) |
|
|
|
EventBus.$emit('showTagPrintDialog', { printConfig }) |
|
|
|
}, |
|
|
|
// 为指定的表单数据数组分配编号 |
|
|
|
async assignNumbersToTableData(config) { |
|
|
|
const configs = this.formData[config] |
|
|
|
const {startDate} = this.formData; |
|
|
|
const { startDate } = this.formData; |
|
|
|
// 检查paralleConfigs中的paralleTableFormData数组 |
|
|
|
if (configs && configs.length > 0) { |
|
|
|
for (let i = 0; i < configs.length; i++) { |
|
|
|
const ref = config === "paralleConfigs" ? `paralleStepTableRef_${i}` : `ladderStepTableRef_${i}`; |
|
|
|
const {stepTableFormData = [], effectivePeriod, effectivePeriodUnit,expireDate} = configs[i]; |
|
|
|
if(!expireDate && config === "ladderConfigs"){ |
|
|
|
const { stepTableFormData = [], effectivePeriod, effectivePeriodUnit, expireDate } = configs[i]; |
|
|
|
if (!expireDate && config === "ladderConfigs") { |
|
|
|
const date = getExpireDate(startDate, effectivePeriod, effectivePeriodUnit); |
|
|
|
configs[i].expireDate = date; |
|
|
|
} |
|
|
|
if (stepTableFormData && stepTableFormData.length > 0) { |
|
|
|
const tableDataArray = stepTableFormData; |
|
|
|
// 检查表单数据中是否有任何一行的subTargetSolutionCode有值 |
|
|
|
const hasAnyWithValue = tableDataArray.some(row => |
|
|
|
row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== ''); |
|
|
|
// 如果没有任何一行有值,则为所有行分配编号 |
|
|
|
if (!hasAnyWithValue) { |
|
|
|
const length = tableDataArray.length; |
|
|
|
const snList = await this.getLatestSn(length); |
|
|
|
tableDataArray.forEach((row, idx) => { |
|
|
|
let expDate = {}; |
|
|
|
if(config === "paralleConfigs" && !row.targetSolutionExpirationDate){ |
|
|
|
let date = getExpireDate(startDate, row.targetSolutionCycle, row.targetSolutionCyclePrecision); |
|
|
|
expDate = { |
|
|
|
targetSolutionExpirationDate: date |
|
|
|
} |
|
|
|
const tableDataArray = stepTableFormData; |
|
|
|
// 检查表单数据中是否有任何一行的subTargetSolutionCode有值 |
|
|
|
const hasAnyWithValue = tableDataArray.some(row => |
|
|
|
row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== ''); |
|
|
|
// 如果没有任何一行有值,则为所有行分配编号 |
|
|
|
if (!hasAnyWithValue) { |
|
|
|
const length = tableDataArray.length; |
|
|
|
const snList = await this.getLatestSn(length); |
|
|
|
tableDataArray.forEach((row, idx) => { |
|
|
|
let expDate = {}; |
|
|
|
if (config === "paralleConfigs" && !row.targetSolutionExpirationDate) { |
|
|
|
let date = getExpireDate(startDate, row.targetSolutionCycle, row.targetSolutionCyclePrecision); |
|
|
|
expDate = { |
|
|
|
targetSolutionExpirationDate: date |
|
|
|
} |
|
|
|
this.$refs[ref][0]?.updateDataSourceByRowIndex(idx,{subTargetSolutionCode:snList[idx],...expDate}); |
|
|
|
}); |
|
|
|
Promise.resolve(); |
|
|
|
} |
|
|
|
} |
|
|
|
this.$refs[ref][0]?.updateDataSourceByRowIndex(idx, { subTargetSolutionCode: snList[idx], ...expDate }); |
|
|
|
}); |
|
|
|
Promise.resolve(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
async handleUpdateCode() { |
|
|
|
Promise.all([this.assignNumbersToTableData("ladderConfigs"),this.assignNumbersToTableData("paralleConfigs") |
|
|
|
]).then(()=>{ |
|
|
|
Promise.all([this.assignNumbersToTableData("ladderConfigs"), this.assignNumbersToTableData("paralleConfigs") |
|
|
|
]).then(() => { |
|
|
|
console.log("nextTick") |
|
|
|
//通知后端保存数据 |
|
|
|
const params = { |
|
|
|
type: "fieldChanged", |
|
|
|
newRecord: null, |
|
|
|
resourceList: null, |
|
|
|
} |
|
|
|
type: "fieldChanged", |
|
|
|
newRecord: null, |
|
|
|
resourceList: null, |
|
|
|
} |
|
|
|
EventBus.$emit('onModifyRecord', params,) |
|
|
|
}) |
|
|
|
}, |
|
|
|
@ -321,37 +349,37 @@ export default { |
|
|
|
|
|
|
|
// 表格失去焦点事件 |
|
|
|
onHandleTableBlur(type, configIndex, e) { |
|
|
|
const { colKey = "",item } = e; |
|
|
|
const { colKey = "", item } = e; |
|
|
|
if (colKey === "targetStartSolutionConcentration" || colKey === "targetSolutionVolume" || colKey === "targetSolutionConcentration" || colKey === "targetStartSolutionVolumePrecision" || colKey === "targetDiluentVolumePrecision") { |
|
|
|
if(type === "ladder"){ |
|
|
|
if (type === "ladder") { |
|
|
|
const volume = this.$refs[`ladderStepFormPackageRef_${configIndex}`][0]?.getFormDataByKey("targetStartSolution") || 0; |
|
|
|
if (volume) { |
|
|
|
this.updateTargetStartSolutionVolume(item, volume); |
|
|
|
} |
|
|
|
}else if(type === "paralle"){ |
|
|
|
} else if (type === "paralle") { |
|
|
|
const volumne = item.targetStartSolutionConcentration || 0; |
|
|
|
if (volumne) { |
|
|
|
this.updateTargetStartSolutionVolume(item, volumne); |
|
|
|
} |
|
|
|
} |
|
|
|
}else if(colKey === "actStartSolutionVolume" || colKey === "actDiluentVolume"){//实际起始溶液体积和实际目标溶液体积 |
|
|
|
if(type === "ladder"){ |
|
|
|
} else if (colKey === "actStartSolutionVolume" || colKey === "actDiluentVolume") {//实际起始溶液体积和实际目标溶液体积 |
|
|
|
if (type === "ladder") { |
|
|
|
const targetAcSolution = this.$refs[`ladderStepFormPackageRef_${configIndex}`][0]?.getFormDataByKey("targetAcSolution") || 0;//获取实际起始溶液浓度 |
|
|
|
if(targetAcSolution){ |
|
|
|
this.updateSjmbrynd(item,targetAcSolution); |
|
|
|
if (targetAcSolution) { |
|
|
|
this.updateSjmbrynd(item, targetAcSolution); |
|
|
|
} |
|
|
|
}else if(type === "paralle"){ |
|
|
|
} else if (type === "paralle") { |
|
|
|
const targetAcSolution = item.targetAcSolution || 0;//获取实际起始溶液浓度 |
|
|
|
if(targetAcSolution){ |
|
|
|
this.updateSjmbrynd(item,targetAcSolution); |
|
|
|
if (targetAcSolution) { |
|
|
|
this.updateSjmbrynd(item, targetAcSolution); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
//表格点击事件 |
|
|
|
handleTableClickable(type, rowIndex, col,tableRowIndex) { |
|
|
|
if(col.prop === "actStartSolutionCode"){//实际原始溶液编号点击事件 |
|
|
|
handleTableClickable(type, rowIndex, col, tableRowIndex) { |
|
|
|
if (col.prop === "actStartSolutionCode") {//实际原始溶液编号点击事件 |
|
|
|
this.currentTableKey = col.prop; |
|
|
|
this.currentType = type; |
|
|
|
this.currentRowIndex = rowIndex; |
|
|
|
@ -374,26 +402,26 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
//选择试剂提交事件 |
|
|
|
onSelectReagentSubmit(code,row) { |
|
|
|
const { currentSubKey,currentTableKey,currentRowIndex,currentTableIndex } = this; |
|
|
|
if(currentSubKey){ |
|
|
|
const ref = this.currentType === "ladder" ?"ladderStepFormPackageRef_":"paralleStepFormPackageRef_" |
|
|
|
onSelectReagentSubmit(code, row) { |
|
|
|
const { currentSubKey, currentTableKey, currentRowIndex, currentTableIndex } = this; |
|
|
|
if (currentSubKey) { |
|
|
|
const ref = this.currentType === "ladder" ? "ladderStepFormPackageRef_" : "paralleStepFormPackageRef_" |
|
|
|
const packageRef = this.$refs[`${ref}${this.currentRowIndex}`][0]; |
|
|
|
if(currentSubKey === "subStartSolution"){ |
|
|
|
packageRef.updateFormData("targetAcSolution", row.nd,["targetAcSolution"]); |
|
|
|
packageRef.onValueChangeCompareTo("targetAcSolution", row.nd,"targetStartSolution"); |
|
|
|
if (currentSubKey === "subStartSolution") { |
|
|
|
packageRef.updateFormData("targetAcSolution", row.nd, ["targetAcSolution"]); |
|
|
|
packageRef.onValueChangeCompareTo("targetAcSolution", row.nd, "targetStartSolution"); |
|
|
|
} |
|
|
|
packageRef.updateFormData(currentSubKey, code); |
|
|
|
this.currentSubKey = ""; |
|
|
|
}else if (currentTableKey === "actStartSolutionCode"){//实际原始溶液编号点击事件 |
|
|
|
} else if (currentTableKey === "actStartSolutionCode") {//实际原始溶液编号点击事件 |
|
|
|
const tableRef = this.$refs[`paralleStepTableRef_${currentRowIndex}`][0]; |
|
|
|
if(tableRef){ |
|
|
|
tableRef.updateDataSourceByRowIndex(currentTableIndex,{ |
|
|
|
if (tableRef) { |
|
|
|
tableRef.updateDataSourceByRowIndex(currentTableIndex, { |
|
|
|
actStartSolutionCode: code, |
|
|
|
targetAcSolution: row.nd, |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.$refs.selectReagentDialogRef.onCancel() |
|
|
|
}, |
|
|
|
@ -518,8 +546,9 @@ export default { |
|
|
|
.mt-0 { |
|
|
|
margin-top: 0; |
|
|
|
} |
|
|
|
.s-container{ |
|
|
|
|
|
|
|
.s-container { |
|
|
|
box-shadow: none !important; |
|
|
|
padding:24px 0 !important; |
|
|
|
padding: 24px 0 !important; |
|
|
|
} |
|
|
|
</style> |