dangsn
2024-06-06 8c8c59c1f2005fa3ca89ac2117ca1a3c0c618913
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
 * 按钮处理 业务类型新增
 */
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,callback) => {
  const paramVOS = Object.assign({
    url: '/api/uiDataController/addSave',
    method: 'post',
    uploadfileurl: 'vciFileUploadController/uploadFile'
  }, options.paramVOS)
  options.paramVOS = paramVOS;
 
  options.sourceData = options.sourceData || {};
 
  callPreEvent(options, doBefore, function (options) {
    doAdd(options, function (type,formData) {
      callPostEvent(options, doAfter, callback,type);
    });
  });
};
 
/**
 * 执行
 * @param options 按钮的配置信息
 * @param callback 回调
 */
export const doAdd = (options,callback)=> {
  const paramVOS = options.paramVOS;
  if (!paramVOS['form'] && !paramVOS['context'] && !paramVOS['content']) {
    Vue.prototype.$message.error("按钮配置不正确");
    return false;
  }
 
  const dialogConstructor = Vue.extend(AddEditDialog);
  let instance = new dialogConstructor();
  instance.sourceData = options.sourceData;
  instance.dataStore = options.dataStore;
  instance.paramVOS = paramVOS
 
  instance.type = 'add';
  instance.dialogClose = function () {
    vm.visible = false;
    document.body.removeChild(vm.$el);
    instance.$destroy();
    instance = null;
  };
  if (callback) {
    instance.saveCallback = callback;
  }
  let vm = instance.$mount();
  document.body.appendChild(vm.$el);
  instance.visible = true;
 
}
/**
 * 前置事件
 * @param options 按钮的配置信息
 * @param callback 回调
 */
export const doBefore = (options,callback)=> {
  console.log("执行增加前置事件")
  if(callback){
    callback(options);
  }
}
/**
 * 后置事件
 * @param options 按钮的配置信息
 * @param callback 回调
 */
export const doAfter = (options,callback,actionType)=> {
  console.log('执行增加后置事件');
  if(callback){
    callback(actionType);
  }
}