diff --git a/src/components/Template/StepFormPackage.vue b/src/components/Template/StepFormPackage.vue index fca5752..4b2690e 100644 --- a/src/components/Template/StepFormPackage.vue +++ b/src/components/Template/StepFormPackage.vue @@ -122,16 +122,15 @@ export default { const item = allFieldsConfig[key]; if(item.type === "xb" || item.type === "regent" || item.type === "gsp" || item.type === "mix"){ if(formFields[key]){ - this.formFields[`selectType_${key}`] = item.sjSelectType; let o = { - type:item.sjSelectType || formFields[`selectType_${key}`] , + ...formFields[`selectInfo_${key}`], value:formFields[key], } if(item.ylCode){ - o.yl = formFields[item.ylCode];//用量 + o.syl = formFields[item.ylCode];//用量 } if(item.dwCode){ - o.dw = formFields[item.dwCode];//单位 + o.syldw = formFields[item.dwCode];//单位 } sjResource.push(o); } @@ -140,11 +139,11 @@ export default { yqResource.push({ type:item.type, value:formFields[key], + ...formFields[`selectInfo_${key}`], }); } } } - console.log(sjResource,"sjResource") return { sjResource, yqResource, @@ -171,21 +170,24 @@ export default { // 处理选择试剂/供试品/给药制剂提交 onMixReagentSubmit(data){ if(data.uuid !== this.uuid) return; - this.formFields[this.currentClickKey] = data.selectedId; + this.updateFormData(this.currentClickKey,data.selectedId) if(data.selectType){ this.allFieldsConfig[this.currentClickKey].sjSelectType = data.selectType; + this.formFields[`selectInfo_${this.currentClickKey}`] = data.selectInfo; } this.$emit("onDialogSubmit",data) }, // 处理选择试剂提交 onReagentSubmit(data){ if(data.uuid !== this.uuid) return; - this.formFields[this.currentClickKey] = data.selectedId; + this.updateFormData(this.currentClickKey,data.selectedId) }, // 处理选择仪器提交,不确定后续还会不会有其他操作,所以和选择试剂提交区分开。 onInstrumentSubmit(data){ if(data.uuid !== this.uuid) return; - this.formFields[this.currentClickKey] = data.selectedId; + this.updateFormData(this.currentClickKey,data.selectedId) + // this.formFields[this.currentClickKey] = data.selectedId; + this.formFields[`selectInfo_${this.currentClickKey}`] = data.selectInfo; }, getClickableItem(sItem) { return { @@ -196,34 +198,55 @@ export default { }, handleClickInstrument(key,type) { this.currentClickKey = key; - if(type === 'regent'){ + if(type === 'regent'){//试剂 EventBus.$emit("showSelectMixReagentDialog",{ studyFormId:this.templateData.id, uuid:this.uuid, sourceFrom:'step', - type:"sj" + type:"1" }) - }else if(type === 'gsp'){ + }else if(type === 'gyzj'){//给药制剂 EventBus.$emit("showSelectMixReagentDialog",{ studyFormId:this.templateData.id, uuid:this.uuid, sourceFrom:'step', - type:"gsp" + type:"3" + }) + }else if(type === 'mjy'){//麻精药 + EventBus.$emit("showSelectMixReagentDialog",{ + studyFormId:this.templateData.id, + uuid:this.uuid, + sourceFrom:'step', + type:"5" + }) + }else if(type === 'gsp'){//供试品 + EventBus.$emit("showSelectMixReagentDialog",{ + studyFormId:this.templateData.id, + uuid:this.uuid, + sourceFrom:'step', + type:"7" }) }else if(type === 'mix'){ EventBus.$emit("showSelectMixReagentDialog",{ studyFormId:this.templateData.id, uuid:this.uuid, sourceFrom:'step', - type:"sj", + type:"1", mixType:true, }) - }else if(type === 'xb'){ + }else if(type === 'xj'){//细菌 + EventBus.$emit("showSelectMixReagentDialog",{ + studyFormId:this.templateData.id, + uuid:this.uuid, + sourceFrom:'step', + type:"9", + }) + }else if(type === 'xb'){//细胞 EventBus.$emit("showSelectMixReagentDialog",{ studyFormId:this.templateData.id, uuid:this.uuid, sourceFrom:'step', - type:"xb", + type:"11", }) }else if(type === 'instrument'){ EventBus.$emit("showSelectInstrumentDialog",{ diff --git a/src/components/Template/mixins/formPackageMixins.js b/src/components/Template/mixins/formPackageMixins.js index c8a8635..310958b 100644 --- a/src/components/Template/mixins/formPackageMixins.js +++ b/src/components/Template/mixins/formPackageMixins.js @@ -34,6 +34,7 @@ export default { data() { return { uuid: getuuid(), + oldFormFields: {}, } }, mounted() { @@ -122,6 +123,7 @@ export default { updateFormData(key, value) { // 深拷贝当前表单数据,避免直接修改原数据 const cloneFormFields = JSON.parse(JSON.stringify(this.formFields)); + this.oldFormFields[key] = cloneFormFields[key]; this.showEditSignDialog(); this.formFields[key] = value; @@ -293,6 +295,11 @@ export default { } } }); + // 处理selectInfo_开头的字段,步骤表单需要保留selectInfo_开头的字段 + const selectInfoKeys = Object.keys(formData).filter(key => key.startsWith("selectInfo_")); + selectInfoKeys.forEach(key => { + result[key] = formData[key]; + }) // 更新表单字段 this.formFields = result; this.allFieldsConfig = config; diff --git a/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue b/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue index bb69a1e..cf41d2b 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue @@ -25,7 +25,7 @@ ref="remarkRef" :formConfig="remarkConig" :formData="formData" /> - + diff --git a/src/views/business/comps/template/dialog/SelectInstrumentDialog.vue b/src/views/business/comps/template/dialog/SelectInstrumentDialog.vue index eae086a..f75d0a5 100644 --- a/src/views/business/comps/template/dialog/SelectInstrumentDialog.vue +++ b/src/views/business/comps/template/dialog/SelectInstrumentDialog.vue @@ -113,8 +113,14 @@ export default { onSubmit() { let row = this.currentRow; this.$emit('submit', this.selectedId,row); + const selectInfo = { + mc: row.mc, + bh: row.bh, + xh: row.xh, + jzrq: row.jzrq, + } // 触发eventBus事件 - EventBus.$emit("onInstrumentSubmit",{uuid:this.uuid,selectedId:this.selectedId,row}); + EventBus.$emit("onInstrumentSubmit",{selectInfo,uuid:this.uuid,selectedId:this.selectedId,row}); this.visible = false; }, handleSelect(code,row) { diff --git a/src/views/business/comps/template/dialog/SelectMixReagentDialog.vue b/src/views/business/comps/template/dialog/SelectMixReagentDialog.vue index 369bb3c..53fb0fb 100644 --- a/src/views/business/comps/template/dialog/SelectMixReagentDialog.vue +++ b/src/views/business/comps/template/dialog/SelectMixReagentDialog.vue @@ -3,9 +3,9 @@ - 试剂列表 - 供试品列表 - 给药制剂列表 + 试剂列表 + 供试品列表 + 给药制剂列表 @@ -29,25 +29,25 @@ import { public_sjList, public_gyzjList, public_gspList, public_xbList } from '@ import { getSjSearchForm, getSjColumns, getGyzjSearchForm, getGyzjColumns, getGspSearchForm, getGspColumns, getXbSearchForm, getXbColumns } from '@/views/business/comps/template/formConfig/formConfig.js'; import { EventBus } from "@/utils/eventBus"; const typeMap = { - sj: { + '1': { searchForm: getSjSearchForm(), columns: getSjColumns(), listApi: public_sjList, title:"选择试剂" }, - gsp: { + '7': { searchForm: getGspSearchForm(), columns: getGspColumns(), listApi: public_gspList, title:"选择供试品" }, - xb: { + "11": { searchForm: getXbSearchForm(), columns: getXbColumns(), listApi: public_xbList, title:"选择细胞" }, - gyzj: { + "3": { searchForm: getGyzjSearchForm(), columns: getGyzjColumns(), listApi: public_gyzjList, @@ -81,7 +81,7 @@ export default { depart: "", studyFormId: '',//有个studyFormId需要从外面动态传过来 uuid: '',//为了标识eventBus的事件id, - selectType: 'sj',//默认选择试剂列表 + selectType: '1',//默认选择试剂列表 listApi: public_sjList, searchForm: getSjSearchForm(), columns: getSjColumns(), @@ -140,9 +140,18 @@ export default { onSubmit() { let row = this.currentRow; const selectedValue = this.otherChecked ? this.otherReagent : this.selectedId; + const selectInfo = { + mc: row.mc, + bh: row.bh, + nd: row.nd, + ly: row.ly, + nddw: row.nddw, + sxrq: row.sxrq, + type: Number(this.selectType), + } this.$emit('submit', selectedValue, row); // 触发eventBus事件 - EventBus.$emit("onMixReagentSubmit", { uuid: this.uuid, selectedId: selectedValue, row,selectType:this.selectType }); + EventBus.$emit("onMixReagentSubmit", { selectInfo, uuid: this.uuid, selectedId: selectedValue, row,selectType:this.selectType }); this.visible = false; }, // 选择试剂时处理