diff --git a/src/components/Template/StepFormPackage.vue b/src/components/Template/StepFormPackage.vue index 8af244b..1115fda 100644 --- a/src/components/Template/StepFormPackage.vue +++ b/src/components/Template/StepFormPackage.vue @@ -101,14 +101,8 @@ export default { } }, mounted() { - EventBus.$on("onReagentSubmit",this.onReagentSubmit) - // EventBus.$on("onInstrumentSubmit",this.onInstrumentSubmit) - // EventBus.$on("onMixReagentSubmit",this.onMixReagentSubmit) }, unmounted() { - EventBus.$off("onReagentSubmit",this.onReagentSubmit) - // EventBus.$off("onInstrumentSubmit",this.onInstrumentSubmit) - // EventBus.$off("onMixReagentSubmit",this.onMixReagentSubmit) }, data() { return { @@ -131,7 +125,6 @@ export default { this.allFieldsConfig[key].sjSelectType = data.selectType; } this.formFields[`selectInfo_${key}`] = data.selectInfo; -console.log(this.formFields,"mmm") // this.$emit("onRegentSubmit", {selectInfo:data,key,config:item}); }, getRegentItem(item,fieldCode="type"){ @@ -209,7 +202,6 @@ console.log(this.formFields,"mmm") } } } - console.log(sjResource,yqResource,"sjResource,yqResource") return { sjResource, yqResource, @@ -233,28 +225,6 @@ console.log(this.formFields,"mmm") fillType:sItem.fillType || "actFill", } }, - // 处理选择试剂/供试品/给药制剂提交 - onMixReagentSubmit(data){ - if(data.uuid !== this.uuid) return; - 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,this.currentClickKey) - }, - // 处理选择试剂提交 - onReagentSubmit(data){ - if(data.uuid !== this.uuid) return; - this.updateFormData(this.currentClickKey,data.selectedId) - }, - // 处理选择仪器提交,不确定后续还会不会有其他操作,所以和选择试剂提交区分开。 - onInstrumentSubmit(data){ - if(data.uuid !== this.uuid) return; - this.updateFormData(this.currentClickKey,data.selectedId) - // this.formFields[this.currentClickKey] = data.selectedId; - this.formFields[`selectInfo_${this.currentClickKey}`] = data.selectInfo; - }, getClickableItem(sItem) { return { ...sItem, @@ -262,67 +232,6 @@ console.log(this.formFields,"mmm") } }, - handleClickInstrument(key,type) { - this.currentClickKey = key; - if(type === 'sj'){//试剂 - EventBus.$emit("showSelectMixReagentDialog",{ - studyFormId:this.templateData.id, - uuid:this.uuid, - sourceFrom:'step', - type:"1" - }) - }else if(type === 'gyzj'){//给药制剂 - EventBus.$emit("showSelectMixReagentDialog",{ - studyFormId:this.templateData.id, - uuid:this.uuid, - sourceFrom:'step', - 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:"1", - mixType:true, - }) - }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:"11", - }) - }else if(type === 'yq'){ - EventBus.$emit("showSelectInstrumentDialog",{ - studyFormId:this.templateData.id, - uuid:this.uuid, - }) - } - }, - - } } diff --git a/src/components/Template/mixins/formPackageMixins.js b/src/components/Template/mixins/formPackageMixins.js index 577abfe..410fd05 100644 --- a/src/components/Template/mixins/formPackageMixins.js +++ b/src/components/Template/mixins/formPackageMixins.js @@ -46,9 +46,21 @@ export default { }, methods: { - onSelectChange(){ - + onSelectChange(key, val, type) { + // 获取对应的配置 + const currentConfig = this.allFieldsConfig[key]; + if (currentConfig.selectTo) { + this.formFields[currentConfig.selectTo] = val; + } + this.onValueChangeCompareTo(key, val); + this.formFields[key] = val; + this.$emit("select", { key, value: val, type }); + // 清除该表单项的错误状态 + if (this.errors[key]) { + this.$set(this.errors, key, false); + } }, + //试剂/仪器等弹窗提交 onRegentSubmit(data,key,item){ this.updateFormData(key,data.selectedId);