diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue
index bd63a94..3ac969c 100644
--- a/src/components/Template/CustomTable.vue
+++ b/src/components/Template/CustomTable.vue
@@ -73,7 +73,7 @@
:fieldItemLabel="fieldItemLabel" type="select" class="body-select"
@blur="onBlur(rowIndex, col.prop, $event)"
:item="getBodyItem(col, rowIndex)" v-model="row[col.prop]"
- @change="onBodyValueChange(rowIndex, colIndex, $event)"
+ @change="onBodyValueChange(rowIndex, colIndex, $event,row,'select')"
:error="hasError(rowIndex, colIndex, col.prop)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
@@ -135,7 +135,7 @@
@blur="onSubBlur(rowIndex, col.bodySubKey, $event)"
@copy="onCopy(rowIndex, col)" :item="getBodySubItem(col)"
v-model="row[col.bodySubKey]"
- @change="onBodySubValueChange(rowIndex, colIndex, $event)"
+ @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)" />
@@ -145,7 +145,7 @@
:fieldItemLabel="fieldItemLabel" type="select" class="body-select"
@blur="onSubBlur(rowIndex, col.bodySubKey, $event)"
:item="getBodySubItem(col, rowIndex)" v-model="row[col.bodySubKey]"
- @change="onBodySubValueChange(rowIndex, colIndex, $event)"
+ @change="onBodySubValueChange(rowIndex, colIndex, $event,row,'select')"
:error="hasError(rowIndex, colIndex, col.bodySubKey)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.bodySubKey)" />
@@ -506,12 +506,11 @@ export default {
},
// 表头选择器变化
onHeaderSelectChange(col, value) {
- console.log(col,"ccc")
if (col.headerSelectTo) {
this.headerSelectFields[col.headerSelectTo] = value;
}
this.headerSelectFields[col.headerSelectKey] = value;
- console.log(this.headerSelectFields, "this.headerSelectFields")
+ this.$emit('headerSelectChange', {key:col.headerSelectKey, headerSelectFields:this.headerSelectFields,dataSource:this.localDataSource});
// 输入时清除对应表单项的错误状态
this.formErrors = this.formErrors.filter(error =>
!(error.rowIndex === -1 &&
@@ -573,7 +572,7 @@ export default {
},
// 表体值变化
- onBodyValueChange(rowIndex, colIndex, value) {
+ onBodyValueChange(rowIndex, colIndex, value,row,type) {
const col = this.columns[colIndex];
this.localDataSource[rowIndex][col.prop] = value;
@@ -586,10 +585,12 @@ export default {
error.colIndex === colIndex &&
error.field === col.prop)
);
- this.$emit('body-value-change', rowIndex, colIndex, value);
+ if(type === "select"){
+ this.$emit('bodySelectChange', {rowIndex,item:row, colIndex, value,key:col.prop,dataSource:this.localDataSource,headerSelectFields:this.headerSelectFields});
+ }
},
// 表体子值变化
- onBodySubValueChange(rowIndex, colIndex, value) {
+ onBodySubValueChange(rowIndex, colIndex, value,row,type) {
const col = this.columns[colIndex];
this.localDataSource[rowIndex][col.bodySubKey] = value;
@@ -612,7 +613,9 @@ export default {
error.colIndex === colIndex &&
error.field === col.bodySubKey)
);
- this.$emit('body-sub-value-change', rowIndex, colIndex, value);
+ if(type === "select"){
+ this.$emit('bodySelectChange', {rowIndex,item:row, colIndex, value,key:col.bodySubKey,dataSource:this.localDataSource,headerSelectFields:this.headerSelectFields});
+ }
},
getHeaderItem(col) {
return {
diff --git a/src/components/Template/mixins/formPackageMixins.js b/src/components/Template/mixins/formPackageMixins.js
index 410fd05..d30f4e7 100644
--- a/src/components/Template/mixins/formPackageMixins.js
+++ b/src/components/Template/mixins/formPackageMixins.js
@@ -54,7 +54,7 @@ export default {
}
this.onValueChangeCompareTo(key, val);
this.formFields[key] = val;
- this.$emit("select", { key, value: val, type });
+ this.$emit("select", { key, value: val, type,...this.formFields });
// 清除该表单项的错误状态
if (this.errors[key]) {
this.$set(this.errors, key, false);
diff --git a/src/views/business/comps/template/comps/sp/SP003.vue b/src/views/business/comps/template/comps/sp/SP003.vue
index e449508..cdb2e56 100644
--- a/src/views/business/comps/template/comps/sp/SP003.vue
+++ b/src/views/business/comps/template/comps/sp/SP003.vue
@@ -18,10 +18,13 @@
-
onBeforeReagentSubmit(data,ladderIndex, ladderConfig)"
:ref="`ladderStepFormPackageRef_${ladderIndex}`" :formConfig="ladderStepFormConfig"
:formData="ladderConfig" :fieldItemLabel="$t('template.common.jtpz')"
+ @blur="(e) => onHandleBlur(e,'ladder', ladderIndex)"
+ @select = "(e) => onHandleBlur(e,'ladder', ladderIndex)"
:prefixKey="'ladder_' + ladderIndex" />
onHandleTableBlur('ladder', ladderIndex, e)"
:ref="`ladderStepTableRef_${ladderIndex}`" :showOperation="fillType === 'actFill' || fillType === 'preFill'"
:columns="ladderStepColumns" :formData="ladderConfig"
+ @headerSelectChange="(data)=>onHeaderSelectChange(data,'ladder',ladderIndex)"
:prefixKey="'ladder_' + ladderIndex" :fieldItemLabel="$t('template.common.jtpz')">
printTag(e, 'ladderConfigs', ladderIndex)"
@@ -77,6 +80,8 @@
onHandleTableBlur('paralle', paralleIndex, e)"
:ref="`paralleStepTableRef_${paralleIndex}`" :showOperation="fillType === 'actFill' || fillType === 'preFill'"
:columns="paralleStepColumns"
+ @bodySelectChange = "bodySelectChange"
+ @headerSelectChange="(data)=>onHeaderSelectChange(data,'paralle',paralleIndex)"
@beforeReagentSubmit="(data) => onTableBeforeReagentSubmit(data, paralleIndex, paralleConfig)"
@onRegentSubmit="(data) => onTableRegentSubmit('paralle', paralleIndex, data)"
:formData="paralleConfig" :prefixKey="'paralle' + paralleIndex"
@@ -194,7 +199,56 @@ export default {
}
},
methods: {
-
+ bodySelectChange(data){
+ this.paralleUpdateTargetStartSolutionVolume(data.item,data.headerSelectFields);
+ },
+ //平行配置更新体积
+ paralleUpdateTargetStartSolutionVolume(item,headerSelectFields){
+ const volumne = item.targetStartSolutionConcentration;
+ const subTargetStartSolution = item.targetStartSolutionConcentrationPrecision;
+ const params = {
+ headerSelectFields,
+ subTargetStartSolution
+ }
+ if (volumne) {
+ this.updateTargetStartSolutionVolume(item, volumne,params);
+ }
+ },
+ onHandleBlur(e,type,configIndex){
+ const {targetStartSolution,subTargetStartSolution} = e;
+ const {stepTableFormData,headerSelectFields} = this.$refs[`ladderStepTableRef_${configIndex}`][0]?.getFilledFormData();
+ const params = {
+ subTargetStartSolution,
+ headerSelectFields
+ }
+ this.batchUpdateTargetStartSolutionVolume(stepTableFormData,targetStartSolution,params)
+ },
+ //选择table header下拉框也要更新体积
+ onHeaderSelectChange(data,type,configIndex){
+ const {key, headerSelectFields,dataSource=[]} = data;
+ const keys = [
+ 'targetStartSolutionVolumeUnit',
+ 'targetDiluentVolumeUnit',
+ 'targetSolutionConcentrationUnit',
+ 'targetSolutionVolumeUnit',
+ ]
+ console.log(key,"key")
+ if(keys.includes(key)){
+ if(type === 'ladder'){
+ const {targetStartSolution,subTargetStartSolution} = this.$refs[`ladderStepFormPackageRef_${configIndex}`][0]?.getFilledFormData();
+ const params = {
+ subTargetStartSolution,
+ headerSelectFields
+ }
+ this.batchUpdateTargetStartSolutionVolume(dataSource,targetStartSolution,params)
+ }else{
+ dataSource.forEach(item => {
+ this.paralleUpdateTargetStartSolutionVolume(item,headerSelectFields);
+ })
+ }
+
+ }
+ },
//分装
subPackageSubmit(data, configType, index) {
const { fzsj, rowData, headerSelectFields } = data;
@@ -390,18 +444,19 @@ export default {
// 表格失去焦点事件
onHandleTableBlur(type, configIndex, e) {
- const { colKey = "", item, rowIndex } = e;
+ const { colKey = "", item, rowIndex,headerSelectFields } = e;
if (colKey === "targetStartSolutionConcentration" || colKey === "targetSolutionVolume" || colKey === "targetSolutionConcentration" || colKey === "targetStartSolutionVolumePrecision" || colKey === "targetDiluentVolumePrecision") {
if (type === "ladder") {
- const volume = this.$refs[`ladderStepFormPackageRef_${configIndex}`][0]?.getFormDataByKey("targetStartSolution") || 0;
- if (volume) {
- this.updateTargetStartSolutionVolume(item, volume);
+ const {targetStartSolution,subTargetStartSolution} = this.$refs[`ladderStepFormPackageRef_${configIndex}`][0]?.getFilledFormData();
+ const params = {
+ subTargetStartSolution,
+ headerSelectFields
}
- } else if (type === "paralle") {
- const volumne = item.targetStartSolutionConcentration || 0;
- if (volumne) {
- this.updateTargetStartSolutionVolume(item, volumne);
+ if (targetStartSolution) {
+ this.updateTargetStartSolutionVolume(item, targetStartSolution,params);
}
+ } else if (type === "paralle") {
+ this.paralleUpdateTargetStartSolutionVolume(item,headerSelectFields);
}
} else if (colKey === "actStartSolutionVolume" || colKey === "actDiluentVolume") {//实际起始溶液体积和实际目标溶液体积
if (type === "ladder") {
diff --git a/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js b/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
index f7d5f11..0db7ca8 100644
--- a/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
+++ b/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js
@@ -356,7 +356,7 @@ export const getParallelColumnsConfig = ($this) => {
{
label: 'template.sp.sp00456.yjxsytj',
prop: 'targetDiluentVolume',
- headerSelectKey: 'preDiluentVolumeUnit',
+ headerSelectKey: 'targetDiluentVolumeUnit',
fillType: 'preFill',
headerOptions: $this.getDictOptions('business_tjdw'),
width: 280,
diff --git a/src/views/business/comps/template/mixins/templateMixin.js b/src/views/business/comps/template/mixins/templateMixin.js
index 87ba982..bc47942 100644
--- a/src/views/business/comps/template/mixins/templateMixin.js
+++ b/src/views/business/comps/template/mixins/templateMixin.js
@@ -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 });
}
}