/**
|
* 按钮处理 链接类型新增
|
*/
|
import {paramLow,callPreEvent, callPostEvent} from '../BaseAction';
|
import {validatenull} from "@/util/validate";
|
import Vue from "vue";
|
import AddEditDialog from "@/components/actions/base/AddEditDialog"
|
|
export const doAction = (options,callback) => {
|
const paramVOS = Object.assign({
|
url: '/api/uiDataController/linkAddSave',
|
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']) {
|
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);
|
}
|
}
|