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/ViewAction.js | 4 Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-tree.vue | 1 Source/plt-web/plt-web-ui/src/components/actions/BaseAction.js | 32 ++- Source/plt-web/plt-web-ui/src/components/actions/base/AddAction.js | 6 Source/plt-web/plt-web-ui/src/components/actions/base/RevisionDialog.vue | 2 Source/plt-web/plt-web-ui/src/components/actions/base/AddEditDialog.vue | 113 +++++++++--- Source/plt-web/plt-web-ui/src/components/actions/base/EditAction.js | 4 /dev/null | 42 ---- Source/plt-web/plt-web-ui/src/components/actions/custom/AddResourceFolder.js | 88 +++++++++ Source/plt-web/plt-web-ui/src/components/actions/custom/AddResourceFolderDialog.vue | 196 +++++++++++++++++++++ Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-button.vue | 22 - Source/plt-web/plt-web-ui/src/views/custom-ui/test.vue | 5 Source/plt-web/plt-web-ui/src/components/actions/base/ViewDialog.vue | 0 Source/plt-web/plt-web-ui/src/components/actions/base/DeleteAction.js | 3 Source/plt-web/plt-web-ui/src/components/actions/base/RevisionAction.js | 4 15 files changed, 408 insertions(+), 114 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/components/actions/base/BaseAction.js b/Source/plt-web/plt-web-ui/src/components/actions/BaseAction.js similarity index 89% rename from Source/plt-web/plt-web-ui/src/components/actions/base/BaseAction.js rename to Source/plt-web/plt-web-ui/src/components/actions/BaseAction.js index 1c336ee..012a316 100644 --- a/Source/plt-web/plt-web-ui/src/components/actions/base/BaseAction.js +++ b/Source/plt-web/plt-web-ui/src/components/actions/BaseAction.js @@ -1,6 +1,6 @@ import {validatenull} from "@/util/validate"; import Vue from 'vue'; -import {handlerAction} from '../handlers'; +import {handlerAction} from './handlers'; /** * 鎸夐挳鐨勫熀纭�鏈嶅姟 @@ -61,7 +61,7 @@ } if (button.url && button.url != 'null') { //鏈夐厤缃產ction璺緞锛屼娇鐢ㄨ矾寰勫搴旂殑js - import(`../${button.url}`).then(module => { + import(`./${button.url}`).then(module => { module.doAction(options, callback); }) } else { @@ -141,14 +141,17 @@ * @param preEventName 鍓嶇疆浜嬩欢鍚嶇О锛岄粯璁eforeevent */ export const callPreEvent = (options,fnTarget,callback,preEventName) => { - let beforeEvent = options.paramVOS[preEventName || 'prepvent']; + let beforeEvent = options.paramVOS[preEventName || 'preevent']; if(beforeEvent) { let buttonParse = parseEventByUrl(beforeEvent,options,true); + if(buttonParse.params){ + Object.assign(options.paramVOS,buttonParse.params); + } if(validatenull(buttonParse.jsPath)){ - fnTarget(buttonParse,callback); + fnTarget(options,callback); }else{ try { - import(`../${buttonParse.jsPath}.js`).then(module => { + import(`./${buttonParse.jsPath}.js`).then(module => { module[buttonParse.methodName](options,callback); }) } catch (error) { @@ -172,11 +175,14 @@ let afterEvent = options.paramVOS[postEventName || 'afterevent']; if(afterEvent) { let buttonParse = parseEventByUrl(afterEvent,options,false); + if(buttonParse.params){ + Object.assign(options.paramVOS,buttonParse.params); + } if(validatenull(buttonParse.jsPath)){ - fnTarget(buttonParse,callback,actionType); + fnTarget(options,callback,actionType); }else{ try { - import(`../${buttonParse.jsPath}.js`).then(module => { + import(`./${buttonParse.jsPath}.js`).then(module => { module[buttonParse.methodName](options,callback,actionType); }) } catch (error) { @@ -201,7 +207,7 @@ let jsPath = url; let methodName = defalutmethodName || (isBefore?"doBefore":"doAfter"); let params = {}; - if (url.indexOf("?")) { + if (url.indexOf("?")>-1) { let temp = url.substring(0, url.indexOf("?")); if (temp.indexOf("#") > -1) { let array = temp.split("#"); @@ -216,11 +222,13 @@ } let paramArray = url.substring(url.indexOf("?") + 1).split("&"); paramArray.forEach(_item=>{ - if (_item.indexOf("=") < 0) { - Vue.prototype.$message.error(isBefore?"鍓嶇疆浜嬩欢":"鍚庣疆浜嬩欢" + "鐨勫弬鏁伴厤缃敊璇紝闇�瑕佽xxx=yyy&zzz=a鐨勬柟寮�"); - return true; + if(_item){ + if (_item.indexOf("=") < 0) { + Vue.prototype.$message.error(isBefore?"鍓嶇疆浜嬩欢":"鍚庣疆浜嬩欢" + "鐨勫弬鏁伴厤缃敊璇紝闇�瑕佽xxx=yyy&zzz=a鐨勬柟寮�"); + return true; + } + params[_item.split("=")[0]] = _item.split("=")[1]; } - params[_item.split("=")[0]] = _item.split("=")[1]; }) }else{ if (url.indexOf("#") > -1) { diff --git a/Source/plt-web/plt-web-ui/src/components/actions/base/AddAction.js b/Source/plt-web/plt-web-ui/src/components/actions/base/AddAction.js index 3989c9b..5b96089 100644 --- a/Source/plt-web/plt-web-ui/src/components/actions/base/AddAction.js +++ b/Source/plt-web/plt-web-ui/src/components/actions/base/AddAction.js @@ -1,10 +1,10 @@ /** * 鎸夐挳澶勭悊 涓氬姟绫诲瀷鏂板 */ -import {paramLow,callPreEvent, callPostEvent} from './BaseAction'; +import {paramLow,callPreEvent, callPostEvent} from '../BaseAction'; import {validatenull} from "@/util/validate"; import Vue from "vue"; -import AddEditDialog from "@/components/actions/AddEditDialog" +import AddEditDialog from "@/components/actions/base/AddEditDialog" export const doAction = (options,callback) => { const paramVOS = Object.assign({ @@ -30,7 +30,7 @@ */ export const doAdd = (options,callback)=> { const paramVOS = options.paramVOS; - if (!paramVOS['form'] && !paramVOS['context'] && !paramVOS['content']) { + if (!paramVOS['form'] && !paramVOS['context']) { Vue.prototype.$message.error("鎸夐挳閰嶇疆涓嶆纭�"); return false; } 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> diff --git a/Source/plt-web/plt-web-ui/src/components/actions/base/DeleteAction.js b/Source/plt-web/plt-web-ui/src/components/actions/base/DeleteAction.js index 0357892..1c95391 100644 --- a/Source/plt-web/plt-web-ui/src/components/actions/base/DeleteAction.js +++ b/Source/plt-web/plt-web-ui/src/components/actions/base/DeleteAction.js @@ -1,7 +1,7 @@ /** * 鎸夐挳澶勭悊 涓氬姟绫诲瀷鍒犻櫎 */ -import {paramLow,callPreEvent,callPostEvent,replaceFreeMarker} from './BaseAction'; +import {paramLow,callPreEvent,callPostEvent,replaceFreeMarker} from '../BaseAction'; import {validatenull} from "@/util/validate"; import Vue from "vue"; import { del} from "@/api/base/actions" @@ -43,6 +43,7 @@ */ export const doDelete = (options,callback)=> { let submitData = { + type:options.paramVOS.type || 1,//1锛氬垹闄ょ増娆�, 2锛氬垹闄ょ増鏈�, 3锛氬垹闄や富瀵硅薄銆傞粯璁ゅ��1銆� checkLinkedFlag:options.paramVOS.checklinkedflag, cascade:options.paramVOS.cascade, adminCascade:options.paramVOS.admincascade diff --git a/Source/plt-web/plt-web-ui/src/components/actions/base/EditAction.js b/Source/plt-web/plt-web-ui/src/components/actions/base/EditAction.js index 1551752..c28b911 100644 --- a/Source/plt-web/plt-web-ui/src/components/actions/base/EditAction.js +++ b/Source/plt-web/plt-web-ui/src/components/actions/base/EditAction.js @@ -1,10 +1,10 @@ /** * 鎸夐挳澶勭悊 涓氬姟绫诲瀷淇敼 */ -import {paramLow,callPreEvent,callPostEvent} from './BaseAction'; +import {paramLow,callPreEvent,callPostEvent} from '../BaseAction'; import {validatenull} from "@/util/validate"; import Vue from "vue"; -import AddEditDialog from "@/components/actions/AddEditDialog"; +import AddEditDialog from "@/components/actions/base/AddEditDialog"; export const doAction = (options,callback) => { const paramVOS = Object.assign({ diff --git a/Source/plt-web/plt-web-ui/src/components/actions/base/RevisionAction.js b/Source/plt-web/plt-web-ui/src/components/actions/base/RevisionAction.js index 9017221..341592c 100644 --- a/Source/plt-web/plt-web-ui/src/components/actions/base/RevisionAction.js +++ b/Source/plt-web/plt-web-ui/src/components/actions/base/RevisionAction.js @@ -1,10 +1,10 @@ /** * 鎸夐挳澶勭悊 涓氬姟绫诲瀷鍗囩骇鐗堟湰 */ -import {paramLow,callPreEvent,callPostEvent} from './BaseAction'; +import {paramLow,callPreEvent,callPostEvent} from '../BaseAction'; import {validatenull} from "@/util/validate"; import Vue from "vue"; -import RevisionDialog from "@/components/actions/RevisionDialog"; +import RevisionDialog from "@/components/actions/base/RevisionDialog"; export const doAction = (options,callback) => { const paramVOS = Object.assign({ diff --git a/Source/plt-web/plt-web-ui/src/components/actions/RevisionDialog.vue b/Source/plt-web/plt-web-ui/src/components/actions/base/RevisionDialog.vue similarity index 99% rename from Source/plt-web/plt-web-ui/src/components/actions/RevisionDialog.vue rename to Source/plt-web/plt-web-ui/src/components/actions/base/RevisionDialog.vue index f7cfefc..5469dc2 100644 --- a/Source/plt-web/plt-web-ui/src/components/actions/RevisionDialog.vue +++ b/Source/plt-web/plt-web-ui/src/components/actions/base/RevisionDialog.vue @@ -44,7 +44,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 {upRevision} from "@/api/base/actions" import {validatenull} from "@/util/validate" diff --git a/Source/plt-web/plt-web-ui/src/components/actions/base/ViewAction.js b/Source/plt-web/plt-web-ui/src/components/actions/base/ViewAction.js index 12d8d09..604862e 100644 --- a/Source/plt-web/plt-web-ui/src/components/actions/base/ViewAction.js +++ b/Source/plt-web/plt-web-ui/src/components/actions/base/ViewAction.js @@ -1,10 +1,10 @@ /** * 鎸夐挳澶勭悊 椤甸潰灞曠ず涓簍ab閫夐」鍗� */ -import {paramLow,callPreEvent,callPostEvent,replaceFreeMarker} from './BaseAction'; +import {paramLow,callPreEvent,callPostEvent,replaceFreeMarker} from '../BaseAction'; import {validatenull} from "@/util/validate"; import Vue from "vue"; -import ViewDialog from "@/components/actions/ViewDialog"; +import ViewDialog from "@/components/actions/base/ViewDialog"; export const doAction = (options,callback) => { const paramVOS = Object.assign({ diff --git a/Source/plt-web/plt-web-ui/src/components/actions/ViewDialog.vue b/Source/plt-web/plt-web-ui/src/components/actions/base/ViewDialog.vue similarity index 100% rename from Source/plt-web/plt-web-ui/src/components/actions/ViewDialog.vue rename to Source/plt-web/plt-web-ui/src/components/actions/base/ViewDialog.vue diff --git a/Source/plt-web/plt-web-ui/src/components/actions/custom/AddResourceFolder.js b/Source/plt-web/plt-web-ui/src/components/actions/custom/AddResourceFolder.js new file mode 100644 index 0000000..061d03d --- /dev/null +++ b/Source/plt-web/plt-web-ui/src/components/actions/custom/AddResourceFolder.js @@ -0,0 +1,88 @@ +//鑷畾涔堿ction锛屽垱寤鸿祫婧愬垎绫� +import {callPreEvent, callPostEvent} from '../BaseAction'; +import Vue from "vue"; +import Dialog from "./AddResourceFolderDialog"; + +/** + * 鍏ュ彛鏂规硶 + * @param options 鎸夐挳鐨勯厤缃俊鎭紝鍊间负{paramVOS:{鎸夐挳閰嶇疆鐨勫弬鏁颁俊鎭紝key鍊煎凡鍏ㄩ儴杞垚灏忓啓},dataStore:[鎸夐挳鎵�鍦ㄥ尯鍩熼�変腑鏁版嵁],sourceData:{鎸夐挳涓婁竴鍖哄煙閫変腑鏁版嵁}} + * @param callback 鎵ц瀹屽悗鍥炶皟锛岄粯璁ゅ埛鏂板尯鍩熸暟鎹� + */ +export const doAction = (options,callback) => { + options.sourceData = options.sourceData || {}; + + //鎵ц閰嶇疆鐨刾reevent鍓嶇疆浜嬩欢 + callPreEvent(options, doBefore, function (options) { + //鎵ц涓氬姟 + doAdd(options, function () { + //鎵ц閰嶇疆鐨刟fterevent鍚庣疆浜嬩欢 + callPostEvent(options, doAfter, callback); + }); + }); +}; + +/** + * 鎵ц涓氬姟 + * @param options 鎸夐挳鐨勯厤缃俊鎭� + * @param callback 鍥炶皟 + */ +export const doAdd = (options,callback)=> { + const paramVOS = options.paramVOS; + + //鏃犵獥鍙e睍绀虹洿鎺ュ啓閫昏緫浠g爜 + + + //鏈夌獥鍙e睍绀烘椂鍐欎互涓嬩唬鐮� + //濡傛灉绐楀彛鎯冲睍绀篣I涓婁笅鏂囷紝鍒欏繀椤婚厤缃甤ontext鍜宼ype + if (!paramVOS['type'] && paramVOS['context']) { + Vue.prototype.$message.error("灞曠ずUI涓婁笅鏂囨椂蹇呴』閰嶇疆涓氬姟绫诲瀷type"); + return false; + } + //Dialog涓鸿灞曠ず鐨勭獥鍙g粍浠讹紝鍏堝湪椤堕儴import寮曞叆 + const dialogConstructor = Vue.extend(Dialog); + let instance = new dialogConstructor(); + instance.sourceData = options.sourceData; + instance.dataStore = options.dataStore; + instance.paramVOS = paramVOS; + instance.type='add';//鎸夐挳鐨勬搷浣滅被鍨� + + instance.dialogClose = function () { + vm.visible = false; + document.body.removeChild(vm.$el); + instance.$destroy(); + instance = null; + }; + if (callback) { + instance.saveCallback = callback; + } + let vm = instance.$mount(); + document.body.appendChild(vm.$el); + //鏄剧ずdialog绐楀彛 + instance.visible = true; + +} +/** + * preevent鍓嶇疆浜嬩欢 + * @param options 鎸夐挳鐨勯厤缃俊鎭� + * @param callback 鍥炶皟 + */ +export const doBefore = (options,callback)=> { + console.log("鎵ц鍓嶇疆浜嬩欢"); + Vue.prototype.$message.success("鎵ц鍓嶇疆浜嬩欢"); + if(callback){ + callback(options); + } +} +/** + * afterevent鍚庣疆浜嬩欢 + * @param options 鎸夐挳鐨勯厤缃俊鎭� + * @param callback 鍥炶皟 + */ +export const doAfter = (options,callback)=> { + console.log('鎵ц鍚庣疆浜嬩欢'); + Vue.prototype.$message.success("鎵ц鍚庣疆浜嬩欢"); + if(callback){ + const actionType='add';//actionType闈炲繀浼狅紝褰撴寜閽搷浣滃尯鍩熶负鏍戯紝骞朵笖鎵ц鍒犻櫎鏃跺缓璁紶鍊尖�渄el鈥濓紝閬垮厤鍒锋柊鏁翠釜鏍� + callback(actionType); + } +} diff --git a/Source/plt-web/plt-web-ui/src/components/actions/custom/AddResourceFolderDialog.vue b/Source/plt-web/plt-web-ui/src/components/actions/custom/AddResourceFolderDialog.vue new file mode 100644 index 0000000..1095e33 --- /dev/null +++ b/Source/plt-web/plt-web-ui/src/components/actions/custom/AddResourceFolderDialog.vue @@ -0,0 +1,196 @@ +<template> + <el-dialog v-dialogDrag + :title="title" + :visible.sync="visible" + :width="width" + :fullscreen="fullscreen" + :append-to-body="true" + top="0" + class="avue-dialog" + :destroy-on-close="true" + :close-on-click-modal="false" + @close="dialogClose"> + <!--绐楀彛鏄剧ず鍐呭--> + <!--灞曠ずUI涓婁笅鏂�--> + <ui-view ref="uiViewRef" v-if="paramVOS.context" + :key="'AddDialog-'+paramVOS.context" + :style="fullscreen?'':'height:'+height" + :btmType="paramVOS.type" + :context="paramVOS.context" + :inDialog="true" + :canEdit="true" + :actionType="type" + :sourceData="sourceData" + :dataStore="dataStore" + :paramVOS="paramVOS" + @getFormData="getFormData" + ></ui-view> + <!--闈濽I涓婁笅鏂�--> + <div v-else>杩欓噷鏄獥鍙f樉绀哄唴瀹�</div> + + <!--搴曢儴鎸夐挳锛岄潪蹇呮湁--> + <div class="dialog-footer avue-dialog__footer"> + <el-button type="primary" plain size="small" @click="save" >淇� 瀛�</el-button> + <el-button size="small" @click="dialogClose">鍙� 娑�</el-button> + </div> + </el-dialog> +</template> + +<script> +import uiView from "@/views/base/UIContentViewerInDialog" +import {validatenull} from "@/util/validate" +import {parseEventByUrl} from "@/components/actions/BaseAction"; + +export default { + name: "AddResourceFolderDialog", + components:{uiView}, + props: { + sourceData: { + //鎵�灞炲尯鍩熺殑涓婁竴鍖哄煙閫変腑鏁版嵁 + type: Object, + default: {} + }, + dataStore: { + //寮圭獥鏃舵寜閽墍灞炲尯鍩熼�変腑鏁版嵁 + type: Array, + default: [] + }, + paramVOS: { + type: Object, + default: {} + } + }, + data(){ + return { + type: "add", + visible: false, + form:{}//琛ㄥ崟瀵硅薄 + } + }, + computed:{ + title(){ + return this.paramVOS.title || (this.type=='add'?'娣诲姞':'淇敼') + }, + width() { + if (!validatenull(this.paramVOS.width)) { + if (this.paramVOS.width.includes("px") || this.paramVOS.width.includes("%")) { + return this.paramVOS.width; + } else { + return this.paramVOS.width + "px"; + } + } else { + return "60%"; + } + }, + height(){ + if (!validatenull(this.paramVOS.height)) { + if (this.paramVOS.height.includes("px") || this.paramVOS.height.includes("%")) { + return this.paramVOS.height; + } else { + return this.paramVOS.height + "px"; + } + } else { + return "auto" + } + }, + fullscreen(){ + if(this.paramVOS.width || this.paramVOS.height){ + return false; + }else if(this.paramVOS.form){ + return false; + } + return true; + } + }, + created() { + }, + watch: {}, + methods: { + //鍏抽棴寮圭獥 + dialogClose() { + this.visible = false; + }, + //淇濆瓨 + save() { + //鏈変繚瀛樺墠缃簨浠� + if (this.paramVOS.savebeforeevent) { + var urlobj = parseEventByUrl(this.paramVOS.savebeforeevent, null, null, 'doAction'); + 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.saveHandle); + }) + } catch (error) { + this.$message.error('鏈壘鍒颁繚瀛樺墠缃簨浠舵墽琛宩s'); + } + } + + }else{ + //鐩存帴淇濆瓨 + this.saveHandle(); + } + }, + saveHandle(){ + let that=this; + + //鎵ц淇濆瓨閫昏緫 + + //淇濆瓨鎴愬姛鍚� + that.$message({ + type: "success", + message: that.paramVOS.successmsg||"淇濆瓨鎴愬姛!" + }); + if(that.saveCallback){ + that.saveCallback(that.type); + } + if (this.paramVOS.saveafterevent) { + let urlobj = parseEventByUrl(this.paramVOS.saveafterevent,null,null,'doAction'); + 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(); + }, + //淇濆瓨鍓嶇疆浜嬩欢 + saveBforeHandle(params){ + this.$message.info('鎵ц淇濆瓨鍓嶇疆浜嬩欢'); + }, + //淇濆瓨鍚庣疆浜嬩欢 + saveAfterHandle(params){ + this.$message.info('淇濆瓨鍚庣疆浜嬩欢鎵ц'); + }, + getFormData(form) { + this.form = form; + } + } +} +</script> + +<style scoped> + +</style> diff --git a/Source/plt-web/plt-web-ui/src/components/actions/custom/testAction.js b/Source/plt-web/plt-web-ui/src/components/actions/custom/testAction.js deleted file mode 100644 index ea2d918..0000000 --- a/Source/plt-web/plt-web-ui/src/components/actions/custom/testAction.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * 鑷畾涔塧ction绀轰緥 - */ -import {paramLow,callPreEvent,callPostEvent,replaceFreeMarker} from './BaseAction'; -import {validatenull} from "@/util/validate"; -import Vue from "vue"; - -export const doAction = (options,callback) => { - //鎵ц鍓嶇疆浜嬩欢鍓嶇殑棰勫鐞� - - callPreEvent(options, doBefore, function (options) { - doAction(options, function (type,formData) { - callPostEvent(options, doAfter,type, callback); - }); - }); -}; - -/** - * 鎵ц - * @param options 鎸夐挳鐨勯厤缃俊鎭� - * @param callback 鍥炶皟 - */ -export const doAction = (options,callback)=> { - Vue.prototype.$message.error("娴嬭瘯鎸夐挳鎵ц"); -} -/** - * 鍓嶇疆浜嬩欢 - * @param options 鎸夐挳鐨勯厤缃俊鎭� - * @param callback 鍥炶皟 - */ -export const doBefore = (options,callback)=> { - console.log('鎵ц鍓嶇疆浜嬩欢'); - if(callback){ - callback(options); - } -} -/** - * 鍚庣疆浜嬩欢 - * @param options 鎸夐挳鐨勯厤缃俊鎭� - * @param callback 鍥炶皟 - */ -export const doAfter = (options,callback,actionType)=> { - console.log('鎵ц鍚庣疆浜嬩欢'); - if(callback){ - callback(actionType); - } -} diff --git a/Source/plt-web/plt-web-ui/src/components/actions/testAction1.js b/Source/plt-web/plt-web-ui/src/components/actions/testAction1.js deleted file mode 100644 index 9077e61..0000000 --- a/Source/plt-web/plt-web-ui/src/components/actions/testAction1.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * 鑷畾涔塧ction绀轰緥 - */ -import {paramLow,callPreEvent,callPostEvent,replaceFreeMarker} from './BaseAction'; -import {validatenull} from "@/util/validate"; -import Vue from "vue"; - -export const doAction = (options,callback) => { - //鎵ц鍓嶇疆浜嬩欢鍓嶇殑棰勫鐞� - - callPreEvent(options, doBefore, function (options) { - doAction(options, function (type,formData) { - callPostEvent(options, doAfter,type, callback); - }); - }); -}; - -/** - * 鎵ц - * @param options 鎸夐挳鐨勯厤缃俊鎭� - * @param callback 鍥炶皟 - */ -export const doAction = (options,callback)=> { - Vue.prototype.$message.error("娴嬭瘯鎸夐挳鎵ц1111"); -} -/** - * 鍓嶇疆浜嬩欢 - * @param options 鎸夐挳鐨勯厤缃俊鎭� - * @param callback 鍥炶皟 - */ -export const doBefore = (options,callback)=> { - console.log('鎵ц鍓嶇疆浜嬩欢'); - if(callback){ - callback(options); - } -} -/** - * 鍚庣疆浜嬩欢 - * @param options 鎸夐挳鐨勯厤缃俊鎭� - * @param callback 鍥炶皟 - */ -export const doAfter = (options,callback,actionType)=> { - console.log('鎵ц鍚庣疆浜嬩欢'); - if(callback){ - callback(actionType); - } -} diff --git a/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-button.vue b/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-button.vue index 7d69abf..d9834d3 100644 --- a/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-button.vue +++ b/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-button.vue @@ -7,9 +7,7 @@ <el-button :key="item.oid" :icon="item.paramVOS.icon" :type="item.paramVOS.btnType || 'primary'" plain size="small" - @click="buttonClick(item)"> - {{ item.name }} - </el-button> + @click="buttonClick(item)">{{ item.name }}</el-button> </el-tooltip> <el-button type="text" @click="handleDefaultAddChildren(scope.row)" v-if="(LocationType === 'menu' && type === 'TreeTable')">鏂板瀛愮骇</el-button> @@ -20,9 +18,7 @@ :icon="item.paramVOS.icon ? item.paramVOS.icon : (item.id === 'edit' ? 'el-icon-edit' : (item.id === 'delete' ||item.id === 'del' ? 'el-icon-delete' : ''))" :type="item.paramVOS.btnType || 'text'" plain size="small" - @click="buttonClick(item,scope.row)"> - {{ item.name }} - </el-button> + @click="buttonClick(item,scope.row)">{{ item.name }}</el-button> </el-tooltip> <!-- 琛ㄦ牸鍐呮寜閽搷浣滃璇濇琛ㄥ崟 --> @@ -36,9 +32,7 @@ :type="item.paramVOS.btnType || 'primary'" plain size="small" - @click="buttonClick(item)"> - {{ item.name }} - </el-button> + @click="buttonClick(item)">{{ item.name }}</el-button> </el-tooltip> </div> <div v-else-if="type === 'tree'" class="tree-buttons"> @@ -48,16 +42,12 @@ :type="item.paramVOS.btnType || 'primary'" plain size="small" - @click="buttonClick(item)"> - {{ item.name }} - </el-button> + @click="buttonClick(item)">{{ item.name }}</el-button> </el-tooltip> <el-button type="primary" plain size="small" - @click="$emit('refresh')"> - 鍒锋柊 - </el-button> + @click="$emit('refresh')">鍒锋柊</el-button> </div> </div> </template> @@ -65,7 +55,7 @@ <script> import func from "@/util/func"; import {validatenull} from "@/util/validate"; -import {doAction} from '@/components/actions/base/BaseAction'; +import {doAction} from '@/components/actions/BaseAction'; import Vue from "vue"; export default { diff --git a/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-tree.vue b/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-tree.vue index 527e2e5..4802752 100644 --- a/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-tree.vue +++ b/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-tree.vue @@ -288,6 +288,7 @@ node.loaded = false; node.expand(); this.isRefresh=true; + this.$refs.tree.setCurrentNode(this.currentClickNode); } } } diff --git a/Source/plt-web/plt-web-ui/src/views/custom-ui/test.vue b/Source/plt-web/plt-web-ui/src/views/custom-ui/test.vue index aae9e1e..fcac821 100644 --- a/Source/plt-web/plt-web-ui/src/views/custom-ui/test.vue +++ b/Source/plt-web/plt-web-ui/src/views/custom-ui/test.vue @@ -18,14 +18,13 @@ }, methods: {}, created() { - + //鑾峰彇鍦板潃鍙傛暟 + console.log(this.$route.query) }, mounted() { }, watch: {}, - - } </script> diff --git a/Source/plt-web/plt-web-ui/src/views/preview/readMD.vue b/Source/plt-web/plt-web-ui/src/views/preview/readMD.vue deleted file mode 100644 index 3605c29..0000000 --- a/Source/plt-web/plt-web-ui/src/views/preview/readMD.vue +++ /dev/null @@ -1,42 +0,0 @@ -<template> - <div class="md-content"> - <mark-down-it-vue class="md-body" :content="htmlMD"></mark-down-it-vue> - </div> -</template> - -<script> -import MarkDownItVue from "markdown-it-vue" -import "markdown-it-vue/dist/markdown-it-vue.css" -import {verifyNull} from "@/util/validate"; - -export default { - name: "readMD", - components: {MarkDownItVue}, - data() { - return { - htmlMD: "", - type:'' - } - }, - created() { - if (verifyNull(this.$route.query.type)) { - this.$message.error("閰嶇疆鐨勪俊鎭敊璇紝璇烽厤缃畉ype鍙傛暟"); - return false; - } - this.type=this.$route.query.type; - axios.get(`./src/configDoc/${this.type}.md`).then((response) => { - this.htmlMD = response.data; - }); - /*require(`@/configDoc/${this.type}.md`).then((markdown) => { - debugger; - this.htmlMD = markdown; - }).catch((error) => { - console.log('閰嶇疆鏂囨。璇诲彇澶辫触:', error); - });*/ - } -} -</script> - -<style scoped> - -</style> -- Gitblit v1.9.3