From 46c673f0bf4a22ae108e90cfcf1bdeb4f0b6a45c Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期二, 07 五月 2024 17:48:19 +0800 Subject: [PATCH] 添加action,数据联动 --- Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue | 48 +++++++++++++++++++++++++++++++++++++----------- 1 files changed, 37 insertions(+), 11 deletions(-) diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue index a949c3c..1792005 100644 --- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue +++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue @@ -1,15 +1,21 @@ <template> <div :id="'UI-dynamic-'+areasName+componentVO.oid" class="UI-dynamic"> - <dynamic-button v-if="componentVO && componentVO.buttons" :componentVO="componentVO" :butttonList="componentVO.buttons" :dataStore="[form]" :sourceData="sourceData" type="form"></dynamic-button> - <basic-form :span="this.componentVO.formDefineVO.columnOneRow?(24/this.componentVO.formDefineVO.columnOneRow) : 12" + <dynamic-button v-if="componentVO && componentVO.buttons" :key="areasName+'buttons-'+componentVO.oid" + :componentVO="componentVO" :butttonList="componentVO.buttons" :dataStore="[form]" :sourceData="sourceData" + @afterMethod="handleRefresh" type="form"></dynamic-button> + <basic-form :key="areasName+'basicForm-'+componentVO.oid" + :span="this.componentVO.formDefineVO.columnOneRow?(24/this.componentVO.formDefineVO.columnOneRow) : 12" :formItems="this.componentVO.formDefineVO && this.componentVO.formDefineVO.items" - :formData="form"> + :disabled="!inDialog" + :isEdit="canEdit" + :formData="form" + :initValue="paramVOS.initvalue" + @getFormData="getFormData"> </basic-form> </div> </template> <script> - import {dataForm} from "@/api/base/ui"; export default { @@ -30,6 +36,11 @@ inDialog: { type: Boolean, default: false + }, + canEdit:{ + //鍐呭鏄惁鍙紪杈� + type:Boolean, + default:false }, areasName: { type: String, @@ -76,11 +87,19 @@ this.$emit("setDataStore", { area: this.areasName, type:this.componentVO.uiComponentType, - btmType:this.componentVO.treeDefineVO.btmType, + btmType:this.currentDefineVO.btmType, dataStore:[newval] }); + this.$emit("setData", { + area: this.areasName, + type:this.componentVO.uiComponentType, + currentDefineVO:this.currentDefineVO, + data:newval + }); } - } + }, + deep: true, + immediate: true }, sourceData: { handler(newval) { @@ -88,7 +107,9 @@ this.sourceDataMapParams=this.sourceDataMap(); this.getParams(); this.handleRefresh(); - } + }, + deep: true, + immediate: true } }, created() { @@ -128,8 +149,6 @@ btmname: this.currentDefineVO.btmType, btmType:this.currentDefineVO.btmType, formDefineId: this.currentDefineVO.id, - componentOid: this.componentVO.oid, - uiDefineId: this.uiContext, oid:this.currentDefineVO.oid }; if(this.dataStore[0] && this.dataStore[0].oid) { @@ -140,6 +159,9 @@ this.params = Object.assign({},formParams, sourceDataMapList); }, onLoad:function () { + if (this.paramVOS.initvalue) { + this.form=this.paramVOS.initvalue; + } if (Object.keys(this.sourceData).length>0 && this.isShow) { this.loading = true; dataForm(this.params).then(res => { @@ -151,8 +173,12 @@ }); } }, - handleRefresh(){ - + handleRefresh() { + this.form={} + this.onLoad(); + }, + getFormData(form) { + this.form = form; } } } -- Gitblit v1.9.3