diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue
index d7b621a..f090cfe 100644
--- a/src/components/Template/CustomTable.vue
+++ b/src/components/Template/CustomTable.vue
@@ -142,6 +142,17 @@
@update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.bodySubKey)" />
+
+
+
({ prex: item.targetSolutionCode, type: 1 }));
+ const codes = stepTableFormData.map((item) => ({ pre: item.targetSolutionCode, type: 1 }));
const snList = await this.getLatestSnArr(codes);
tableDataArray.forEach((row, idx) => {
let expDate = {};
diff --git a/src/views/business/comps/template/comps/gsp/GSP004.vue b/src/views/business/comps/template/comps/gsp/GSP004.vue
index a2faaa4..32952d7 100644
--- a/src/views/business/comps/template/comps/gsp/GSP004.vue
+++ b/src/views/business/comps/template/comps/gsp/GSP004.vue
@@ -601,7 +601,7 @@ export default {
row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== '');
// 如果没有任何一行有值,则为所有行分配编号
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);
tableDataArray.forEach((row, idx) => {
let expDate = {};
diff --git a/src/views/business/comps/template/comps/sp/SP003.vue b/src/views/business/comps/template/comps/sp/SP003.vue
index c2c02e2..9c84f7f 100644
--- a/src/views/business/comps/template/comps/sp/SP003.vue
+++ b/src/views/business/comps/template/comps/sp/SP003.vue
@@ -475,7 +475,12 @@ export default {
if (key === "subStartSolution") {//选择起始源溶液需要同步更新table的变更记录。
this.$refs.stepFormPackageRef.updateFormData("targetAcSolution", row.nd);
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) {
@@ -546,7 +551,7 @@ export default {
if (hasAnyWithValue) {
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);
stepTableFormData.forEach((item, index) => {
this.$refs.stepTableRef.updateDataSourceByRowIndex(index, { subTargetSolutionCode: snList[index] });
@@ -569,7 +574,7 @@ export default {
return this.getFilledFormDataByRefs(["baseInfoRef", "stepFormPackageRef", "stepRef", "remarkRef", "stepTableRef"])
},
//更新table数据
- updateStepTableData(row) {
+ updateStepTableData(row,params) {
const { stepTableFormData = [] } = this.$refs.stepTableRef.getFilledFormData();
// 创建新的表格数据副本
@@ -588,7 +593,7 @@ export default {
newStepTableData[i].startSolutionCode = newStepTableData[i - 1].targetSolutionCode + newStepTableData[i - 1].subTargetSolutionCode;
initNd = newStepTableData[i - 1].actSolutionConcentration;
}
- const volResult = this.updateSjmbrynd(item, initNd);
+ const volResult = this.updateSjmbrynd(item, initNd,params);
if (!volResult) {
continue
}
diff --git a/src/views/business/comps/template/comps/sp/SP00456.vue b/src/views/business/comps/template/comps/sp/SP00456.vue
index d59b113..2a9b66c 100644
--- a/src/views/business/comps/template/comps/sp/SP00456.vue
+++ b/src/views/business/comps/template/comps/sp/SP00456.vue
@@ -42,6 +42,7 @@
onHandleTableBlur('ladder', ladderIndex, e)"
:ref="`ladderStepTableRef_${ladderIndex}`" :showOperation="fillType === 'actFill' || fillType === 'preFill'"
:columns="ladderStepColumns" :formData="ladderConfig"
+ @beforeSaveRecord = "(data) => onBeforeSaveRecord(data,'ladder',ladderIndex)"
@headerSelectChange="(data)=>onHeaderSelectChange(data,'ladder',ladderIndex)"
:prefixKey="'ladder_' + ladderIndex" :fieldItemLabel="$t('template.common.jtpz')">
@@ -199,6 +200,12 @@ export default {
}
},
methods: {
+ onBeforeSaveRecord(data,type,configIndex){
+ if(type === "ladder"){
+ const formFields = this.$refs[`ladderStepFormPackageRef_${configIndex}`][0]?.getFilledFormData();
+ this.onCommonVerifyNdException(formFields,data);
+ }
+ },
bodySelectChange(data){
this.paralleUpdateTargetStartSolutionVolume(data.item,data.headerSelectFields);
},
@@ -346,7 +353,7 @@ export default {
row.subTargetSolutionCode && row.subTargetSolutionCode.trim() !== '');
// 如果没有任何一行有值,则为所有行分配编号
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);
tableDataArray.forEach((row, idx) => {
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) {
@@ -460,10 +483,10 @@ export default {
}
} else if (colKey === "actStartSolutionVolume" || colKey === "actDiluentVolume") {//实际起始溶液体积和实际目标溶液体积
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) {
- const volResult = this.updateSjmbrynd(item, targetAcSolution,rowIndex,dataSource,"ladder");
+ const volResult = this.updateSjmbrynd(item, targetAcSolution,params);
if (!volResult) {
return
}
@@ -474,8 +497,9 @@ export default {
}
} else if (type === "paralle") {
const targetAcSolution = item.targetAcSolution || 0;//获取实际起始溶液浓度
+ const params = this.getParalleNdParamsByIndex(item,configIndex);
if (targetAcSolution) {
- const volResult = this.updateSjmbrynd(item, targetAcSolution);
+ const volResult = this.updateSjmbrynd(item, targetAcSolution,params);
if (!volResult) {
return
}
@@ -501,12 +525,14 @@ export default {
const { row, selectedId } = selectInfo;
if (key === "actStartSolutionCode") {//实际原始溶液编号点击事件
const tableRef = this.$refs[`paralleStepTableRef_${configIndex}`][0];
+ const params = this.getParalleNdParamsByIndex(rowData,configIndex);
if (tableRef) {
- const volResult = this.updateSjmbrynd(rowData, row.nd);
+ const volResult = this.updateSjmbrynd(rowData, row.nd,params);
//第一次选择溶液的时候,可能其他值没填入,就需要先把浓度和code一起更新
tableRef.updateDataSourceByRowIndex(rowIndex, {
actStartSolutionCode: selectedId,
targetAcSolution: row.nd,
+ subTargetAcSolutionUnit: row.nddw,
})
if (!volResult) {
return
@@ -528,7 +554,9 @@ export default {
const packageRef = this.$refs[`${ref}${rowIndex}`][0];
if (key === "subStartSolution") {
packageRef.updateFormData("targetAcSolution", row.nd);
+ packageRef.updateFormData("subTargetAcSolutionUnit", row.nddw);
packageRef.onValueChangeCompareTo("targetAcSolution", row.nd, "targetStartSolution");
+ packageRef.onValueChangeCompareTo("subTargetAcSolutionUnit", row.nddw, "subTargetStartSolution");
this.updateTableNd(row, rowIndex);
}
}
@@ -544,8 +572,9 @@ export default {
},
//选择实际的时候更新table的浓度
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 params = this.getLadderNdParamsByIndex(rowIndex);
// 遍历数据,按要求更新起始溶液编号
newData.forEach((item, index) => {
let initNd = row.nd;//起始浓度是上一条记录的实际目标溶液浓度
@@ -555,7 +584,7 @@ export default {
item.startSolutionCode = newData[index - 1].targetSolutionCode + newData[index - 1].subTargetSolutionCode;
initNd = newData[index - 1].actSolutionConcentration;
}
- const volResult = this.updateSjmbrynd(item, initNd);
+ const volResult = this.updateSjmbrynd(item, initNd,params);
if (!volResult) {
return
}
diff --git a/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js b/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
index 0db7ca8..46dbf25 100644
--- a/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
+++ b/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
@@ -313,7 +313,12 @@ export const getParallelColumnsConfig = ($this) => {
bodyType: 'inputNumber',
bodyFillType: 'actFill',
bodyDisabled: true,
- compareTo: 'targetStartSolutionConcentration', //比较哪个字段
+ compareTo: 'targetStartSolutionConcentration', //比较哪个字段
+ bodySubKey: 'subTargetAcSolutionUnit',
+ bodySubType:"input",
+ bodySubCompareTo:"targetStartSolutionConcentrationPrecision",
+ bodySubFillType:"actFill",
+ bodySubDisabled: true,
},
{
label: 'template.sp.sp00456.ysysrytj',
@@ -421,6 +426,10 @@ export const getLadderFormConfig = ($this) => {
disabled: true,
maxlength: 10,
compareTo: 'targetStartSolution', //比较哪个字段
+ subKey: "subTargetAcSolutionUnit",
+ subType:"input",
+ subDisabled:true,
+ subCompareTo:"subTargetStartSolution",
},
solution: {
label: 'template.sp.sp00456.xsy',
diff --git a/src/views/business/comps/template/mixins/templateMixin.js b/src/views/business/comps/template/mixins/templateMixin.js
index a10174d..870f6bf 100644
--- a/src/views/business/comps/template/mixins/templateMixin.js
+++ b/src/views/business/comps/template/mixins/templateMixin.js
@@ -434,13 +434,18 @@ export default {
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)) {
this.$message.error('请先选择起始源溶液')
return
} else {
- const volResult = this.updateSjmbrynd(item, targetAcSolution)
+ const volResult = this.updateSjmbrynd(item, targetAcSolution,p)
if (!volResult) {
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 volPrecision = item.actSolutionVolumePrecision || 0
+ const volPrecision = item.actSolutionVolumePrecision;
//实际稀释液体积
const actDiluentVolume = item.actDiluentVolume
+ //实际起始源溶液体积
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
}
+ 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 = (
- parseFloat(targetAcSolution) / (
- parseFloat(actVol)/parseFloat(actStartSolutionVolume)
+ parseFloat(converTargetAcSolution) / (
+ parseFloat(converActVol)/parseFloat(converActDiluentVolume1)
)
).toFixed(precision)
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) {
@@ -491,8 +505,6 @@ export default {
const targetVolume = item.targetSolutionVolume
const {subTargetStartSolution,headerSelectFields} = unitParams
const {targetSolutionConcentrationUnit,targetSolutionVolumeUnit,targetStartSolutionVolumeUnit,targetDiluentVolumeUnit} = headerSelectFields
- const targetStartVolUnit = targetSolutionConcentrationUnit.split("/")[1];//先按照预设目标溶液浓度的单位标准
-
if(
isValueEmpty(concentration) ||
isValueEmpty(targetVolume)||
@@ -504,26 +516,28 @@ export default {
){
return;
}
+ const targetStartVolUnit = targetSolutionConcentrationUnit.split("/")[1];//先按照预设目标溶液浓度的单位标准
+
//将起始溶液浓度转换为和预设目标溶液浓度一样的单位再计算;
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
- ))
+ const result = Number((concentration * convertTargetVol) / converStartCon)
//根据预设起始溶液体积单位转换计算后的数据
const convertYsVol = volumeConverter.convert(result+targetStartVolUnit,targetStartSolutionVolumeUnit)
- item.targetStartSolutionVolume = convertYsVol
+ 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).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 });
}
},