wangting
2024-05-07 46c673f0bf4a22ae108e90cfcf1bdeb4f0b6a45c
Source/ProjectWeb/src/actions/base/BaseAction.js
@@ -18,24 +18,33 @@
    values.forEach((item,i) => {
      if(isShow){
        item = item.replace(':', '=');
        debugger;
        if (item.indexOf('${') > -1) {
          if (item.split('=')[1].indexOf('.') > -1) {
            if (options.sourceData.length < 1 || !options.sourceData.oid) {
            //initvaluenull=true允许初始值为空
            if ((options.sourceData.length < 1 || !options.sourceData.oid) && options.paramVOS['initvaluenull']!=true && options.paramVOS['initvaluenull']!="true") {
              isShow = false;
              Vue.prototype.$message.error("请先选择一条来源数据")
              return false;
            }
            let name = item.split('=')[1].split('.')[1].replace('${', '').replace('}', '');
            initValues[item.split('=')[0]] = options.sourceData[name]
            if(options.sourceData){
              initValues[item.split('=')[0]] = options.sourceData[name]
            }else {
              initValues[item.split('=')[0]]=""
            }
          } else {
            if (options.dataStore.length < 1) {
            if (options.dataStore.length < 1 && options.paramVOS['initvaluenull'] != true && options.paramVOS['initvaluenull'] != "true") {
              isShow = false;
              Vue.prototype.$message.error("请先选择一条数据");
              return false;
            }
            let name = item.split('=')[1].replace('${', '').replace('}', '');
            initValues[item.split('=')[0]] = options.dataStore[0][name];
            if (options.dataStore[0]) {
              initValues[item.split('=')[0]] = options.dataStore[0][name];
            } else {
              initValues[item.split('=')[0]] = "";
            }
          }
        }
      }
@@ -181,16 +190,16 @@
 * @param callback 回调,如果存在后置事件,会在执行完成后执行回调,否则直接回调
 * @param preEventName 后置事件名称,默认 afterevent
 */
export const callPostEvent = (options,fnTarget,callback,postEventName)=>{
export const callPostEvent = (options,fnTarget,callback,actionType,postEventName)=>{
  let afterEvent = options.paramVOS[postEventName || 'afterevent'];
  if(afterEvent) {
    let buttonParse = parseEventByUrl(afterEvent,options,false);
    if(validatenull(buttonParse.jsPath)){
      fnTarget(buttonParse,callback);
      fnTarget(buttonParse,callback,actionType);
    }else{
      try {
        import("../"+buttonParse.jsPath+".js").then(module => {
          module[buttonParse.methodName](options,callback);
          module[buttonParse.methodName](options,callback,actionType);
        })
      } catch (error) {
        Vue.prototype.$message.error('未找到后置事件执行js');
@@ -198,7 +207,7 @@
    }
  }else{
    if(callback){
      callback(options);
      callback(actionType);
    }
  }
};