|
|
|
@ -3,6 +3,8 @@ import { getLatestSn, getLatestSnArr } from '@/api/template'; |
|
|
|
import { isValueEmpty } from '@/utils/index'; |
|
|
|
import { isCommonUnit } from "@/utils/conTools"; |
|
|
|
import { sj_subpackage, sj_startConfiguration, sj_configurationCompleted } from '@/api/business/sj/sj'; |
|
|
|
import {convertConcentration} from "@/utils/conConverter";//浓度单位转换
|
|
|
|
import {volumeConverter} from "@/utils/volConverter";//体积单位转换
|
|
|
|
export default { |
|
|
|
dicts: [ |
|
|
|
'business_pztj', |
|
|
|
@ -347,14 +349,15 @@ export default { |
|
|
|
targetSolutionCode: `STD${Number(codeSTD) - index}` |
|
|
|
})) |
|
|
|
this.$refs.stepTableRef.updateDataSource(arr) |
|
|
|
} else if (key === 'targetStartSolution') { |
|
|
|
} else if (key === 'targetStartSolution' || key === 'subTargetStartSolution') { |
|
|
|
//起始溶液体积失焦时,更新目标溶液预计浓度
|
|
|
|
const arr = this.$refs.stepTableRef?.getDataSource(); |
|
|
|
const {headerSelectFields} = this.$refs.stepTableRef?.getFilledFormData(); |
|
|
|
const params = { |
|
|
|
startUnit:subTargetStartSolution, |
|
|
|
subTargetStartSolution, |
|
|
|
headerSelectFields |
|
|
|
} |
|
|
|
|
|
|
|
arr.forEach((item, rowIndex) => { |
|
|
|
this.updateTargetStartSolutionVolume( |
|
|
|
item, |
|
|
|
@ -364,10 +367,19 @@ export default { |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
//批量更新目标起始源溶液体积
|
|
|
|
batchUpdateTargetStartSolutionVolume(arr, startConcentration, params) { |
|
|
|
arr.forEach((item, rowIndex) => { |
|
|
|
this.updateTargetStartSolutionVolume( |
|
|
|
item, |
|
|
|
startConcentration, |
|
|
|
params |
|
|
|
) |
|
|
|
}) |
|
|
|
}, |
|
|
|
//统一处理table失焦事件
|
|
|
|
onHandleTableBlur(params) { |
|
|
|
const { rowIndex, colKey, value, item, dataSource,headerSelectFields } = params |
|
|
|
console.log(params, "params"); |
|
|
|
if ( |
|
|
|
colKey === 'targetSolutionVolume' || |
|
|
|
colKey === 'targetSolutionConcentration' || |
|
|
|
@ -383,7 +395,7 @@ export default { |
|
|
|
'subTargetStartSolution' |
|
|
|
) |
|
|
|
const params = { |
|
|
|
startUnit:subTargetStartSolution, |
|
|
|
subTargetStartSolution:subTargetStartSolution, |
|
|
|
headerSelectFields |
|
|
|
} |
|
|
|
if (isValueEmpty(volume)) { |
|
|
|
@ -465,25 +477,46 @@ export default { |
|
|
|
} |
|
|
|
return this.calcNd(item, targetAcSolution) |
|
|
|
}, |
|
|
|
//更新起始溶液体积时,计算目标溶液预计浓度
|
|
|
|
//更新起始溶液体积时,计算预设起始溶液体积和预设稀释液体积
|
|
|
|
updateTargetStartSolutionVolume(item, volume,unitParams) { |
|
|
|
const {startUnit,headerSelectFields} = unitParams |
|
|
|
const {targetSolutionConcentrationUnit,targetSolutionVolumeUnit,targetStartSolutionVolumeUnit,targetDiluentVolumeUnit} = headerSelectFields |
|
|
|
const precision = item.targetStartSolutionVolumePrecision || 0 |
|
|
|
const concentration = item.targetSolutionConcentration || 0 |
|
|
|
const targetVolume = item.targetSolutionVolume || 0 |
|
|
|
const concentration = item.targetSolutionConcentration |
|
|
|
const targetVolume = item.targetSolutionVolume |
|
|
|
const {subTargetStartSolution,headerSelectFields} = unitParams |
|
|
|
const {targetSolutionConcentrationUnit,targetSolutionVolumeUnit,targetStartSolutionVolumeUnit,targetDiluentVolumeUnit} = headerSelectFields |
|
|
|
const targetStartVolUnit = targetSolutionConcentrationUnit.split("/")[1];//先按照预设目标溶液浓度的单位标准
|
|
|
|
|
|
|
|
//目标溶液预计浓度:(目标溶液预计体积 乘以 起始溶液浓度)除以 起始溶液体积
|
|
|
|
const result = Number(((concentration * targetVolume) / volume).toFixed( |
|
|
|
if( |
|
|
|
isValueEmpty(concentration) || |
|
|
|
isValueEmpty(targetVolume)|| |
|
|
|
isValueEmpty(subTargetStartSolution)|| |
|
|
|
isValueEmpty(targetSolutionConcentrationUnit)|| |
|
|
|
isValueEmpty(targetSolutionVolumeUnit)|| |
|
|
|
isValueEmpty(targetStartSolutionVolumeUnit)|| |
|
|
|
isValueEmpty(targetDiluentVolumeUnit) |
|
|
|
){ |
|
|
|
return; |
|
|
|
} |
|
|
|
//将起始溶液浓度转换为和预设目标溶液浓度一样的单位再计算;
|
|
|
|
const converStartCon = convertConcentration.convert(volume+subTargetStartSolution,targetSolutionConcentrationUnit) |
|
|
|
//将预设目标溶液体积转换为和预设目标溶液浓度单位的分母一样的单位再计算;如:预设目标溶液浓度单位为mg/mL,预设目标溶液体积单位为uL,则将预设目标溶液体积转换为mL
|
|
|
|
const convertTargetVol = volumeConverter.convert(targetVolume+targetSolutionVolumeUnit,targetStartVolUnit) |
|
|
|
|
|
|
|
//预设起始溶液体积:(目标溶液预计浓度 乘以 目标溶液预计体积)除以 起始溶液浓度
|
|
|
|
const result = Number(((concentration * convertTargetVol) / converStartCon).toFixed( |
|
|
|
precision |
|
|
|
)) |
|
|
|
item.targetStartSolutionVolume = result |
|
|
|
//根据预设起始溶液体积单位转换计算后的数据
|
|
|
|
const convertYsVol = volumeConverter.convert(result+targetStartVolUnit,targetStartSolutionVolumeUnit) |
|
|
|
item.targetStartSolutionVolume = convertYsVol |
|
|
|
// this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetStartSolutionVolume: result });
|
|
|
|
if (targetVolume) { |
|
|
|
//预设稀释液体积:目标溶液预计体积 减去 源溶液预计体积;
|
|
|
|
const precision1 = item.targetDiluentVolumePrecision || 0 |
|
|
|
const result1 = (targetVolume - result).toFixed(precision1) |
|
|
|
item.targetDiluentVolume = Number(result1) |
|
|
|
const precision1 = item.targetDiluentVolumePrecision || 0; |
|
|
|
//将预设目标溶液体积转换为和预设起始溶液体积单位一样的单位再计算;
|
|
|
|
const convertTargetVol1 = volumeConverter.convert(targetVolume+targetSolutionVolumeUnit,targetStartSolutionVolumeUnit) |
|
|
|
const result1 = (convertTargetVol1 - convertYsVol).toFixed(precision1) |
|
|
|
item.targetDiluentVolume = volumeConverter.convert(result1+targetStartSolutionVolumeUnit,targetDiluentVolumeUnit) |
|
|
|
// this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetDiluentVolume: result1 });
|
|
|
|
} |
|
|
|
} |
|
|
|
|