From a9bbbe822377536e6f3374b05e2b64b12b2f188c Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期一, 27 五月 2024 10:25:43 +0800 Subject: [PATCH] action文档 --- Source/ProjectWeb/src/components/actions/AddEditDialog.vue | 67 ++++++++++++++++++++++++++------- 1 files changed, 53 insertions(+), 14 deletions(-) diff --git a/Source/ProjectWeb/src/components/actions/AddEditDialog.vue b/Source/ProjectWeb/src/components/actions/AddEditDialog.vue index 11347ab..0ddfd45 100644 --- a/Source/ProjectWeb/src/components/actions/AddEditDialog.vue +++ b/Source/ProjectWeb/src/components/actions/AddEditDialog.vue @@ -16,6 +16,8 @@ :isEdit="true" :formItems="formItems" :formData="form" + :initValue="paramVOS.initvalue" + :uploadattachment="paramVOS.uploadattachment || false" @getFormData="getFormData"> </basic-form> <ui-view ref="uiViewRef" v-else-if="paramVOS.context" @@ -25,6 +27,7 @@ :context="paramVOS.context" :inDialog="true" :canEdit="true" + :actionType="type" :sourceData="sourceData" :dataStore="dataStore" :paramVOS="paramVOS" @@ -41,7 +44,7 @@ <script> import uiView from "@/views/base/UIContentViewerInDialog" -import {parseEventByUrl} from "@/actions/base/BaseAction" +import {parseEventByUrl} from "@/components/actions/base/BaseAction" import {getFormDefineById,dataForm} from "@/api/base/ui"; import {addSave,editSave} from "@/api/base/actions" import {validatenull} from "@/util/validate" @@ -116,7 +119,7 @@ created() { }, watch: { - sourceData: { + paramVOS: { handler(val) { if (this.paramVOS.form) { this.onLoad(); @@ -136,7 +139,6 @@ getFormDefineById(this.paramVOS.type,this.paramVOS.form).then(result => { this.formItems=result.data.obj.items; this.span=result.data.obj.columnOneRow?(24/result.data.obj.columnOneRow) : 12; - if (this.paramVOS.initvalue) { this.form=this.paramVOS.initvalue; } @@ -153,7 +155,7 @@ formDefineId: this.paramVOS.form, oid: this.dataStore[0].oid }, sourceDataMap), this.paramVOS.getdataurl, this.paramVOS.getdatamethod).then(res => { - this.form = res.data.obj; + this.form=res.data.obj; this.loading = false; }).catch(error => { this.$message.error(error); @@ -168,18 +170,35 @@ } }, contextSave(){ - debugger; - if(this.saveCallback){ - this.saveCallback({}); + const useDataType=this.paramVOS["useDataType"] || "form";//浣跨敤ui涓婁笅鏂囦腑鐨勫摢涓被鍨嬫暟鎹紝榛樿form銆傚�硷細form銆乼ree銆乼able銆乀reeTable + for(let key in this.$refs.uiViewRef.data){ + if(this.$refs.uiViewRef.data[key].type== useDataType){ + this.form=this.$refs.uiViewRef.data[key].data; + this.formDefineId=this.$refs.uiViewRef.data[key].DefineVO.id; + if (this.paramVOS.savebeforeevent) { + var urlobj = parseEventByUrl(this.paramVOS.savebeforeevent,null,null,'doAction'); + import(`./${urlobj.jsPath}.js`).then(module => { + module[urlobj.methodName]({ + paramVOS: this.paramVOS, + dataStore: this.dataStore, + sourceData:this.sourceData + },this.formSaveHandle); + }) + } else { + this.formSaveHandle(); + } + return; + } } }, formSave() { let that=this; this.$refs.formRef.validate((valid, done) => { if (valid) { + this.formDefineId=this.paramVOS.form; if (this.paramVOS.savebeforeevent) { var urlobj = parseEventByUrl(this.paramVOS.savebeforeevent,null,null,'doAction'); - import("../"+urlobj.jsPath+".js").then(module => { + import(`./${urlobj.jsPath}.js`).then(module => { module[urlobj.methodName]({ paramVOS: this.paramVOS, dataStore: this.dataStore, @@ -204,7 +223,7 @@ formValues.defaultValues.btmname = this.paramVOS.type; } let datas = { - formDefineId: this.paramVOS.form, + formDefineId: this.formDefineId, preEvent: this.paramVOS.preevent, afterEvent: this.paramVOS.afterevent, beforeServerEvent: this.paramVOS.beforeserverevent, @@ -217,21 +236,41 @@ addSave(datas,that.paramVOS.url,that.paramVOS.method).then(() => { that.$message({ type: "success", - message: "淇濆瓨鎴愬姛!" + message: that.paramVOS.successmsg||"淇濆瓨鎴愬姛!" }); if(that.saveCallback){ - that.saveCallback(that.form); + that.saveCallback(that.type,that.form); + } + if (this.paramVOS.saveafterevent) { + let urlobj = parseEventByUrl(this.paramVOS.saveafterevent,null,null,'doAction'); + import(`./${urlobj.jsPath}.js`).then(module => { + module[urlobj.methodName]({ + paramVOS: this.paramVOS, + dataStore: this.dataStore, + sourceData:this.sourceData + }); + }) } that.dialogClose(); }); }else{ - editSave(that.form,that.paramVOS.url,that.paramVOS.method).then(() => { + editSave(datas,that.paramVOS.url,that.paramVOS.method).then(() => { that.$message({ type: "success", - message: "淇敼鎴愬姛!" + message: that.paramVOS.successmsg||"淇敼鎴愬姛!" }); if(that.saveCallback){ - that.saveCallback(that.form); + that.saveCallback(that.type,that.form); + } + if (this.paramVOS.saveafterevent) { + let urlobj = parseEventByUrl(this.paramVOS.saveafterevent,null,null,'doAction'); + import(`./${urlobj.jsPath}.js`).then(module => { + module[urlobj.methodName]({ + paramVOS: this.paramVOS, + dataStore: this.dataStore, + sourceData:this.sourceData + }); + }) } that.dialogClose(); }); -- Gitblit v1.9.3