wangting
2024-06-14 f8035d6a65d1f610f87fa12408224176f1bf005f
Source/plt-web/plt-web-ui/src/components/actions/BaseAction.js
ÎļþÃû´Ó Source/plt-web/plt-web-ui/src/components/actions/base/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') {
    //有配置action路径,使用路径对应的js
    import(`../${button.url}`).then(module => {
    import(`./${button.url}`).then(module => {
      module.doAction(options, callback);
    })
  } else {
@@ -141,14 +141,17 @@
 * @param preEventName å‰ç½®äº‹ä»¶åç§°ï¼Œé»˜è®¤beforeevent
 */
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) {