wangting
2024-04-29 33855a1961d581727cfbf59230085e6b95cc549c
action
已修改4个文件
63 ■■■■ 文件已修改
Source/ProjectWeb/src/actions/base/EditAction.js 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/actions/AddEditDialog.vue 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/actions/base/EditAction.js
@@ -4,6 +4,7 @@
import {paramLow,callPreEvent,callPostEvent} from './BaseAction';
import {validatenull} from "@/util/validate";
import Vue from "vue";
import AddEditDialog from "@/components/actions/AddEditDialog";
export const doAction = (options) => {
  options.paramVOS = paramLow(options.paramVOS)
@@ -26,6 +27,21 @@
    Vue.prototype.$message.error("仅能选择一条数据来操作");
    return false;
  }
  if(!validatenull(paramVOS.checknotedit)) {
    let notedit = paramVOS.checknotedit.split('&');
    let checknotedit=false;
    notedit.forEach((item,i)=>{
      if (options.dataStore[0][item.split('=')[0]] == item.split('=')[1]) {
        checknotedit=true;
        return false;
      }
    })
    if (checknotedit) {
      Vue.prototype.$message.error(replaceFreeMarker(paramVOS.checknoteditmsg,options.dataStore,{}) || "当前数据不允许修改");
      return false;
    }
  }
  callPreEvent(options, doBefore, function (options) {
    doAdd(options, function () {
      callPostEvent(options, doAfter, options.callback);
@@ -44,10 +60,25 @@
    Vue.prototype.$message.error("按钮配置不正确");
    return false;
  }
  Vue.prototype.$message.success('执行'+paramVOS.title);
  const dialogConstructor = Vue.extend(AddEditDialog);
  let instance = new dialogConstructor();
  instance.sourceData = options.sourceData;
  instance.dataStore = options.dataStore;
  instance.paramVOS = paramVOS
  instance.type = 'edit';
  instance.dialogClose = function () {
    vm.visible = false;
    document.body.removeChild(vm.$el);
    instance.$destroy();
    instance = null;
  };
  if (callback) {
    callback(options);
    instance.saveCallback = callback;
  }
  let vm = instance.$mount();
  document.body.appendChild(vm.$el);
  instance.visible = true;
}
/**
 * 前置事件
Source/ProjectWeb/src/components/actions/AddEditDialog.vue
@@ -133,15 +133,25 @@
          if (this.paramVOS.initvalue) {
            this.form=this.paramVOS.initvalue;
          }
          if(this.type=="edit"){
          if(this.type=="edit") {
            //加载表单数据
            dataForm(this.params,this.paramVOS.getdataurl,this.paramVOS.getdatamethod).then(res => {
            let sourceDataMap = {};
            for (let i in this.sourceData) {
              const item = this.sourceData[i]
              if (item.constructor === Object) return;
              sourceDataMap['sourceData["' + i + '"]'] = item;
            }
            dataForm(Object.assign({
              btmname: this.paramVOS.type,
              formDefineId: this.paramVOS.form,
              oid: this.dataStore[0].oid
            }, sourceDataMap), this.paramVOS.getdataurl, this.paramVOS.getdatamethod).then(res => {
              this.form = res.data.obj;
              this.loading = false;
            }).catch(error => {
              this.$message.error(error);
              this.loading = false;
            });
            })
          }
        }).catch(error => {
          this.$message.error(error);
Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -147,6 +147,7 @@
      console.log(this.params)
    },
    onLoad:function () {
      debugger;
      if (Object.keys(this.sourceData).length>0 && this.isShow) {
        this.loading = true;
        dataForm(this.params).then(res => {
@@ -158,8 +159,9 @@
        });
      }
    },
    handleRefresh(){
    handleRefresh() {
      this.form={}
      this.onLoad();
    }
  }
}
Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
@@ -323,7 +323,11 @@
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.dataTable.toggleSelection();
      try {
        this.$refs.dataTable.toggleSelection();
      }catch (e) {
      }
    },
    handleRefresh() {
      this.onLoad(this.page, this.query);