wangting
2024-05-07 46c673f0bf4a22ae108e90cfcf1bdeb4f0b6a45c
添加action,数据联动
已修改11个文件
96 ■■■■■ 文件已修改
Source/ProjectWeb/src/actions/base/AddAction.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/actions/base/BaseAction.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/actions/base/EditAction.js 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/actions/AddEditDialog.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/views/base/UIContentArea.vue 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/actions/base/AddAction.js
@@ -17,8 +17,8 @@
  options.sourceData = options.sourceData || {};
  callPreEvent(options, doBefore, function (options) {
    doAdd(options, function () {
      callPostEvent(options, doAfter, callback);
    doAdd(options, function (type,formData) {
      callPostEvent(options, doAfter, callback,type);
    });
  });
};
@@ -72,9 +72,9 @@
 * @param options 按钮的配置信息
 * @param callback 回调
 */
export const doAfter = (options,callback)=> {
export const doAfter = (options,callback,actionType)=> {
  Vue.prototype.$message.success('执行增加后置事件');
  if(callback){
    callback(options);
    callback(actionType);
  }
}
Source/ProjectWeb/src/actions/base/BaseAction.js
@@ -18,6 +18,7 @@
    values.forEach((item,i) => {
      if(isShow){
        item = item.replace(':', '=');
        debugger;
        if (item.indexOf('${') > -1) {
          if (item.split('=')[1].indexOf('.') > -1) {
            //initvaluenull=true允许初始值为空
@@ -189,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');
@@ -206,7 +207,7 @@
    }
  }else{
    if(callback){
      callback(options);
      callback(actionType);
    }
  }
};
Source/ProjectWeb/src/actions/base/EditAction.js
@@ -6,7 +6,7 @@
import Vue from "vue";
import AddEditDialog from "@/components/actions/AddEditDialog";
export const doAction = (options) => {
export const doAction = (options,callback) => {
  const paramVOS = Object.assign({
    getdataurl: '/api/uiDataController/dataFormQuery',
    getdatamethod: 'post',
@@ -42,8 +42,8 @@
    }
  }
  callPreEvent(options, doBefore, function (options) {
    doAdd(options, function () {
      callPostEvent(options, doAfter, options.callback);
    doAdd(options, function (type,formData) {
      callPostEvent(options, doAfter,type, callback);
    });
  });
};
@@ -95,9 +95,9 @@
 * @param options 按钮的配置信息
 * @param callback 回调
 */
export const doAfter = (options,callback)=> {
export const doAfter = (options,callback,actionType)=> {
  Vue.prototype.$message.success('执行修改后置事件');
  if(callback){
    callback(options);
    callback(actionType);
  }
}
Source/ProjectWeb/src/components/actions/AddEditDialog.vue
@@ -172,6 +172,7 @@
      for(let key in this.$refs.uiViewRef.data){
        if(this.$refs.uiViewRef.data[key].type== useDataType){
          this.form=this.$refs.uiViewRef.data[key].data;
          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 => {
@@ -192,6 +193,7 @@
      let that=this;
      this.$refs.formRef.validate((valid, done) => {
        if (valid) {
          this.formDefineId=this.paramVOS.form;
          if (this.paramVOS.savebeforeevent) {
            var urlobj = parseEventByUrl(this.paramVOS.savebeforeevent,null,null,'doAction');
            import("../"+urlobj.jsPath+".js").then(module => {
@@ -219,7 +221,7 @@
        formValues.defaultValues.btmname = this.paramVOS.type;
      }
      let datas = {
        formDefineId: this.paramVOS.form || "",
        formDefineId: this.formDefineId,
        preEvent: this.paramVOS.preevent,
        afterEvent: this.paramVOS.afterevent,
        beforeServerEvent: this.paramVOS.beforeserverevent,
Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
@@ -153,9 +153,7 @@
        dataStore: this.dataStore || [],
        sourceData: this.sourceData || {}
      }, function (actionType,data) {
        if (that.$parent.handleRefresh) {
          that.$parent.handleRefresh(actionType,data)
        }
        that.$emit("afterMethod",actionType,data);
      });
    }
  },
Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue
@@ -95,7 +95,9 @@
        //源数据有变化时变更当前区域数据
        console.log(this.areasName);
        console.log(newval);
      }
      },
      deep: true,
      immediate: true
    }
  },
  computed: {},
Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -1,7 +1,8 @@
<template>
  <div :id="'UI-dynamic-'+areasName+componentVO.oid" class="UI-dynamic">
    <dynamic-button v-if="componentVO && componentVO.buttons" :key="areasName+'buttons-'+componentVO.oid"
                    :componentVO="componentVO" :butttonList="componentVO.buttons" :dataStore="[form]" :sourceData="sourceData" type="form"></dynamic-button>
                    :componentVO="componentVO" :butttonList="componentVO.buttons" :dataStore="[form]" :sourceData="sourceData"
                    @afterMethod="handleRefresh" type="form"></dynamic-button>
    <basic-form :key="areasName+'basicForm-'+componentVO.oid"
                :span="this.componentVO.formDefineVO.columnOneRow?(24/this.componentVO.formDefineVO.columnOneRow) : 12"
                :formItems="this.componentVO.formDefineVO && this.componentVO.formDefineVO.items"
@@ -92,11 +93,13 @@
          this.$emit("setData", {
            area: this.areasName,
            type:this.componentVO.uiComponentType,
            btmType:this.currentDefineVO.btmType,
            currentDefineVO:this.currentDefineVO,
            data:newval
          });
        }
      }
      },
      deep: true,
      immediate: true
    },
    sourceData: {
      handler(newval) {
@@ -104,7 +107,9 @@
        this.sourceDataMapParams=this.sourceDataMap();
        this.getParams();
        this.handleRefresh();
      }
      },
      deep: true,
      immediate: true
    }
  },
  created() {
Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
@@ -19,12 +19,15 @@
        <dynamic-button :componentVO="componentVO"
                        :key="areasName+'buttons-'+componentVO.oid"
                        :butttonList="componentVO.buttons" :dataStore="selectList" LocationType="top" :sourceData="sourceData"
                        @afterMethod="handleRefresh"
                        type="table"></dynamic-button>
      </template>
      <!--menu区域按钮-->
      <template slot="menu" slot-scope="scope">
        <dynamic-button :componentVO="componentVO" :butttonList="componentVO.buttons" :scope="scope" :dataStore="selectList" :sourceData="sourceData" LocationType="menu"
        <dynamic-button :componentVO="componentVO" :butttonList="componentVO.buttons" :scope="scope" :dataStore="selectList" :sourceData="sourceData"
                        LocationType="menu"
                        @afterMethod="handleRefresh"
                        type="table"></dynamic-button>
      </template>
    </avue-crud>
@@ -176,11 +179,13 @@
          this.$emit("setData", {
            area: this.areasName,
            type:this.componentVO.uiComponentType,
            btmType:this.currentDefineVO.btmType,
            currentDefineVO:this.currentDefineVO,
            data:newval
          });
        }
      }
      },
      deep: true,
      immediate: true
    },
    'sourceData':{
      handler(newval) {
@@ -189,7 +194,9 @@
          this.getParams();
          this.handleRefresh();
        }
      }
      },
      deep: true,
      immediate: true
    }
  },
  created() {
@@ -341,7 +348,7 @@
      }
    },
    handleRefresh() {
    handleRefresh(type) {
      this.onLoad(this.page, this.query);
    }
  }
Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue
@@ -3,6 +3,7 @@
    <dynamic-button v-if="componentVO.buttons && componentVO.buttons.length>0" :componentVO="componentVO"
                    :key="areasName+'buttons-'+componentVO.oid"
                    :butttonList="componentVO.buttons" :dataStore="checkDatas"
                    @afterMethod="handleRefresh"
                    :sourceData="sourceData" type="tree" style="margin-bottom: 5px;"></dynamic-button>
    <el-input
      placeholder="输入关键字进行过滤"
