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/BaseAction.js | 32 ++++++++++++++++++++------------ 1 files changed, 20 insertions(+), 12 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) { -- Gitblit v1.9.3