|
|
|
@ -1,6 +1,6 @@ |
|
|
|
import moment from 'moment' |
|
|
|
import { getLatestSn, getLatestSnArr } from '@/api/template'; |
|
|
|
import { isValueEmpty, getStringWidth,getuuid } from '@/utils/index'; |
|
|
|
import { isValueEmpty, getStringWidth, getuuid } 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";//浓度单位转换
|
|
|
|
@ -142,7 +142,7 @@ export default { |
|
|
|
templateId, |
|
|
|
templateSn, |
|
|
|
startDate, |
|
|
|
submittedCodes, |
|
|
|
submittedCodes, |
|
|
|
bdmc, |
|
|
|
endDate, |
|
|
|
id |
|
|
|
@ -157,7 +157,7 @@ export default { |
|
|
|
templateMcEn, |
|
|
|
templateId, |
|
|
|
templateSn, |
|
|
|
submittedCodes, |
|
|
|
submittedCodes, |
|
|
|
startDate, |
|
|
|
bdmc, |
|
|
|
endDate, |
|
|
|
@ -288,12 +288,12 @@ export default { |
|
|
|
onBeforeReagentSubmit(data) { |
|
|
|
const { selectData, callback, key, formFields } = data; |
|
|
|
const { subTargetStartSolution } = formFields; |
|
|
|
|
|
|
|
|
|
|
|
//判断选择的浓度单位和预制的浓度单位是否一致
|
|
|
|
if (key === "subStartSolution" && !isCommonUnit(selectData.row.nddw, [subTargetStartSolution])) {//选择起始源溶液需要同步更新table的变更记录。
|
|
|
|
callback.prevent('浓度单位与预制不符,请重新选择或申请废止并重新预制。'); |
|
|
|
} |
|
|
|
if(selectData.row.nd === "NA"){ |
|
|
|
if (selectData.row.nd === "NA") { |
|
|
|
callback.prevent('当前实际浓度为NA,请重新选择'); |
|
|
|
} |
|
|
|
}, |
|
|
|
@ -503,19 +503,19 @@ export default { |
|
|
|
targetDiluentVolumePrecision: 3, //小数点精度默认为3
|
|
|
|
targetStartSolutionVolumePrecision: 3, //小数点精度默认为3
|
|
|
|
targetSolutionCode: `CA-WS-STD${Number(codeSTD) - index}`, |
|
|
|
id:getuuid(), |
|
|
|
rowIndex:index, |
|
|
|
id: getuuid(), |
|
|
|
rowIndex: index, |
|
|
|
})) |
|
|
|
this.$refs.stepTableRef.updateDataSource(arr) |
|
|
|
} else if (key === 'targetStartSolution' || key === 'subTargetStartSolution') { |
|
|
|
//起始溶液体积失焦时,更新目标溶液预计浓度
|
|
|
|
const arr = this.$refs.stepTableRef?.getDataSource(); |
|
|
|
const { headerSelectFields,stepTableFormData=[] } = this.$refs.stepTableRef?.getFilledFormData(); |
|
|
|
const { headerSelectFields, stepTableFormData = [] } = this.$refs.stepTableRef?.getFilledFormData(); |
|
|
|
const params = { |
|
|
|
subTargetStartSolution, |
|
|
|
headerSelectFields, |
|
|
|
dataSource:stepTableFormData, |
|
|
|
} |
|
|
|
dataSource: stepTableFormData, |
|
|
|
} |
|
|
|
arr.forEach((item, rowIndex) => { |
|
|
|
this.updateTargetStartSolutionVolume( |
|
|
|
item, |
|
|
|
@ -583,7 +583,7 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
if (isValueEmpty(initNd)) { |
|
|
|
console.log("initNd",initNd) |
|
|
|
console.log("initNd", initNd) |
|
|
|
this.$message.error('请先选择起始源溶液') |
|
|
|
return |
|
|
|
} else { |
|
|
|
@ -598,7 +598,7 @@ export default { |
|
|
|
|
|
|
|
//计算目标溶液浓度
|
|
|
|
calcNd(item, targetAcSolution, params) { |
|
|
|
console.log(item,params, "ppp") |
|
|
|
console.log(item, params, "ppp") |
|
|
|
// debugger
|
|
|
|
//targetStartSolutionUnit(实际起始源溶液浓度单位)
|
|
|
|
const { targetStartSolutionUnit, headerSelectFields } = params; |
|
|
|
@ -606,7 +606,7 @@ export default { |
|
|
|
let initUnit = targetStartSolutionUnit; |
|
|
|
if (item.rowIndex > 0) { |
|
|
|
initUnit = actSolutionConcentrationUnit; |
|
|
|
} |
|
|
|
} |
|
|
|
//actStartSolutionVolumeUnit(实际起始源溶液体积单位)actSolutionVolumeUnit(实际目标溶液体积单位)
|
|
|
|
//actDiluentVolumeUnit(实际稀释液体积单位)actSolutionConcentrationUnit(实际目标溶液浓度单位)
|
|
|
|
//实际源溶液浓度÷(实际终体积÷源溶液加入体积);
|
|
|
|
@ -619,6 +619,14 @@ export default { |
|
|
|
if (isValueEmpty(actStartSolutionVolume) || isValueEmpty(actDiluentVolume) || isValueEmpty(initUnit)) { |
|
|
|
return false |
|
|
|
} |
|
|
|
const splitXsytj = actDiluentVolume.split("/"); |
|
|
|
const splitYrytj = actStartSolutionVolume.split("/"); |
|
|
|
const sjZtj = splitXsytj.map((item,index) => { |
|
|
|
const xsytj = volumeConverter.convert(item + actDiluentVolumeUnit, actSolutionVolumeUnit); |
|
|
|
const yrytj = volumeConverter.convert(splitYrytj[index] + actStartSolutionVolumeUnit, actSolutionVolumeUnit); |
|
|
|
return (Number(xsytj) + Number(yrytj)).toFixed(volPrecision); |
|
|
|
}) |
|
|
|
console.log(sjZtj, "sjZtj") |
|
|
|
const converActDiluentVolume = volumeConverter.convert(actDiluentVolume + actDiluentVolumeUnit, actSolutionVolumeUnit) |
|
|
|
const converActStartSolutionVolume = volumeConverter.convert(actStartSolutionVolume + actStartSolutionVolumeUnit, actSolutionVolumeUnit) |
|
|
|
//实际源溶液加入体积+实际稀释液加入体积
|
|
|
|
@ -628,11 +636,11 @@ export default { |
|
|
|
const targetStartVolUnit = actSolutionConcentrationUnit.split("/")[1];//先按照预设目标溶液浓度的单位标准
|
|
|
|
const converActVol = volumeConverter.convert(actVol + actSolutionVolumeUnit, targetStartVolUnit) |
|
|
|
const converActDiluentVolume1 = volumeConverter.convert(actStartSolutionVolume + actStartSolutionVolumeUnit, targetStartVolUnit) |
|
|
|
const converArr = (targetAcSolution+'').split("/"); |
|
|
|
converArr.map((item)=>{ |
|
|
|
const converArr = (targetAcSolution + '').split("/"); |
|
|
|
converArr.map((item) => { |
|
|
|
return convertConcentration.convert(item + initUnit, actSolutionConcentrationUnit) |
|
|
|
}) |
|
|
|
console.log(converArr,"converArr") |
|
|
|
console.log(converArr, "converArr") |
|
|
|
const converTargetAcSolution = convertConcentration.convert(targetAcSolution + initUnit, actSolutionConcentrationUnit) |
|
|
|
// 实际目标溶液浓度 = 实际源溶液浓度÷(实际终体积÷源溶液加入体积);
|
|
|
|
const actNd = ( |
|
|
|
@ -653,16 +661,17 @@ export default { |
|
|
|
//更新起始溶液体积时,计算预设起始溶液体积和预设稀释液体积
|
|
|
|
updateTargetStartSolutionVolume(item, volume, unitParams) { |
|
|
|
const { rowIndex } = item |
|
|
|
const { subTargetStartSolution, headerSelectFields, dataSource=[] } = unitParams |
|
|
|
const { subTargetStartSolution, headerSelectFields, dataSource = [] } = unitParams |
|
|
|
const { targetSolutionConcentrationUnit, targetSolutionVolumeUnit, targetStartSolutionVolumeUnit, targetDiluentVolumeUnit } = headerSelectFields |
|
|
|
|
|
|
|
let initNd = volume,unit = subTargetStartSolution; |
|
|
|
let initNd = volume, unit = subTargetStartSolution; |
|
|
|
//平行配置不会传dataSource;
|
|
|
|
if (rowIndex > 0 && dataSource.length > 0) { |
|
|
|
initNd = dataSource[rowIndex - 1].targetSolutionConcentration; |
|
|
|
unit = targetSolutionConcentrationUnit; |
|
|
|
} |
|
|
|
} |
|
|
|
const precision = item.targetStartSolutionVolumePrecision || 0 |
|
|
|
const precision1 = item.targetDiluentVolumePrecision || 0; |
|
|
|
const concentration = item.targetSolutionConcentration |
|
|
|
const targetVolume = item.targetSolutionVolume |
|
|
|
if ( |
|
|
|
@ -676,34 +685,33 @@ export default { |
|
|
|
) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const targetStartVolUnit = targetSolutionConcentrationUnit.split("/")[1];//先按照预设目标溶液浓度的单位标准
|
|
|
|
const volumeArr = (initNd+'').split("/"); |
|
|
|
const converArr = volumeArr.map((item)=>{ |
|
|
|
return convertConcentration.convert(item + unit, targetSolutionConcentrationUnit) |
|
|
|
}) |
|
|
|
console.log(converArr,"converArr") |
|
|
|
//将起始溶液浓度转换为和预设目标溶液浓度一样的单位再计算;
|
|
|
|
const converStartCon = convertConcentration.convert(initNd + unit, targetSolutionConcentrationUnit) |
|
|
|
//将预设目标溶液体积转换为和预设目标溶液浓度单位的分母一样的单位再计算;如:预设目标溶液浓度单位为mg/mL,预设目标溶液体积单位为uL,则将预设目标溶液体积转换为mL
|
|
|
|
const convertTargetVol = volumeConverter.convert(targetVolume + targetSolutionVolumeUnit, targetStartVolUnit) |
|
|
|
const convertTargetVol1 = volumeConverter.convert(targetVolume + targetSolutionVolumeUnit, targetStartSolutionVolumeUnit) |
|
|
|
|
|
|
|
//预设起始溶液体积:(目标溶液预计浓度 乘以 目标溶液预计体积)除以 起始溶液浓度
|
|
|
|
const result = Number((concentration * convertTargetVol) / converStartCon) |
|
|
|
//根据预设起始溶液体积单位转换计算后的数据
|
|
|
|
const convertYsVol = volumeConverter.convert(result + targetStartVolUnit, targetStartSolutionVolumeUnit) |
|
|
|
item.targetStartSolutionVolume = Number(convertYsVol.toFixed( |
|
|
|
precision |
|
|
|
)) |
|
|
|
// this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetStartSolutionVolume: result });
|
|
|
|
if (targetVolume) { |
|
|
|
//预设稀释液体积:目标溶液预计体积 减去 源溶液预计体积;
|
|
|
|
const precision1 = item.targetDiluentVolumePrecision || 0; |
|
|
|
//将预设目标溶液体积转换为和预设起始溶液体积单位一样的单位再计算;
|
|
|
|
const convertTargetVol1 = volumeConverter.convert(targetVolume + targetSolutionVolumeUnit, targetStartSolutionVolumeUnit) |
|
|
|
const result1 = (convertTargetVol1 - convertYsVol) |
|
|
|
item.targetDiluentVolume = Number(volumeConverter.convert(result1 + targetStartSolutionVolumeUnit, targetDiluentVolumeUnit).toFixed(precision1)) |
|
|
|
// this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetDiluentVolume: result1 });
|
|
|
|
const initNdArr = (initNd + '').split("/"); |
|
|
|
const transNdArr = initNdArr.map((con) => { |
|
|
|
return convertConcentration.convert(con + unit, targetSolutionConcentrationUnit) |
|
|
|
}) |
|
|
|
const mbyjndArr = (concentration + '').split("/");//目标预计浓度
|
|
|
|
if (initNdArr.length == 1 || mbyjndArr.length == initNdArr.length) { |
|
|
|
//预设体积
|
|
|
|
const ystjArr = mbyjndArr.map((con, index) => { |
|
|
|
const ystj = Number((con * convertTargetVol) / (transNdArr[index] || transNdArr[0])) |
|
|
|
const convertYsVol = volumeConverter.convert(ystj + targetStartVolUnit, targetStartSolutionVolumeUnit) |
|
|
|
const xstj = (convertTargetVol1 - convertYsVol)//稀释体积
|
|
|
|
return {qsrytj:convertYsVol,xstj} |
|
|
|
}) |
|
|
|
item.targetStartSolutionVolume = ystjArr.map((item) => { |
|
|
|
return Number((item.qsrytj).toFixed(precision)) |
|
|
|
}).join("/"); |
|
|
|
item.targetDiluentVolume = ystjArr.map((item) => { |
|
|
|
return Number((volumeConverter.convert(item.xstj + targetStartSolutionVolumeUnit, targetDiluentVolumeUnit)).toFixed(precision1)) |
|
|
|
}).join("/"); |
|
|
|
} else { |
|
|
|
this.$message.error("起始溶液浓度和目标溶液浓度格式不一致,请重新输入") |
|
|
|
return |
|
|
|
} |
|
|
|
}, |
|
|
|
// 导出excel模板
|
|
|
|
|