/**
* 流程跟踪,查看流程历史和当前的流程图
*/
layui.define(['layer','element','table'],function(exports){
var ProcessHistory = function(){
this.id = "vciWebProHistory";
this.modelKey = "vciWebProHistory";
this.businessBtmInProcess = "";
this.businessOidsInProcess = "";//业务数据会有多个
this.taskOidInProcess = "";
this.executionId = "";
this.backPath = configData.compatibility ? path : configData.processServicePath ;
this.maxWidth = 1000;
this.url={
history:'processDefineController/getHistory',
picture:'processDefineController/getProcessPic',
};
}
ProcessHistory.prototype.getContent = function(){
var that = this;
if($webUtil.isNotNull(that.executionOid) && that.executionOid.indexOf(",") > -1){
return '
只有单个任务的时候才能查看流程历史
';
}
return ['',
'
![流程图]()
'].join('');
};
ProcessHistory.prototype.init = function(){
var that = this;
var table = layui.table;
if(that.historyColumns == null || that.historyColumns.length == 0){
that.checkHistoryColumns();
}
table.render({
elem:'#history_' + that.id,
backPath: that.backPath,
url:that.url.history,
page:false,
where:{
executionId:that.executionId,
showCurrentNode:true
},
cols:[that.historyColumns]
});
//显示流程图
var url = "";
if(layui.util.isNotNull(that.taskOidInProcess)){
url = that.backPath + that.url.picture + "?taskOid=" + that.taskOidInProcess + "&" + TOKEN_KEY + "=" + $webUtil.getToken();
}else{
url = that.backPath + that.url.picture + "?executionId=" + that.executionId + "&" + TOKEN_KEY + "=" + $webUtil.getToken();
}
$("img[layer-pid='picture_" + that.id + "']").attr("src",url);
};
ProcessHistory.prototype.checkHistoryColumns = function(){
var that = this;
var table = layui.table;
if(that.historyColumns==null || that.historyColumns.length==0){//如果其他地方想使用这个组件的时候,可以自定义列
that.historyColumns = [table.getIndexColumn(),{
field:'taskName',
title:'任务名称',
width:150
},{
field:'opinin',
title:'执行操作',
width:100
},{
field:'createTime',
title:'任务开始时间',
width:180
},{
field:'node',
title:'审批意见',
width:200
},{
field:'assigneeName',
title:'执行人',
width:120
},{
field:'endTime',
title:'任务完成时间',
width:180,
templet:function(d){
if($webUtil.isNotNull(d.endTime)){
return d.endTime;
}else{
return "正在处理中";
}
}
}]
}
};
var history = new ProcessHistory();
exports('process/vciWebProHistory',history);
});