From f8035d6a65d1f610f87fa12408224176f1bf005f Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期五, 14 六月 2024 14:11:52 +0800 Subject: [PATCH] 修改action --- Source/plt-web/plt-web-ui/src/components/actions/base/AddEditDialog.vue | 113 +++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 83 insertions(+), 30 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/components/actions/AddEditDialog.vue b/Source/plt-web/plt-web-ui/src/components/actions/base/AddEditDialog.vue similarity index 75% rename from Source/plt-web/plt-web-ui/src/components/actions/AddEditDialog.vue rename to Source/plt-web/plt-web-ui/src/components/actions/base/AddEditDialog.vue index 0ddfd45..83a3836 100644 --- a/Source/plt-web/plt-web-ui/src/components/actions/AddEditDialog.vue +++ b/Source/plt-web/plt-web-ui/src/components/actions/base/AddEditDialog.vue @@ -8,6 +8,7 @@ top="0" class="avue-dialog" :destroy-on-close="true" + :close-on-click-modal="false" @close="dialogClose"> <basic-form ref="formRef" v-if="paramVOS.form" :key="'dialog-'+paramVOS.form" @@ -44,7 +45,7 @@ <script> import uiView from "@/views/base/UIContentViewerInDialog" -import {parseEventByUrl} from "@/components/actions/base/BaseAction" +import {parseEventByUrl} from "@/components/actions/BaseAction" import {getFormDefineById,dataForm} from "@/api/base/ui"; import {addSave,editSave} from "@/api/base/actions" import {validatenull} from "@/util/validate" @@ -177,13 +178,24 @@ 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); - }) + if(urlobj.params){ + Object.assign(this.paramVOS,urlobj.params); + } + if(validatenull(urlobj.jsPath)){ + this.saveBforeHandle(this.paramVOS); + }else{ + try { + import(`./${urlobj.jsPath}.js`).then(module => { + module[urlobj.methodName]({ + paramVOS: this.paramVOS, + dataStore: this.dataStore, + sourceData:this.sourceData + },this.formSaveHandle); + }) + } catch (error) { + this.$message.error('鏈壘鍒颁繚瀛樺墠缃簨浠舵墽琛宩s'); + } + } } else { this.formSaveHandle(); } @@ -198,13 +210,24 @@ this.formDefineId=this.paramVOS.form; 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 - },that.formSaveHandle); - }) + if(urlobj.params){ + Object.assign(this.paramVOS,urlobj.params); + } + if(validatenull(urlobj.jsPath)){ + this.saveBforeHandle(this.paramVOS); + }else{ + try { + import(`./${urlobj.jsPath}.js`).then(module => { + module[urlobj.methodName]({ + paramVOS: this.paramVOS, + dataStore: this.dataStore, + sourceData: this.sourceData + }, that.formSaveHandle); + }) + } catch (error) { + this.$message.error('鏈壘鍒颁繚瀛樺墠缃簨浠舵墽琛宩s'); + } + } } else { that.formSaveHandle(); } @@ -243,13 +266,24 @@ } 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 - }); - }) + if(urlobj.params){ + Object.assign(this.paramVOS,urlobj.params); + } + if(validatenull(urlobj.jsPath)){ + this.saveAfterHandle(this.paramVOS); + }else{ + try { + import(`./${urlobj.jsPath}.js`).then(module => { + module[urlobj.methodName]({ + paramVOS: this.paramVOS, + dataStore: this.dataStore, + sourceData:this.sourceData + }); + }) + } catch (error) { + this.$message.error('鏈壘鍒颁繚瀛樺悗缃簨浠舵墽琛宩s'); + } + } } that.dialogClose(); }); @@ -264,13 +298,24 @@ } 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 - }); - }) + if(urlobj.params){ + Object.assign(this.paramVOS,urlobj.params); + } + if(validatenull(urlobj.jsPath)){ + this.saveAfterHandle(this.paramVOS); + }else{ + try { + import(`./${urlobj.jsPath}.js`).then(module => { + module[urlobj.methodName]({ + paramVOS: this.paramVOS, + dataStore: this.dataStore, + sourceData:this.sourceData + }); + }) + } catch (error) { + this.$message.error('鏈壘鍒颁繚瀛樺悗缃簨浠舵墽琛宩s'); + } + } } that.dialogClose(); }); @@ -297,7 +342,15 @@ }, getFormData(form) { this.form = form; - } + }, + //淇濆瓨鍓嶇疆浜嬩欢 + saveBforeHandle(params){ + this.$message.info('鎵ц淇濆瓨鍓嶇疆浜嬩欢'); + }, + //淇濆瓨鍚庣疆浜嬩欢 + saveAfterHandle(params){ + this.$message.info('淇濆瓨鍚庣疆浜嬩欢鎵ц'); + }, } } </script> -- Gitblit v1.9.3