@@ -104,7 +105,9 @@
            dataStore:newval
          });
        }
      }
      },
      deep: true,
      immediate: true
    },
    data:{
      handler(newval) {
@@ -112,11 +115,13 @@
          this.$emit("setData", {
            area: this.areasName,
            type:this.componentVO.uiComponentType,
            btmType:this.componentVO.treeDefineVO.btmType,
            currentDefineVO:this.componentVO.treeDefineVO,
            data:newval
          });
        }
      }
      },
      deep: true,
      immediate: true
    },
    sourceData:{
      handler(newval) {
@@ -124,7 +129,9 @@
        this.sourceDataMapParams=this.sourceDataMap();
        this.getParams();
        this.handleRefresh();
      }
      },
      deep: true,
      immediate: true
    }
  },
  data() {
Source/ProjectWeb/src/views/base/UIContentArea.vue
@@ -205,8 +205,6 @@
          }
        })
        this.newAreasData = newAreasData;
      }else {
        this.newAreasData=this.areasData;
      }
    },
    checkDisplayExpression(displayExpressionStr) {
Source/ProjectWeb/src/views/base/UIContentViewerInDialog.vue
@@ -143,22 +143,22 @@
      data:{
        northAreaInDialog:{
          type:'',
          btmType:'',
          DefineVO:null,
          data:null
        },
        westAreaInDialog:{
          type:'',
          btmType:'',
          DefineVO:null,
          data:null
        },
        centerAreaInDialog:{
          type:'',
          btmType:'',
          DefineVO:null,
          data:null
        },
        southAreaInDialog:{
          type:'',
          btmType:'',
          DefineVO:null,
          data:null
        }
      },
@@ -202,7 +202,7 @@
      }
    },
    setData(value) {
      this.data[value.area].btmType = value.btmType;
      this.data[value.area].DefineVO = value.currentDefineVO;
      this.data[value.area].data = value.data;
      this.data[value.area].type = value.type;
    },