|
|
@ -1,5 +1,5 @@ |
|
|
import moment from 'moment' |
|
|
import moment from 'moment' |
|
|
import { getLatestSn,getLatestSnArr } from '@/api/template'; |
|
|
|
|
|
|
|
|
import { getLatestSn, getLatestSnArr } from '@/api/template'; |
|
|
import { isValueEmpty } from '@/utils/index'; |
|
|
import { isValueEmpty } from '@/utils/index'; |
|
|
import { sj_subpackage, sj_startConfiguration, sj_configurationCompleted } from '@/api/business/sj/sj'; |
|
|
import { sj_subpackage, sj_startConfiguration, sj_configurationCompleted } from '@/api/business/sj/sj'; |
|
|
export default { |
|
|
export default { |
|
|
@ -53,21 +53,21 @@ export default { |
|
|
id |
|
|
id |
|
|
} = v |
|
|
} = v |
|
|
if (v.resource) { |
|
|
if (v.resource) { |
|
|
//type 类型:1:试剂;3:给药制剂;5:麻精药;7:供试品
|
|
|
|
|
|
|
|
|
//type 类型:1:试剂;3:给药制剂;5:麻精药;7:供试品
|
|
|
//试验试剂信息 试剂
|
|
|
//试验试剂信息 试剂
|
|
|
this.resource = _.filter(JSON.parse(v.resource),function(o){ |
|
|
|
|
|
return o.type==1||o.elnType==1 |
|
|
|
|
|
|
|
|
this.resource = _.filter(JSON.parse(v.resource), function (o) { |
|
|
|
|
|
return o.type == 1 || o.elnType == 1 |
|
|
}) |
|
|
}) |
|
|
//试验物资信息 供试品、给药制剂
|
|
|
//试验物资信息 供试品、给药制剂
|
|
|
this.resourceWz =_.filter(JSON.parse(v.resource),function(o){ |
|
|
|
|
|
return o.type==3||o.type==7||o.elnType==3||o.elnType==7 |
|
|
|
|
|
|
|
|
this.resourceWz = _.filter(JSON.parse(v.resource), function (o) { |
|
|
|
|
|
return o.type == 3 || o.type == 7 || o.elnType == 3 || o.elnType == 7 |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
if (v.yqResource) { |
|
|
if (v.yqResource) { |
|
|
//仪器信息
|
|
|
//仪器信息
|
|
|
this.yqResource = JSON.parse(v.yqResource) |
|
|
this.yqResource = JSON.parse(v.yqResource) |
|
|
} |
|
|
} |
|
|
this.product=v.product||null |
|
|
|
|
|
|
|
|
this.product = v.product || null |
|
|
if (v.bdnr) { |
|
|
if (v.bdnr) { |
|
|
this.formData = { |
|
|
this.formData = { |
|
|
...JSON.parse(v.bdnr), |
|
|
...JSON.parse(v.bdnr), |
|
|
@ -125,13 +125,13 @@ export default { |
|
|
return { |
|
|
return { |
|
|
formData: {}, |
|
|
formData: {}, |
|
|
templateDetail: {}, |
|
|
templateDetail: {}, |
|
|
product:null,//产物:1:试剂;3:给药制剂;5:麻精药
|
|
|
|
|
|
|
|
|
product: null,//产物:1:试剂;3:给药制剂;5:麻精药
|
|
|
resource: [], //试验试剂信息
|
|
|
resource: [], //试验试剂信息
|
|
|
resourceWz: [], //物资信息
|
|
|
resourceWz: [], //物资信息
|
|
|
yqResource: [], //仪器信息
|
|
|
yqResource: [], //仪器信息
|
|
|
jcbList: [], //检测板信息
|
|
|
jcbList: [], //检测板信息
|
|
|
|
|
|
|
|
|
resourceTmp:[],//试验试剂信息提交用
|
|
|
|
|
|
|
|
|
resourceTmp: [],//试验试剂信息提交用
|
|
|
yqResourceTmp: [], //仪器信息提交用
|
|
|
yqResourceTmp: [], //仪器信息提交用
|
|
|
jcbListTmp: [], //检测板信息提交用
|
|
|
jcbListTmp: [], //检测板信息提交用
|
|
|
sysjColumns: [ |
|
|
sysjColumns: [ |
|
|
@ -162,10 +162,10 @@ export default { |
|
|
this.setTemplateData({}) |
|
|
this.setTemplateData({}) |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
getFormDataByTemplateData(){ |
|
|
|
|
|
|
|
|
getFormDataByTemplateData() { |
|
|
let o = {}; |
|
|
let o = {}; |
|
|
const { bdnr } = this.templateData |
|
|
const { bdnr } = this.templateData |
|
|
if(bdnr){ |
|
|
|
|
|
|
|
|
if (bdnr) { |
|
|
o = JSON.parse(bdnr) |
|
|
o = JSON.parse(bdnr) |
|
|
} |
|
|
} |
|
|
return o; |
|
|
return o; |
|
|
@ -352,8 +352,8 @@ export default { |
|
|
}, |
|
|
}, |
|
|
//统一处理table失焦事件
|
|
|
//统一处理table失焦事件
|
|
|
onHandleTableBlur(params) { |
|
|
onHandleTableBlur(params) { |
|
|
const { rowIndex, colKey, value, item } = params |
|
|
|
|
|
console.log(params,"params"); |
|
|
|
|
|
|
|
|
const { rowIndex, colKey, value, item, dataSource } = params |
|
|
|
|
|
console.log(params, "params"); |
|
|
if ( |
|
|
if ( |
|
|
colKey === 'targetSolutionVolume' || |
|
|
colKey === 'targetSolutionVolume' || |
|
|
colKey === 'targetSolutionConcentration' || |
|
|
colKey === 'targetSolutionConcentration' || |
|
|
@ -364,9 +364,9 @@ export default { |
|
|
this.$refs.stepFormPackageRef?.getFormDataByKey( |
|
|
this.$refs.stepFormPackageRef?.getFormDataByKey( |
|
|
'targetStartSolution' |
|
|
'targetStartSolution' |
|
|
) |
|
|
) |
|
|
if(isValueEmpty(volume)){ |
|
|
|
|
|
|
|
|
if (isValueEmpty(volume)) { |
|
|
this.$message.error('请先选择预设起始源溶液浓度') |
|
|
this.$message.error('请先选择预设起始源溶液浓度') |
|
|
}else{ |
|
|
|
|
|
|
|
|
} else { |
|
|
this.updateTargetStartSolutionVolume(item, volume) |
|
|
this.updateTargetStartSolutionVolume(item, volume) |
|
|
} |
|
|
} |
|
|
} else if ( |
|
|
} else if ( |
|
|
@ -376,25 +376,24 @@ export default { |
|
|
//实际起始溶液体积和实际目标溶液体积
|
|
|
//实际起始溶液体积和实际目标溶液体积
|
|
|
const targetAcSolution = |
|
|
const targetAcSolution = |
|
|
this.$refs.stepFormPackageRef?.getFormDataByKey('targetAcSolution') //获取实际起始溶液浓度
|
|
|
this.$refs.stepFormPackageRef?.getFormDataByKey('targetAcSolution') //获取实际起始溶液浓度
|
|
|
console.log(targetAcSolution,"targetAcSolution") |
|
|
|
|
|
if(isValueEmpty(targetAcSolution)){ |
|
|
|
|
|
this.$message.error('请先选择起始源溶液') |
|
|
|
|
|
return |
|
|
|
|
|
}else { |
|
|
|
|
|
const volResult = this.updateSjmbrynd(item, targetAcSolution); |
|
|
|
|
|
if(!volResult){ |
|
|
|
|
|
|
|
|
if (isValueEmpty(targetAcSolution)) { |
|
|
|
|
|
this.$message.error('请先选择起始源溶液') |
|
|
|
|
|
return |
|
|
|
|
|
} else { |
|
|
|
|
|
const volResult = this.updateSjmbrynd(item, targetAcSolution, rowIndex, dataSource, "ladder") |
|
|
|
|
|
if (!volResult) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
this.$refs.stepTableRef?.updateDataSourceByRowIndex(rowIndex, { actSolutionVolume: volResult.actVol,actSolutionConcentration: volResult.actNd},"blur") |
|
|
|
|
|
|
|
|
this.$refs.stepTableRef?.updateDataSourceByRowIndex(rowIndex, { actSolutionVolume: volResult.actVol, actSolutionConcentration: volResult.actNd }, "blur") |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//计算并更新实际目标溶液浓度 先计算实际目标溶液体积再计算实际目标溶液浓度
|
|
|
|
|
|
updateSjmbrynd(item, targetAcSolution) { |
|
|
|
|
|
console.log(item, targetAcSolution, 'updateSjmbrynd') |
|
|
|
|
|
|
|
|
//计算目标溶液浓度
|
|
|
|
|
|
calcNd(item, targetAcSolution) { |
|
|
|
|
|
|
|
|
//实际源溶液浓度÷(实际终体积÷源溶液加入体积);
|
|
|
//实际源溶液浓度÷(实际终体积÷源溶液加入体积);
|
|
|
const precision = item.actSolutionConcentrationPrecision |
|
|
|
|
|
|
|
|
const precision = item.actSolutionConcentrationPrecision |
|
|
const volPrecision = item.actSolutionVolumePrecision || 0 |
|
|
const volPrecision = item.actSolutionVolumePrecision || 0 |
|
|
//实际稀释液体积
|
|
|
//实际稀释液体积
|
|
|
const actDiluentVolume = item.actDiluentVolume |
|
|
const actDiluentVolume = item.actDiluentVolume |
|
|
@ -406,20 +405,43 @@ export default { |
|
|
//实际目标溶液体积
|
|
|
//实际目标溶液体积
|
|
|
// item.actSolutionVolume = actVol
|
|
|
// item.actSolutionVolume = actVol
|
|
|
//实际目标溶液浓度
|
|
|
//实际目标溶液浓度
|
|
|
if(isValueEmpty(actDiluentVolume) && isValueEmpty(actStartSolutionVolume)){ |
|
|
|
|
|
|
|
|
if (isValueEmpty(actDiluentVolume) && isValueEmpty(actStartSolutionVolume)) { |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
// 实际目标溶液浓度 = 实际源溶液浓度÷(实际终体积÷源溶液加入体积);
|
|
|
// 实际目标溶液浓度 = 实际源溶液浓度÷(实际终体积÷源溶液加入体积);
|
|
|
const actNd = ( |
|
|
const actNd = ( |
|
|
parseFloat(targetAcSolution) /( |
|
|
|
|
|
parseFloat(actStartSolutionVolume) / |
|
|
|
|
|
parseFloat(actVol) |
|
|
|
|
|
|
|
|
parseFloat(targetAcSolution) / ( |
|
|
|
|
|
parseFloat(actVol)/parseFloat(actStartSolutionVolume) |
|
|
) |
|
|
) |
|
|
).toFixed(precision) |
|
|
).toFixed(precision) |
|
|
const nd = actNd === 'Infinity' ? 0 : Number(actNd) |
|
|
const nd = actNd === 'Infinity' ? 0 : Number(actNd) |
|
|
console.log(actNd, targetAcSolution, actStartSolutionVolume, actVol, "actNd") |
|
|
console.log(actNd, targetAcSolution, actStartSolutionVolume, actVol, "actNd") |
|
|
// item.actSolutionConcentration = actNd === 'Infinity' ? 0 : actNd
|
|
|
// item.actSolutionConcentration = actNd === 'Infinity' ? 0 : actNd
|
|
|
return { actVol:Number(actVol), actNd: nd } |
|
|
|
|
|
|
|
|
return { actVol: Number(actVol), actNd: nd } |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
//计算并更新实际目标溶液浓度 先计算实际目标溶液体积再计算实际目标溶液浓度
|
|
|
|
|
|
updateSjmbrynd(item, targetAcSolution, rowIndex, dataSource, type) { |
|
|
|
|
|
//如果是阶梯配置的就需要传rowIndex,dataSource,type字段
|
|
|
|
|
|
if (type === "ladder") { |
|
|
|
|
|
if (rowIndex === 0) {//第一行的浓度取选择的溶液,
|
|
|
|
|
|
if (isValueEmpty(targetAcSolution)) { |
|
|
|
|
|
this.$message.error('请先选择起始源溶液') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
return this.calcNd(item, targetAcSolution) |
|
|
|
|
|
} else { |
|
|
|
|
|
//非第一行的浓度取上一行的浓度
|
|
|
|
|
|
const prevItem = dataSource[rowIndex - 1] |
|
|
|
|
|
const prevConcentration = prevItem.actSolutionConcentration; |
|
|
|
|
|
if (!prevConcentration) { |
|
|
|
|
|
this.$message.error('请先计算上一行的实际目标溶液浓度') |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
return this.updateSjmbrynd(item, prevConcentration); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return this.calcNd(item, targetAcSolution) |
|
|
}, |
|
|
}, |
|
|
//更新起始溶液体积时,计算目标溶液预计浓度
|
|
|
//更新起始溶液体积时,计算目标溶液预计浓度
|
|
|
updateTargetStartSolutionVolume(item, volume) { |
|
|
updateTargetStartSolutionVolume(item, volume) { |
|
|
|