You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
230 lines
7.0 KiB
230 lines
7.0 KiB
1 month ago
|
var WF_PARAMS = {
|
||
|
RENDER_TYPE_DOM:'dom'//返回jquery dom元素
|
||
|
,RENDER_TYPE_APPEND:'append'//直接在指定容器ID(containerid)的dom上生成
|
||
|
};
|
||
|
var _nodedata = [];
|
||
|
$.extend({
|
||
|
//渲染图形化流程监控图
|
||
|
wfchat:function(jparam){
|
||
|
var _id=jparam.id?jparam.id:$.getID();
|
||
|
var _returntype = jparam.returntype?jparam.returntype:'';
|
||
|
var _width = jparam.width?jparam.width:50;//默认圆圈的直径是50像素
|
||
|
var _blink = jparam.blink?jparam.blink:false;//默认不闪烁
|
||
|
if(_width<30){
|
||
|
_width = 30;
|
||
|
}
|
||
|
var _width2 = 2 * _width;//圆圈外框的宽度
|
||
|
var _shift = _width/2;
|
||
|
var _containerid = jparam.containerid;
|
||
|
var _containHeight = jparam.containerheight?jparam.containerheight:'';
|
||
|
if(!_containHeight){
|
||
|
_containHeight = $('#'+_containerid).height();
|
||
|
}
|
||
|
if(!_containHeight){
|
||
|
_containHeight = _width2+30;
|
||
|
}
|
||
|
var _data = jparam.data;
|
||
|
var _top = (_containHeight - _width - 28)/2;
|
||
|
var _current = jparam.current?jparam.current:'';
|
||
|
var valid = false;//是否有效
|
||
|
var isused = false;
|
||
|
if(_data){
|
||
|
for(var i=0;i<_data.length;i++){
|
||
|
var wfnodedata = _data[i];
|
||
|
if(wfnodedata.nodename == _current){
|
||
|
valid = true;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var htmlStr = [];
|
||
|
htmlStr.push('<div style="left:'+_shift+'px;right:'+_shift+'px;" class="chat-content">');
|
||
|
var nodesize = _data.length-1;
|
||
|
var _containerWidth = 100/nodesize;
|
||
|
htmlStr.push('<div style="right:'+_width2+'px;" class="chat-content-main">');
|
||
|
|
||
|
for(var i=1;i<_data.length;i++){
|
||
|
var wfnodedata = _data[i-1];
|
||
|
htmlStr.push(' <div style="width:'+_containerWidth+'%;" class="wf-area">');
|
||
|
htmlStr.push(' <div style="width:'+_width2+'px;" class="wf-node">');
|
||
|
var colorCss = ' blue-bg';
|
||
|
if(valid){
|
||
|
if(wfnodedata.nodename == _current){
|
||
|
colorCss = ' yellow-bg';
|
||
|
if(_blink == true){
|
||
|
colorCss = ' yellow-bg-blink';
|
||
|
}
|
||
|
isused = true;
|
||
|
}else{
|
||
|
if(isused==true){
|
||
|
colorCss = '';
|
||
|
}
|
||
|
}
|
||
|
}else{
|
||
|
colorCss = '';
|
||
|
}
|
||
|
htmlStr.push(' <div style="width:'+_width+'px;height:'+_width+'px;line-height:'+_width+'px;" class="wf-nodename'+colorCss+'">'+i+'</div>');
|
||
|
htmlStr.push(' <div style="width:'+_width2+'px;left:-'+_shift+'px" class="wf-nodedesc">'+wfnodedata.nodetitle+'</div>');
|
||
|
htmlStr.push(' </div>');
|
||
|
htmlStr.push(' </div>');
|
||
|
}
|
||
|
htmlStr.push('</div>');
|
||
|
//丢入最后一个环节的信息
|
||
|
htmlStr.push('<div style="width:'+_width2+'px;" class="chat-content-lastnode">');
|
||
|
htmlStr.push(' <div style="width:100%;" class="wf-area">');
|
||
|
htmlStr.push(' <div style="width:'+_width2+'px;" class="wf-node">');
|
||
|
var colorCss = ' blue-bg';
|
||
|
if(valid){
|
||
|
if(_data[nodesize].nodename == _current){
|
||
|
colorCss = ' blue-bg';
|
||
|
isused = true;
|
||
|
}else{
|
||
|
if(isused==true){
|
||
|
colorCss = '';
|
||
|
}
|
||
|
}
|
||
|
}else{
|
||
|
colorCss = '';
|
||
|
}
|
||
|
htmlStr.push(' <div style="width:'+_width+'px;height:'+_width+'px;line-height:'+_width+'px;" class="wf-nodename'+colorCss+'">'+i+'</div>');
|
||
|
htmlStr.push(' <div style="width:'+_width2+'px;left:-'+_shift+'px" class="wf-nodedesc">'+_data[nodesize].nodetitle+'</div>');
|
||
|
htmlStr.push(' </div>');
|
||
|
htmlStr.push(' </div>');
|
||
|
htmlStr.push('</div>');
|
||
|
|
||
|
htmlStr.push('</div>');
|
||
|
var domObj = $(htmlStr.join(''));
|
||
|
//$('#'+_containerid).append();
|
||
|
domObj.find('.wf-node').css("top",_top+"px");
|
||
|
domObj.find('.wf-area').append("<style>::before{top:"+(_top+_shift)+"px;left:"+(_width+5)+"px;}</style>");
|
||
|
domObj.find('.wf-area').append("<style>::after{top:"+(_top+_shift-6)+"px;}</style>");
|
||
|
if(_returntype && _returntype == WF_PARAMS.RENDER_TYPE_DOM){
|
||
|
return domObj;
|
||
|
}else{
|
||
|
$('#'+_containerid).empty();
|
||
|
domObj.appendTo('#'+_containerid);
|
||
|
}
|
||
|
}else{
|
||
|
if(_returntype && _returntype == WF_PARAMS.RENDER_TYPE_DOM){
|
||
|
return $('<span></span>');
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
,wfPanelGrid:function(jparam){
|
||
|
var _bdl_code = jparam.bdl_code?jparam.bdl_code:'';
|
||
|
var _manageunituuid = jparam.manage_unit_uuid?jparam.manage_unit_uuid:'';
|
||
|
var _isReload = jparam.reload;
|
||
|
if(!_isReload == true){
|
||
|
if(!_bdl_code){
|
||
|
alert('参数bdl_code不允许为空!');
|
||
|
return;
|
||
|
}
|
||
|
if(!_manageunituuid){
|
||
|
alert('参数manage_unit_uuid不允许为空!');
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
var _containHeight = jparam.rowHeight?jparam.rowHeight:90;
|
||
|
var _width = jparam.width?jparam.width:30;
|
||
|
var _rowRender = jparam.rowRender?jparam.rowRender:function(){};
|
||
|
jparam.rowRender = wfRowRender;
|
||
|
if(!_isReload == true){
|
||
|
$.cuajax({
|
||
|
url : 'wdk?action=wdk.pub&method=call_service&ajaxparam='+ new Date().getTime(),
|
||
|
method : "post",
|
||
|
timeout : WDK_Timeout,
|
||
|
data : {
|
||
|
_SRVNAME : 'service.bdl.run',
|
||
|
_SRVMETHOD : 'queryWfNodeListByBdlCode',
|
||
|
_DATA : $.json2str({
|
||
|
bdlcode : _bdl_code,
|
||
|
manage_unit_uuid : _manageunituuid
|
||
|
})
|
||
|
},
|
||
|
success : function(result) {
|
||
|
$.wait_close();
|
||
|
var jres = $.str2json(result);//返回值字符串转json
|
||
|
if (jres && jres.code == "1") { //操作成功
|
||
|
_nodedata = jres.result;
|
||
|
var gridid = $.panelGrid(jparam);
|
||
|
} else {
|
||
|
alert(jres.desc);
|
||
|
}
|
||
|
},
|
||
|
error : function(result) {
|
||
|
$.wait_close();
|
||
|
alert('网络错误!result=' + result);
|
||
|
}
|
||
|
});
|
||
|
}else{
|
||
|
var gridid = $.panelGrid(jparam);
|
||
|
}
|
||
|
function wfRowRender(row,index,data){
|
||
|
var wfdom = $.wfchat({
|
||
|
containerid:'wf_chat_'+index
|
||
|
,containerheight:_containHeight
|
||
|
,width:_width
|
||
|
,returntype:WF_PARAMS.RENDER_TYPE_DOM
|
||
|
,data:_nodedata
|
||
|
,current:row.currentstepcode
|
||
|
,blink:jparam.blink?jparam.blink:''
|
||
|
});
|
||
|
var wfchart = wfdom.prop('outerHTML');
|
||
|
return _rowRender(row,index,data,wfchart);
|
||
|
}
|
||
|
},
|
||
|
wfPanelGrid_reload:function(jparam){
|
||
|
jparam.reload = true;
|
||
|
$.wfPanelGrid(jparam);
|
||
|
/*
|
||
|
$.cuajax({
|
||
|
url : 'wdk?action=wdk.pub&method=call_service&ajaxparam='+ new Date().getTime(),
|
||
|
method : "post",
|
||
|
timeout : WDK_Timeout,
|
||
|
data : {
|
||
|
_SRVNAME : 'service.bdl.run',
|
||
|
_SRVMETHOD : 'queryWfNodeListByBdlCode',
|
||
|
_DATA : $.json2str({
|
||
|
bdlcode : _bdl_code,
|
||
|
manage_unit_uuid : _manageunituuid
|
||
|
})
|
||
|
},
|
||
|
success : function(result) {
|
||
|
$.wait_close();
|
||
|
var jres = $.str2json(result);//返回值字符串转json
|
||
|
if (jres.code == "1") { //操作成功
|
||
|
_nodedata = jres.result;
|
||
|
var params = getGridQueryParam();
|
||
|
var gridid=$.panelGrid({
|
||
|
containerid:'#layout_grid',
|
||
|
url : 'wdk?action=wdk.pub&method=call_service&ajaxparam='
|
||
|
+ new Date().getTime(),
|
||
|
queryParams : params,
|
||
|
onClick:function(index, row){
|
||
|
|
||
|
},
|
||
|
rowRender:_rowRender
|
||
|
});
|
||
|
} else {
|
||
|
alert(jres.desc);
|
||
|
}
|
||
|
},
|
||
|
error : function(result) {
|
||
|
$.wait_close();
|
||
|
alert('网络错误!result=' + result);
|
||
|
}
|
||
|
});*/
|
||
|
|
||
|
/*var wfdom = $.wfchat({
|
||
|
containerid:'wf_chat_'+index
|
||
|
,containerheight:90
|
||
|
,width:30
|
||
|
,returntype:WF_PARAMS.RENDER_TYPE_DOM
|
||
|
,data:_nodedata
|
||
|
,current:row.currentstepcode
|
||
|
});
|
||
|
if(wfdom){
|
||
|
rowHtmlStr.push(wfdom.prop('outerHTML'));
|
||
|
}*/
|
||
|
}
|
||
|
});
|