Browse Source

feat:[模板管理][烦人的浓度计算和单位换算]

lkf
luojie 2 months ago
parent
commit
5b0f43992e
7 changed files with 109 additions and 41 deletions
  1. +11
    -0
      src/components/Template/CustomTable.vue
  2. +1
    -1
      src/views/business/comps/template/comps/gsp/GSP002.vue
  3. +1
    -1
      src/views/business/comps/template/comps/gsp/GSP004.vue
  4. +9
    -4
      src/views/business/comps/template/comps/sp/SP003.vue
  5. +37
    -8
      src/views/business/comps/template/comps/sp/SP00456.vue
  6. +10
    -1
      src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
  7. +40
    -26
      src/views/business/comps/template/mixins/templateMixin.js

+ 11
- 0
src/components/Template/CustomTable.vue View File

@ -142,6 +142,17 @@
@update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)" @update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.bodySubKey)" /> :orange-bg="hasOrangeBg(rowIndex, colIndex, col.bodySubKey)" />
</template> </template>
<template v-if="col.bodySubType === 'input'">
<HandleFormItem :fieldKey="prefixKey + '_' + col.bodySubKey + '_' + rowIndex"
:fieldItemLabel="fieldItemLabel" type="input"
@blur="onSubBlur(rowIndex, col.bodySubKey, $event)"
@copy="onCopy(rowIndex, col)" :item="getBodySubItem(col)"
v-model="row[col.bodySubKey]"
@change="onBodySubValueChange(rowIndex, colIndex,$event,)"
:error="hasError(rowIndex, colIndex, col.bodySubKey)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.bodySubKey)" />
</template>
<template v-else-if="col.bodySubType === 'select'"> <template v-else-if="col.bodySubType === 'select'">
<HandleFormItem :fieldKey="prefixKey + '_' + col.bodySubKey + '_' + rowIndex" <HandleFormItem :fieldKey="prefixKey + '_' + col.bodySubKey + '_' + rowIndex"
:fieldItemLabel="fieldItemLabel" type="select" class="body-select" :fieldItemLabel="fieldItemLabel" type="select" class="body-select"

+ 1
- 1
src/views/business/comps/template/comps/gsp/GSP002.vue View File

