diff --git a/src/components/Template/StepComponents/ry/bdzl.vue b/src/components/Template/StepComponents/ry/bdzl.vue
index 8c72742..aafa222 100644
--- a/src/components/Template/StepComponents/ry/bdzl.vue
+++ b/src/components/Template/StepComponents/ry/bdzl.vue
@@ -1,6 +1,6 @@
-
+
diff --git a/src/components/Template/StepComponents/ry/tpjysd.vue b/src/components/Template/StepComponents/ry/tpjysd.vue
index 6b827d6..adb41ca 100644
--- a/src/components/Template/StepComponents/ry/tpjysd.vue
+++ b/src/components/Template/StepComponents/ry/tpjysd.vue
@@ -1,7 +1,7 @@
+ @resetRecord="resetRecord" @clickButton="onHandleClickButton" @beforeSaveRecord="onBeforeSaveRecord" :form-config="formConfig" :formData="formData" />
diff --git a/src/components/Template/StepFormPackage.vue b/src/components/Template/StepFormPackage.vue
index f4ef7b9..9bdd619 100644
--- a/src/components/Template/StepFormPackage.vue
+++ b/src/components/Template/StepFormPackage.vue
@@ -5,35 +5,37 @@
onBeforeSaveRecord(data, callback,sItem)"
:field-key="prefixKey+'_' + key"
:item="getButtonItem(sItem)"
- @clickButton="(e)=>handleClickButton(e,item,key)" />
+ @clickButton="(e,v,data)=>handleClickButton(e,item,key,data)" />
@@ -151,6 +153,9 @@ export default {
this.allFieldsConfig[key].sjSelectType = data.selectType;
}
this.formFields[`selectInfo_${key}`] = data.selectInfo;
+ if(data.type === "yq"){
+ this.formFields[`yqInfo_${key}`] = data.row;
+ }
this.$emit("onRegentSubmit", {selectInfo:data,key,config:item});
},
getRegentItem(item,fieldCode="type"){
@@ -262,7 +267,7 @@ export default {
}
},
// 点击按钮
- handleClickButton(e,item,key){
+ handleClickButton(e,item,key,data){
const {buttonName = ""} = e;
const {config} = item;
if(buttonName === '开始' && config.hasOwnProperty("startDate")){
@@ -270,7 +275,7 @@ export default {
}else if(buttonName === '结束' && config.hasOwnProperty("endDate")){
this.updateFormData("endDate",moment().format('YYYY-MM-DD HH:mm'))
}
- this.$emit("clickButton",e,item,key)
+ this.$emit("clickButton",e,item,key,data)
},
// 获取按钮项
getButtonItem(sItem) {
diff --git a/src/components/Template/mixins/formPackageMixins.js b/src/components/Template/mixins/formPackageMixins.js
index 36806cb..d44cea9 100644
--- a/src/components/Template/mixins/formPackageMixins.js
+++ b/src/components/Template/mixins/formPackageMixins.js
@@ -20,7 +20,6 @@ export default {
deep: true, // 深度监听,以便检测嵌套对象变化
handler(v) {
if (v) {
- console.log(v, 'fieldItemLabel')
}
}
},
@@ -79,6 +78,9 @@ export default {
onRegentSubmit(data, inputValue, key, item) {
this.updateFormData(key, inputValue)
this.formFields[`selectInfo_${key}`] = data.selectInfo;
+ if(data.type === "yq"){
+ this.formFields[`yqInfo_${key}`] = data.row;
+ }
this.$emit('onRegentSubmit', {
selectInfo: data,
inputValue,
@@ -394,11 +396,14 @@ export default {
})
// 处理selectInfo_开头的字段,步骤表单需要保留selectInfo_开头的字段
// 优先使用this.formFields中以selectInfo_开头的字段
- let selectInfoKeys = []
+ let selectInfoKeys = [],yqInfoKeys = [];
if (this.formFields) {
selectInfoKeys = Object.keys(this.formFields).filter((key) =>
key.startsWith('selectInfo_')
)
+ yqInfoKeys = Object.keys(this.formFields).filter((key) =>
+ key.startsWith('yqInfo_')
+ )
}
// 如果this.formFields中没有,则使用formData中的
if (selectInfoKeys.length === 0 && formData) {
@@ -406,9 +411,17 @@ export default {
key.startsWith('selectInfo_')
)
}
+ if (yqInfoKeys.length === 0 && formData) {
+ yqInfoKeys = Object.keys(formData).filter((key) =>
+ key.startsWith('yqInfo_')
+ )
+ }
selectInfoKeys.forEach((key) => {
result[key] = this.formFields[key] || formData[key] || ''
})
+ yqInfoKeys.forEach((key) => {
+ result[key] = this.formFields[key] || formData[key] || ''
+ })
// 更新表单字段
this.formFields = { ...result }
this.allFieldsConfig = config
@@ -615,6 +628,7 @@ export default {
errors: errors
}
},
+ // 校验表单数据
getFormData() {
// 同时执行数据校验和子组件校验
const validateResult = this.validateFormData()
@@ -647,6 +661,9 @@ export default {
getFormDataByKey(key) {
return this.formFields[key]
},
+ onBeforeSaveRecord(data, callback, item){
+ this.$emit('beforeSaveRecord', {data, callback,item})
+ },
onBlur(key, val) {
// compareTo 功能:当fillType==="actFill"时,判断当前值是否与compareTo字段的值一样,如果不一样则将当前input框的背景色标记成橙色
this.onValueChangeCompareTo(key, val)
diff --git a/src/components/Template/mixins/stepMixins.js b/src/components/Template/mixins/stepMixins.js
index 3cb1110..d617fde 100644
--- a/src/components/Template/mixins/stepMixins.js
+++ b/src/components/Template/mixins/stepMixins.js
@@ -1,6 +1,7 @@
import { getuuid, justUpdateFilledFormData } from '@/utils/index.js'
import { EventBus } from '@/utils/eventBus'
import { getLatestSn, getLatestSnArr } from '@/api/template'
+import { getBalance } from '@/utils/tpph.js';
export default {
inject: {
templateFillType: { default: 'preFill' },
@@ -150,8 +151,23 @@ export default {
this.justUpdateFilledFormData();
}
},
+ onBeforeSaveRecord(params) {
+ const { callback, item } = params
+
+ const { buttonName } = item;
+ if (buttonName === '获取值') {
+ const { dataSource, yqCode } = item;
+ if (dataSource === "tp") {//电子天平
+ const stepFormData = this.getFilledFormData()
+ const yq = stepFormData[yqCode] || "";
+ if (!yq) {
+ callback.prevent("请选择电子天平")
+ }
+ }
+ }
+ },
// 点击按钮
- onHandleClickButton(e, item, key) {
+ async onHandleClickButton(e, item, key,signData) {
const {
buttonName = '',
myCodeFields = [],
@@ -201,8 +217,22 @@ export default {
maxVolumeUnit,
uuid: this.uuid,
})
- }else if(buttonName === '获取值'){
- console.log(e,"iii")
+ } else if (buttonName === '获取值') {
+ const { dataSource, dwField = "", fillField, yqCode } = e;
+ if (dataSource === "tp") {//电子天平
+ const stepFormData = this.getFilledFormData()
+ const yqInfo = stepFormData[`yqInfo_${yqCode}`] || {};
+ const dw = stepFormData[dwField] || "";
+
+ const result = await getBalance({ yq: yqInfo, dw });
+ if (result.success) {
+ const value = dw?result.value:`${result.value}${result.unit}`
+ this.$refs.stepFormPackageRef.updateFormData(fillField, value,{isUpdateRecord:true,signData})
+ } else {
+ this.$message.error(result.message || "获取值失败");
+ }
+
+ }
}
},
diff --git a/src/views/business/comps/template/comps/sp/comps/LadderConfig.vue b/src/views/business/comps/template/comps/sp/comps/LadderConfig.vue
index eb93087..d0c5d17 100644
--- a/src/views/business/comps/template/comps/sp/comps/LadderConfig.vue
+++ b/src/views/business/comps/template/comps/sp/comps/LadderConfig.vue
@@ -54,6 +54,7 @@ export default {
TableOpertaion,
BaseInfoFormPackage,
},
+ inject:["templateData"],
name: "LadderConfig",
mixins: [templateMixin],
props: {
@@ -342,9 +343,9 @@ export default {
const { rowData } = val;
let postData = {
bh: rowData.targetSolutionCode + rowData.subTargetSolutionCode,
- studySubjectId: this.currentFormData.studySubjectId,
- studyId: this.currentFormData.studyId,
- studyFormId: this.currentFormData.id,
+ studySubjectId: this.templateData.studySubjectId,
+ studyId: this.templateData.studyId,
+ studyFormId: this.templateData.id,
}
this.startConfigRequest(postData);
},
@@ -358,9 +359,9 @@ export default {
bh: rowData.targetSolutionCode + rowData.subTargetSolutionCode,
nd: rowData.actSolutionConcentration,//实际目标溶液浓度
nddw: headerSelectFields.actSolutionConcentrationUnit,
- studySubjectId: this.currentFormData.studySubjectId,
- studyId: this.currentFormData.studyId,
- studyFormId: this.currentFormData.id,
+ studySubjectId: this.templateData.studySubjectId,
+ studyId: this.templateData.studyId,
+ studyFormId: this.templateData.id,
kc: total,
kcdw: unit,
}
@@ -379,14 +380,12 @@ export default {
}
})
let postData = {
- studyId: this.currentFormData.studyId,
- studyFormId: this.currentFormData.id,
+ studyId: this.templateData.studyId,
+ studyFormId: this.templateData.id,
bh: mybh,
nd: rowData.actSolutionConcentration || 0,
nddw: headerSelectFields.actSolutionConcentrationUnit,
- studySubjectId: this.currentFormData.studySubjectId,
- studyId: this.currentFormData.studyId,
- studyFormId: this.currentFormData.id,
+ studySubjectId: this.templateData.studySubjectId,
list: list
}
this.subPackageRequest(postData);
diff --git a/src/views/business/comps/template/dialog/SelectInstrumentDialog.vue b/src/views/business/comps/template/dialog/SelectInstrumentDialog.vue
index a14d1e7..f22b9b1 100644
--- a/src/views/business/comps/template/dialog/SelectInstrumentDialog.vue
+++ b/src/views/business/comps/template/dialog/SelectInstrumentDialog.vue
@@ -121,7 +121,7 @@ export default {
jzrq: row.jzrq,
}
// 触发eventBus事件
- EventBus.$emit("onInstrumentSubmit",{selectInfo,uuid:this.uuid,selectedId:this.selectedId,row});
+ EventBus.$emit("onInstrumentSubmit",{selectInfo,uuid:this.uuid,selectedId:this.selectedId,row,type:"yq"});
this.visible = false;
},
handleSelect(code,row) {
diff --git a/src/views/business/comps/template/mixins/templateMixin.js b/src/views/business/comps/template/mixins/templateMixin.js
index 6d9c539..647bd2e 100644
--- a/src/views/business/comps/template/mixins/templateMixin.js
+++ b/src/views/business/comps/template/mixins/templateMixin.js
@@ -294,7 +294,7 @@ export default {
//试剂弹窗确认前
onBeforeReagentSubmit(data) {
const { selectData, callback, key, formFields } = data
- const { subTargetStartSolution, targetStartSolution } = formFields
+ const { subTargetStartSolution = "", targetStartSolution = "" } = formFields
const { nd } = selectData.row
const sjndArr = nd.split('/')
const ytndArr = targetStartSolution.split('/')