/**
|
* 流程按钮处理
|
* @author wangting
|
* @date 2021-4-19
|
*/
|
layui.define(['layer','element','BaseAction'],function(exports){
|
var webUtil = $webUtil;
|
var Class = function() {
|
this.MODELNAME = "BaseStartWorkflowAction";
|
this.moduleKey = "BaseStartWorkflowAction";
|
|
this.getContent = function (id) {
|
var that = this;
|
that.id = id;
|
var html = [
|
'<div class="Workflow" id="Workflow_', id, ' lay-filter="addOrEdit_', id, '" style="display:block; text-align: center"></div>'
|
].join("");
|
return html;
|
};
|
|
this.doAction = function (options) {
|
var that = this;
|
webUtil.copyConfig(that, that.moduleKey);
|
that.id = options.id;
|
|
var paramVOS = $webUtil.paramLow(options.paramVOS);
|
options.oldParamVOS=$.extend({},options.paramVOS);
|
options.paramVOS=paramVOS;
|
that.id=options.id;
|
var selectData=options.dataStore;
|
if(selectData.length<1){
|
$webUtil.showErrorMsg("请选择一条需要发起流程的数据");
|
return false;
|
}
|
if(!paramVOS.multiprocess && selectData.length > 1){
|
$webUtil.showErrorMsg("仅能选择一条数据发起流程");
|
return false;
|
}
|
if(paramVOS.checknotprocess) {
|
var notprocess = paramVOS.checknotprocess.split('&');
|
var checknotprocess=false;
|
var msgStore={};
|
layui.each(notprocess, function (i, item) {
|
for (var j=0;j<options.dataStore.lenght;j++){
|
if (options.dataStore[j][item.split('=')[0]] == item.split('=')[1]) {
|
checknotprocess=true;
|
msgStore=options.dataStore[j]
|
return false;
|
}
|
}
|
|
})
|
if (checknotprocess) {
|
$webUtil.showErrorMsg($webUtil.replaceFreeMarker(paramVOS.checknotprocessmsg,msgStore,{}) || '当前数据不允许发起流程');
|
return false;
|
}
|
}
|
|
var baseAction = layui['BaseAction'];
|
baseAction.callPreEvent(options, that, function (options) {
|
that.doAdd(options, function () {
|
baseAction.callPostEvent(options, that, options.callback);
|
});
|
});
|
};
|
|
|
this.doAdd = function (options,callback) {
|
var that = this;
|
var paramVOS = options.paramVOS;
|
var selectData=options.dataStore;
|
|
var otherparamVOS=$.extend({},options.oldParamVOS);
|
delete otherparamVOS.title;
|
delete otherparamVOS.content;
|
delete otherparamVOS.table;
|
delete otherparamVOS.detailurl;
|
delete otherparamVOS.detailUrl;
|
//$webUtil.showConfirmMsg("是否发起流程?",function (r) {
|
//if (r) {
|
layui.use(["process/vciWebStartProcess"], function () {
|
var startProcess = layui['process/vciWebStartProcess'];
|
startProcess.init();
|
startProcess.showStartWindow(paramVOS.processclassify, selectData, {
|
title: paramVOS.title,
|
width:paramVOS.width,
|
height:paramVOS.height,
|
checkAllowAttributeValues:'Editing',
|
allowAttributesMsg:'只有状态是【编辑中】的计划才可以发起流程',
|
startStatus: paramVOS.startstatus||'Auditing',
|
resetStatus: paramVOS.resetstatus||'Editing',
|
canUseTemplate:paramVOS.canusetemplate,
|
isMutiProcess:paramVOS.multiprocess,
|
autoProcessName:$webUtil.replaceFreeMarker(paramVOS.autoprocessname,options.dataStore,{}),
|
variablesInfo:paramVOS.variablesinfo,
|
tableDefineCode:paramVOS.table,
|
detailUrl:paramVOS.detailurl,
|
content:paramVOS.content,
|
alwaysDisplayNext:paramVOS.alwaysdisplaynext,
|
UIType:paramVOS.uitype,
|
otherParam:otherparamVOS
|
}, function (result) {
|
if (paramVOS.afterevent) {
|
var urlobj=$webUtil.getUrlParams(paramVOS.afterevent);
|
layui.use(urlobj.jsPath, function () {
|
var pathAction = layui[urlobj.jsPath];
|
var id = 'saveBeforeEvent_' + id;
|
pathAction[urlobj.methodName](paramVOS, id, selectData);
|
})
|
}
|
if (callback) {
|
callback()
|
}
|
if (options.callback) {
|
options.callback()
|
}
|
});
|
});
|
// }
|
//});
|
|
}
|
|
this.refresh = function () {
|
var that = this;
|
|
};
|
|
this.destory = function () {
|
var that = this;
|
var filter = "Workflow_" + that.id;
|
$('#' + filter).remove()
|
};
|
};
|
var cs = new Class();
|
exports(cs.MODELNAME,cs);
|
});
|