@ -575,7 +575,7 @@ export default {
row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== ''); row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== '');
// //
if (!hasAnyWithValue) { if (!hasAnyWithValue) {
const codes = stepTableFormData.map((item) => ({ prex: item.targetSolutionCode, type: 1 }));
const codes = stepTableFormData.map((item) => ({ pre: item.targetSolutionCode, type: 1 }));
const snList = await this.getLatestSnArr(codes); const snList = await this.getLatestSnArr(codes);
tableDataArray.forEach((row, idx) => { tableDataArray.forEach((row, idx) => {
let expDate = {}; let expDate = {};

+ 1
- 1
src/views/business/comps/template/comps/gsp/GSP004.vue View File

@ -601,7 +601,7 @@ export default {
row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== ''); row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== '');
// //
if (!hasAnyWithValue) { if (!hasAnyWithValue) {
const codes = stepTableFormData.map((item) => ({ prex: item.targetSolutionCode, type: 1 }));
const codes = stepTableFormData.map((item) => ({ pre: item.targetSolutionCode, type: 1 }));
const snList = await this.getLatestSnArr(codes); const snList = await this.getLatestSnArr(codes);
tableDataArray.forEach((row, idx) => { tableDataArray.forEach((row, idx) => {
let expDate = {}; let expDate = {};

+ 9
- 4
src/views/business/comps/template/comps/sp/SP003.vue View File

@ -475,7 +475,12 @@ export default {
if (key === "subStartSolution") {//table if (key === "subStartSolution") {//table
this.$refs.stepFormPackageRef.updateFormData("targetAcSolution", row.nd); this.$refs.stepFormPackageRef.updateFormData("targetAcSolution", row.nd);
this.$refs.stepFormPackageRef.updateFormData("subTargetAcSolutionUnit", row.nddw); this.$refs.stepFormPackageRef.updateFormData("subTargetAcSolutionUnit", row.nddw);
this.updateStepTableData(row);
const {headerSelectFields} = this.$refs.stepTableRef.getFilledFormData();
const params = {
targetStartSolutionUnit: row.nddw,
headerSelectFields
}
this.updateStepTableData(row,params);
} }
}, },
startConfig(val) { startConfig(val) {
@ -546,7 +551,7 @@ export default {
if (hasAnyWithValue) { if (hasAnyWithValue) {
return; return;
} }
const codes = stepTableFormData.map((item) => ({ prex: item.targetSolutionCode, type: 1 }));
const codes = stepTableFormData.map((item) => ({ pre: item.targetSolutionCode, type: 1 }));
const snList = await this.getLatestSnArr(codes); const snList = await this.getLatestSnArr(codes);
stepTableFormData.forEach((item, index) => { stepTableFormData.forEach((item, index) => {
this.$refs.stepTableRef.updateDataSourceByRowIndex(index, { subTargetSolutionCode: snList[index] }); this.$refs.stepTableRef.updateDataSourceByRowIndex(index, { subTargetSolutionCode: snList[index] });
@ -569,7 +574,7 @@ export default {
return this.getFilledFormDataByRefs(["baseInfoRef", "stepFormPackageRef", "stepRef", "remarkRef", "stepTableRef"]) return this.getFilledFormDataByRefs(["baseInfoRef", "stepFormPackageRef", "stepRef", "remarkRef", "stepTableRef"])
}, },
//table //table
updateStepTableData(row) {
updateStepTableData(row,params) {
const { stepTableFormData = [] } = this.$refs.stepTableRef.getFilledFormData(); const { stepTableFormData = [] } = this.$refs.stepTableRef.getFilledFormData();
// //
@ -588,7 +593,7 @@ export default {
newStepTableData[i].startSolutionCode = newStepTableData[i - 1].targetSolutionCode + newStepTableData[i - 1].subTargetSolutionCode; newStepTableData[i].startSolutionCode = newStepTableData[i - 1].targetSolutionCode + newStepTableData[i - 1].subTargetSolutionCode;
initNd = newStepTableData[i - 1].actSolutionConcentration; initNd = newStepTableData[i - 1].actSolutionConcentration;
} }
const volResult = this.updateSjmbrynd(item, initNd);
const volResult = this.updateSjmbrynd(item, initNd,params);
if (!volResult) { if (!volResult) {
continue continue
} }

+ 37
- 8
src/views/business/comps/template/comps/sp/SP00456.vue View File

@ -42,6 +42,7 @@
<CustomTable @blur="(e) => onHandleTableBlur('ladder', ladderIndex, e)" <CustomTable @blur="(e) => onHandleTableBlur('ladder', ladderIndex, e)"
:ref="`ladderStepTableRef_${ladderIndex}`" :showOperation="fillType === 'actFill' || fillType === 'preFill'" :ref="`ladderStepTableRef_${ladderIndex}`" :showOperation="fillType === 'actFill' || fillType === 'preFill'"
:columns="ladderStepColumns" :formData="ladderConfig" :columns="ladderStepColumns" :formData="ladderConfig"
@beforeSaveRecord = "(data) => onBeforeSaveRecord(data,'ladder',ladderIndex)"
@headerSelectChange="(data)=>onHeaderSelectChange(data,'ladder',ladderIndex)" @headerSelectChange="(data)=>onHeaderSelectChange(data,'ladder',ladderIndex)"
:prefixKey="'ladder_' + ladderIndex" :fieldItemLabel="$t('template.common.jtpz')"> :prefixKey="'ladder_' + ladderIndex" :fieldItemLabel="$t('template.common.jtpz')">
<template slot="operation" slot-scope="{ row, rowIndex, columns }"> <template slot="operation" slot-scope="{ row, rowIndex, columns }">
@ -199,6 +200,12 @@ export default {
} }
}, },
methods: { methods: {
onBeforeSaveRecord(data,type,configIndex){
if(type === "ladder"){
const formFields = this.$refs[`ladderStepFormPackageRef_${configIndex}`][0]?.getFilledFormData();
this.onCommonVerifyNdException(formFields,data);
}
},
bodySelectChange(data){ bodySelectChange(data){
this.paralleUpdateTargetStartSolutionVolume(data.item,data.headerSelectFields); this.paralleUpdateTargetStartSolutionVolume(data.item,data.headerSelectFields);
}, },
@ -346,7 +353,7 @@ export default {
row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== ''); row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== '');
// //
if (!hasAnyWithValue) { if (!hasAnyWithValue) {
const codes = stepTableFormData.map((item) => ({ prex: item.targetSolutionCode, type: 1 }));
const codes = stepTableFormData.map((item) => ({ pre: item.targetSolutionCode, type: 1 }));
const snList = await this.getLatestSnArr(codes); const snList = await this.getLatestSnArr(codes);
tableDataArray.forEach((row, idx) => { tableDataArray.forEach((row, idx) => {
let expDate = {}; let expDate = {};
@ -441,6 +448,22 @@ export default {
} }
} }
}, },
getLadderNdParamsByIndex(configIndex){
const { headerSelectFields = [] } = this.$refs[`ladderStepTableRef_${configIndex}`][0].getFilledFormData();
const subTargetAcSolutionUnit = this.$refs[`ladderStepFormPackageRef_${configIndex}`][0]?.getFormDataByKey("subTargetAcSolutionUnit");//
return {
targetStartSolutionUnit:subTargetAcSolutionUnit,
headerSelectFields
}
},
getParalleNdParamsByIndex(item,configIndex){
const { headerSelectFields = [] } = this.$refs[`paralleStepTableRef_${configIndex}`][0].getFilledFormData();
const subTargetAcSolutionUnit = item.subTargetAcSolutionUnit || "";//
return {
targetStartSolutionUnit:subTargetAcSolutionUnit,
headerSelectFields
}
},
// //
onHandleTableBlur(type, configIndex, e) { onHandleTableBlur(type, configIndex, e) {
@ -460,10 +483,10 @@ export default {
} }
} else if (colKey === "actStartSolutionVolume" || colKey === "actDiluentVolume") {// } else if (colKey === "actStartSolutionVolume" || colKey === "actDiluentVolume") {//
if (type === "ladder") { if (type === "ladder") {
const targetAcSolution = this.$refs[`ladderStepFormPackageRef_${configIndex}`][0]?.getFormDataByKey("targetAcSolution") || 0;//
const dataSource = this.$refs[`ladderStepTableRef_${configIndex}`][0]?.getDataSource() || [];
const targetAcSolution = this.$refs[`ladderStepFormPackageRef_${configIndex}`][0]?.getFormDataByKey("targetAcSolution");//
const params = this.getLadderNdParamsByIndex(configIndex);
if (targetAcSolution) { if (targetAcSolution) {
const volResult = this.updateSjmbrynd(item, targetAcSolution,rowIndex,dataSource,"ladder");
const volResult = this.updateSjmbrynd(item, targetAcSolution,params);
if (!volResult) { if (!volResult) {
return return
} }
@ -474,8 +497,9 @@ export default {
} }
} else if (type === "paralle") { } else if (type === "paralle") {
const targetAcSolution = item.targetAcSolution || 0;// const targetAcSolution = item.targetAcSolution || 0;//
const params = this.getParalleNdParamsByIndex(item,configIndex);
if (targetAcSolution) { if (targetAcSolution) {
const volResult = this.updateSjmbrynd(item, targetAcSolution);
const volResult = this.updateSjmbrynd(item, targetAcSolution,params);
if (!volResult) { if (!volResult) {
return return
} }
@ -501,12 +525,14 @@ export default {
const { row, selectedId } = selectInfo; const { row, selectedId } = selectInfo;
if (key === "actStartSolutionCode") {// if (key === "actStartSolutionCode") {//
const tableRef = this.$refs[`paralleStepTableRef_${configIndex}`][0]; const tableRef = this.$refs[`paralleStepTableRef_${configIndex}`][0];
const params = this.getParalleNdParamsByIndex(rowData,configIndex);
if (tableRef) { if (tableRef) {
const volResult = this.updateSjmbrynd(rowData, row.nd);
const volResult = this.updateSjmbrynd(rowData, row.nd,params);
//code //code
tableRef.updateDataSourceByRowIndex(rowIndex, { tableRef.updateDataSourceByRowIndex(rowIndex, {
actStartSolutionCode: selectedId, actStartSolutionCode: selectedId,
targetAcSolution: row.nd, targetAcSolution: row.nd,
subTargetAcSolutionUnit: row.nddw,
}) })
if (!volResult) { if (!volResult) {
return return
@ -528,7 +554,9 @@ export default {
const packageRef = this.$refs[`${ref}${rowIndex}`][0]; const packageRef = this.$refs[`${ref}${rowIndex}`][0];
if (key === "subStartSolution") { if (key === "subStartSolution") {
packageRef.updateFormData("targetAcSolution", row.nd); packageRef.updateFormData("targetAcSolution", row.nd);
packageRef.updateFormData("subTargetAcSolutionUnit", row.nddw);
packageRef.onValueChangeCompareTo("targetAcSolution", row.nd, "targetStartSolution"); packageRef.onValueChangeCompareTo("targetAcSolution", row.nd, "targetStartSolution");
packageRef.onValueChangeCompareTo("subTargetAcSolutionUnit", row.nddw, "subTargetStartSolution");
this.updateTableNd(row, rowIndex); this.updateTableNd(row, rowIndex);
} }
} }
@ -544,8 +572,9 @@ export default {
}, },
//table //table
updateTableNd(row, rowIndex) { updateTableNd(row, rowIndex) {
const { stepTableFormData = [] } = this.$refs[`ladderStepTableRef_${rowIndex}`][0].getFilledFormData();
const { stepTableFormData = [], headerSelectFields = [] } = this.$refs[`ladderStepTableRef_${rowIndex}`][0].getFilledFormData();
const newData = JSON.parse(JSON.stringify(stepTableFormData)); const newData = JSON.parse(JSON.stringify(stepTableFormData));
const params = this.getLadderNdParamsByIndex(rowIndex);
// //
newData.forEach((item, index) => { newData.forEach((item, index) => {
let initNd = row.nd;// let initNd = row.nd;//
@ -555,7 +584,7 @@ export default {
item.startSolutionCode = newData[index - 1].targetSolutionCode + newData[index - 1].subTargetSolutionCode; item.startSolutionCode = newData[index - 1].targetSolutionCode + newData[index - 1].subTargetSolutionCode;
initNd = newData[index - 1].actSolutionConcentration; initNd = newData[index - 1].actSolutionConcentration;
} }
const volResult = this.updateSjmbrynd(item, initNd);
const volResult = this.updateSjmbrynd(item, initNd,params);
if (!volResult) { if (!volResult) {
return return
} }

+ 10
- 1
src/views/business/comps/template/formConfig/paralleAndLadderConfig.js View File

@ -313,7 +313,12 @@ export const getParallelColumnsConfig = ($this) => {
bodyType: 'inputNumber', bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
bodyDisabled: true, bodyDisabled: true,
compareTo: 'targetStartSolutionConcentration', //比较哪个字段
compareTo: 'targetStartSolutionConcentration', //比较哪个字段
bodySubKey: 'subTargetAcSolutionUnit',
bodySubType:"input",
bodySubCompareTo:"targetStartSolutionConcentrationPrecision",
bodySubFillType:"actFill",
bodySubDisabled: true,
}, },
{ {
label: 'template.sp.sp00456.ysysrytj', label: 'template.sp.sp00456.ysysrytj',
@ -421,6 +426,10 @@ export const getLadderFormConfig = ($this) => {
disabled: true, disabled: true,
maxlength: 10, maxlength: 10,
compareTo: 'targetStartSolution', //比较哪个字段 compareTo: 'targetStartSolution', //比较哪个字段
subKey: "subTargetAcSolutionUnit",
subType:"input",
subDisabled:true,
subCompareTo:"subTargetStartSolution",
}, },
solution: { solution: {
label: 'template.sp.sp00456.xsy', label: 'template.sp.sp00456.xsy',

+ 40
- 26
src/views/business/comps/template/mixins/templateMixin.js View File

@ -434,13 +434,18 @@ export default {
colKey === 'actDiluentVolume' colKey === 'actDiluentVolume'
) { ) {
//实际起始溶液体积和实际目标溶液体积 //实际起始溶液体积和实际目标溶液体积
const {targetAcSolution} =
this.$refs.stepFormPackageRef?.getFilledFormData() //获取实际起始溶液浓度
const {targetAcSolution,subTargetAcSolutionUnit} =
this.$refs.stepFormPackageRef?.getFilledFormData() //获取实际起始溶液浓度
const {headerSelectFields} = this.$refs.stepTableRef?.getFilledFormData();
const p = {
targetStartSolutionUnit:subTargetAcSolutionUnit,
headerSelectFields
}
if (isValueEmpty(targetAcSolution)) { if (isValueEmpty(targetAcSolution)) {
this.$message.error('请先选择起始源溶液') this.$message.error('请先选择起始源溶液')
return return
} else { } else {
const volResult = this.updateSjmbrynd(item, targetAcSolution)
const volResult = this.updateSjmbrynd(item, targetAcSolution,p)
if (!volResult) { if (!volResult) {
return return
} }
@ -450,28 +455,37 @@ export default {
}, },
//计算目标溶液浓度 //计算目标溶液浓度
calcNd(item, targetAcSolution) {
calcNd(item, targetAcSolution,params) {
console.log(params,"ppp")
//targetStartSolutionUnit(实际起始源溶液浓度单位)
const {targetStartSolutionUnit,headerSelectFields} = params;
//actStartSolutionVolumeUnit(实际起始源溶液体积单位)actSolutionVolumeUnit(实际目标溶液体积单位)
//actDiluentVolumeUnit(实际稀释液体积单位)actSolutionConcentrationUnit(实际目标溶液浓度单位)
const {actStartSolutionVolumeUnit,actSolutionVolumeUnit,actDiluentVolumeUnit,actSolutionConcentrationUnit} = headerSelectFields;
//实际源溶液浓度÷(实际终体积÷源溶液加入体积); //实际源溶液浓度÷(实际终体积÷源溶液加入体积);
const precision = item.actSolutionConcentrationPrecision const precision = item.actSolutionConcentrationPrecision
const volPrecision = item.actSolutionVolumePrecision || 0
const volPrecision = item.actSolutionVolumePrecision;
//实际稀释液体积 //实际稀释液体积
const actDiluentVolume = item.actDiluentVolume const actDiluentVolume = item.actDiluentVolume
//实际起始源溶液体积
const actStartSolutionVolume = item.actStartSolutionVolume const actStartSolutionVolume = item.actStartSolutionVolume
//实际高源溶液加入体积+实际稀释液加入体积
const actVol = (
Number(actStartSolutionVolume) + Number(actDiluentVolume)
).toFixed(volPrecision)
//实际目标溶液体积
// item.actSolutionVolume = actVol
//实际目标溶液浓度
if (isValueEmpty(actDiluentVolume) && isValueEmpty(actStartSolutionVolume)) {
if(isValueEmpty(actStartSolutionVolume) || isValueEmpty(actDiluentVolume) || isValueEmpty(targetStartSolutionUnit)){
return false return false
} }
const converActDiluentVolume = volumeConverter.convert(actDiluentVolume+actDiluentVolumeUnit,actSolutionVolumeUnit)
const converActStartSolutionVolume = volumeConverter.convert(actStartSolutionVolume+actStartSolutionVolumeUnit,actSolutionVolumeUnit)
//实际源溶液加入体积+实际稀释液加入体积
const actVol = (
Number(converActDiluentVolume) + Number(converActStartSolutionVolume)
).toFixed(volPrecision)
const targetStartVolUnit = actSolutionConcentrationUnit.split("/")[1];//先按照预设目标溶液浓度的单位标准
const converActVol = volumeConverter.convert(actVol+actSolutionVolumeUnit,targetStartVolUnit)
const converActDiluentVolume1 = volumeConverter.convert(actStartSolutionVolume+actStartSolutionVolumeUnit,targetStartVolUnit)
const converTargetAcSolution = convertConcentration.convert(targetAcSolution+targetStartSolutionUnit,actSolutionConcentrationUnit)
// 实际目标溶液浓度 = 实际源溶液浓度÷(实际终体积÷源溶液加入体积); // 实际目标溶液浓度 = 实际源溶液浓度÷(实际终体积÷源溶液加入体积);
const actNd = ( const actNd = (
parseFloat(targetAcSolution) / (
parseFloat(actVol)/parseFloat(actStartSolutionVolume)
parseFloat(converTargetAcSolution) / (
parseFloat(converActVol)/parseFloat(converActDiluentVolume1)
) )
).toFixed(precision) ).toFixed(precision)
const nd = actNd === 'Infinity' ? 0 : Number(actNd) const nd = actNd === 'Infinity' ? 0 : Number(actNd)
@ -481,8 +495,8 @@ export default {
}, },
//计算并更新实际目标溶液浓度 先计算实际目标溶液体积再计算实际目标溶液浓度 //计算并更新实际目标溶液浓度 先计算实际目标溶液体积再计算实际目标溶液浓度
updateSjmbrynd(item, targetAcSolution) {
return this.calcNd(item, targetAcSolution)
updateSjmbrynd(item, targetAcSolution,params) {
return this.calcNd(item, targetAcSolution,params)
}, },
//更新起始溶液体积时,计算预设起始溶液体积和预设稀释液体积 //更新起始溶液体积时,计算预设起始溶液体积和预设稀释液体积
updateTargetStartSolutionVolume(item, volume,unitParams) { updateTargetStartSolutionVolume(item, volume,unitParams) {
@ -491,8 +505,6 @@ export default {
const targetVolume = item.targetSolutionVolume const targetVolume = item.targetSolutionVolume
const {subTargetStartSolution,headerSelectFields} = unitParams const {subTargetStartSolution,headerSelectFields} = unitParams
const {targetSolutionConcentrationUnit,targetSolutionVolumeUnit,targetStartSolutionVolumeUnit,targetDiluentVolumeUnit} = headerSelectFields const {targetSolutionConcentrationUnit,targetSolutionVolumeUnit,targetStartSolutionVolumeUnit,targetDiluentVolumeUnit} = headerSelectFields
const targetStartVolUnit = targetSolutionConcentrationUnit.split("/")[1];//先按照预设目标溶液浓度的单位标准
if( if(
isValueEmpty(concentration) || isValueEmpty(concentration) ||
isValueEmpty(targetVolume)|| isValueEmpty(targetVolume)||
@ -504,26 +516,28 @@ export default {
){ ){
return; return;
} }
const targetStartVolUnit = targetSolutionConcentrationUnit.split("/")[1];//先按照预设目标溶液浓度的单位标准
//将起始溶液浓度转换为和预设目标溶液浓度一样的单位再计算; //将起始溶液浓度转换为和预设目标溶液浓度一样的单位再计算;
const converStartCon = convertConcentration.convert(volume+subTargetStartSolution,targetSolutionConcentrationUnit) const converStartCon = convertConcentration.convert(volume+subTargetStartSolution,targetSolutionConcentrationUnit)
//将预设目标溶液体积转换为和预设目标溶液浓度单位的分母一样的单位再计算;如:预设目标溶液浓度单位为mg/mL,预设目标溶液体积单位为uL,则将预设目标溶液体积转换为mL //将预设目标溶液体积转换为和预设目标溶液浓度单位的分母一样的单位再计算;如:预设目标溶液浓度单位为mg/mL,预设目标溶液体积单位为uL,则将预设目标溶液体积转换为mL
const convertTargetVol = volumeConverter.convert(targetVolume+targetSolutionVolumeUnit,targetStartVolUnit) const convertTargetVol = volumeConverter.convert(targetVolume+targetSolutionVolumeUnit,targetStartVolUnit)
//预设起始溶液体积:(目标溶液预计浓度 乘以 目标溶液预计体积)除以 起始溶液浓度 //预设起始溶液体积:(目标溶液预计浓度 乘以 目标溶液预计体积)除以 起始溶液浓度
const result = Number(((concentration * convertTargetVol) / converStartCon).toFixed(
precision
))
const result = Number((concentration * convertTargetVol) / converStartCon)
//根据预设起始溶液体积单位转换计算后的数据 //根据预设起始溶液体积单位转换计算后的数据
const convertYsVol = volumeConverter.convert(result+targetStartVolUnit,targetStartSolutionVolumeUnit) const convertYsVol = volumeConverter.convert(result+targetStartVolUnit,targetStartSolutionVolumeUnit)
item.targetStartSolutionVolume = convertYsVol
item.targetStartSolutionVolume = Number(convertYsVol.toFixed(
precision
))
// this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetStartSolutionVolume: result }); // this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetStartSolutionVolume: result });
if (targetVolume) { if (targetVolume) {
//预设稀释液体积:目标溶液预计体积 减去 源溶液预计体积; //预设稀释液体积:目标溶液预计体积 减去 源溶液预计体积;
const precision1 = item.targetDiluentVolumePrecision || 0; const precision1 = item.targetDiluentVolumePrecision || 0;
//将预设目标溶液体积转换为和预设起始溶液体积单位一样的单位再计算; //将预设目标溶液体积转换为和预设起始溶液体积单位一样的单位再计算;
const convertTargetVol1 = volumeConverter.convert(targetVolume+targetSolutionVolumeUnit,targetStartSolutionVolumeUnit) const convertTargetVol1 = volumeConverter.convert(targetVolume+targetSolutionVolumeUnit,targetStartSolutionVolumeUnit)
const result1 = (convertTargetVol1 - convertYsVol).toFixed(precision1)
item.targetDiluentVolume = volumeConverter.convert(result1+targetStartSolutionVolumeUnit,targetDiluentVolumeUnit)
const result1 = (convertTargetVol1 - convertYsVol)
item.targetDiluentVolume = Number(volumeConverter.convert(result1+targetStartSolutionVolumeUnit,targetDiluentVolumeUnit).toFixed(precision1))
// this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetDiluentVolume: result1 }); // this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetDiluentVolume: result1 });
} }
}, },

Loading…
Cancel
Save