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.
 
 
 
 
 
 

576 lines
18 KiB

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
BaseSessionUser su = (BaseSessionUser)session.getAttribute(WDKConstant.SESSION_USER);
String WDK_ROOT = WDKCore.inst.WDK_ROOT;
%>
<!DOCTYPE html>
<%@page import="org.wdk.WDKConstant"%>
<%@page import="org.wdk.WDKCore"%>
<%@page import="org.wdk.core.base.BaseSessionUser"%>
<html>
<head>
<base href="<%=basePath%>" target="_self">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>待办处理-推进</title>
<jsp:include page='<%=WDKCore.inst.WDK_COMMON %>'></jsp:include>
<script type="text/javascript" src="<%=WDK_ROOT%>/core/js/wdk.js"></script>
<script type="text/javascript">
var _param = $.getURLParam('param');
_param = $.decode(_param);
var jtask = $.str2json(_param);
var _pdid = jtask.pdid;
var _piid = jtask.piid;
var _nodename = jtask.nodename;
var _nodetype = jtask.nodetype;
var _islastactor = jtask.islastactor;
var _issub = jtask.issub;
var _islastsub = jtask.islastsub;
window.onload = function(){
// $.wait_open();
// alert($.json2str(jtask))
//初始化显示
$('#nodename').html(_nodename);
$('#actorid').html(jtask.actorid);
if('sign'==_nodetype){
//获取当前会签进度
$.cuajax({
url:'wdk?action=wdk.wf&method=task_submit_signprocess&ajaxparam='+new Date().getTime()
,method:"post"
,timeout:WDK_Timeout
,data:{
pdid:_pdid
,piid:_piid
,nodename:_nodename
}
,success:function(result) {
var jres = $.str2json(result);
var jactors = jres.actors;
var htmlarr = [];
for(var i=0;i<jactors.length;i++){
var jactor = jactors[i];
htmlarr.push('<br><span style="margin:50px;">'+(('0'==jactor.iscomplete)?'待处理':(('1'==jactor.ispass)?'已通过':'未通过'))+'</span><span style="margin:1px;">'+jactor.actorid+'</span>');
}
$('#item_signinfo').css('display','block');
$('#signinfo').html(htmlarr.join(''));
if('0'==_islastactor){
$('#item_nextnode').css('display','none');
$('#item_signtype').css('display','none');
$('#item_nextactors').css('display','none');
}else{
init();
}
}
,error:function(result){
$.wait_close();
alert('网络错误!result='+result);
}
});
}else{
init();
}
};
function init(){
//初始化下一环节选择
var _data = {
pdid:_pdid
,nodename:jtask.nodename
};
$.cuajax({
url:'wdk?action=wdk.wf&method=node_nextnodes&ajaxparam='+new Date().getTime()
,method:"post"
,timeout:WDK_Timeout
,data:_data
,success:function(result) {
var htmlarr = [];
var jnodes = $.str2json(result);
var checkedNodename = "";
for(var i=0;i<jnodes.length;i++){
var jnode = jnodes[i];
htmlarr.push('<input name="nextnode" type="radio" value="'+_pdid+","+jnode.nodename+","+jnode.nodetype+'" onclick="node_click(this)" '+(0==i?'checked':'')+'>'+jnode.nodename+'&nbsp;&nbsp;');
if(0==i){
checkedNodename = jnode.nodename;
if('sign'==jnode.nodetype){
$('#item_signtype').css('display','block');
document.getElementById('signtype_0').checked = true;
$('#item_nextactors2').css('display','none');
}else if('end'==jnode.nodetype){
$('#item_signtype').css('display','none');
$('#item_nextactors').css('display','none');
$('#item_nextactors2').css('display','none');
//如果是结束节点,判断当前流程是否是子流程的结束节点
//如果是子流程的结束节点,则显示父流程下一流程走向,同时人员选择和父流程下一流程环节关联
if('1'==_islastsub){
showParentNextNode();
}else{
//如果不是子流程的结束节点,那么就隐藏父流程的走向和人员选择
hidenParentNextNode();
}
}else{
$('#item_signtype').css('display','none');
$('#item_nextactors2').css('display','none');
}
}
}
$('#nextnodes').html(htmlarr.join(''));
//初始化构建树
//var next_nodename = $("input[name='nextnode'][type='radio']:checked").val();
actors_init(_pdid,checkedNodename);
}
,error:function(result){
$.wait_close();
alert('网络错误!result='+result);
}
});
}
//参与环节点击,用来刷新环节参与者列表
function node_click(btn){
var pdid = btn.value.split(',')[0];
var name = btn.value.split(',')[1];
var type = btn.value.split(',')[2];
if('sign'==type){
$('#item_nextactors').css('display','block');
$('#item_signtype').css('display','block');
document.getElementById('signtype_0').checked = true;
$('#item_nextactors2').css('display','none');
}else if('end'==type){
$('#item_signtype').css('display','none');
$('#item_nextactors2').css('display','none');
//如果是结束节点,判断当前流程是否是子流程的结束节点
//如果是子流程的结束节点,则显示父流程下一流程走向,同时人员选择和父流程下一流程环节关联
if('1'==_issub&&'1'==_islastsub){
showParentNextNode();
}else{
//如果不是子流程的结束节点,那么就隐藏父流程的走向和人员选择
hidenParentNextNode();
}
}else{
$('#item_nextactors').css('display','block');
$('#item_signtype').css('display','none');
$('#item_nextactors2').css('display','none');
}
var _queryParams = {
pdid:pdid
,nodename:name
};
$.tree_reload ({
id:'nextactors',
url:"wdk?action=wdk.wf&method=node_actors",
queryParams:_queryParams
});
}
//初始化父流程的下一环节节点列表
function showParentNextNode(){
$('#item_parentnextnode').css('display','block');
//这里需要考虑用父流程的节点来加载,同时再构建树的时候也要用父流程的节点来构建
var _data = {
pdid:jtask.ppdid
,nodename:jtask.pnodename
};
$.cuajax({
url:'wdk?action=wdk.wf&method=node_nextnodes&ajaxparam='+new Date().getTime()
,method:"post"
,timeout:WDK_Timeout
,data:_data
,success:function(result) {
var htmlarr = [];
var jnodes = $.str2json(result);
var checkedNodename = "";
for(var i=0;i<jnodes.length;i++){
var jnode = jnodes[i];
checkedNodename = jnode.nodename;
htmlarr.push('<input name="pnextnode" type="radio" value="'+jtask.ppdid+","+jnode.nodename+","+jnode.nodetype+'" onclick="node_click(this)" '+(0==i?'checked':'')+'>'+jnode.nodename+'&nbsp;&nbsp;');
if(0==i){
if('sign'==jnode.nodetype){
$('#item_nextactors').css('display','block');
$('#item_signtype').css('display','block');
document.getElementById('signtype_0').checked = true;
$('#item_nextactors2').css('display','none');
}else if('end'==jnode.nodetype){
$('#item_signtype').css('display','none');
$('#item_nextactors').css('display','none');
}else{
$('#item_nextactors').css('display','block');
$('#item_signtype').css('display','none');
$('#item_nextactors2').css('display','none');
}
}
}
$('#parentnextnodes').html(htmlarr.join(''));
//初始化构建树
//var next_nodename = $("input[name='nextnode'][type='radio']:checked").val();
actors_init(jtask.ppdid,checkedNodename);
}
,error:function(result){
$.wait_close();
alert('网络错误!result='+result);
}
});
}
function hidenParentNextNode(){
$('#item_parentnextnode').css('display','none');
}
//初始化环节参与者树
function actors_init(pdid,nodename){
var _queryParams = {
pdid:pdid
,nodename:nodename
};
$.tree({
id:'nextactors',
checkbox:true,
expandall:true,
url:"wdk?action=wdk.wf&method=node_actors",
queryParams:_queryParams,
onLoadSuccess:function(node,data){
$.wait_close();
},
onCheck:function(node,checked){
actorlistUpdate(node,checked);
}
});
}
//会签顺序点击事件
function signtype_onclick(signtype){
if('0'==signtype){
//同时办理
$('#item_nextactors2').css('display','none');
}else{
$('#item_nextactors2').css('display','block');
}
}
//点击人员树节点的事件
function actorlistUpdate(node,checked){
var nodes = [];
if(-1!=node.id.indexOf('dept_')){
//如果是点击的部门,则将该部门下的所有人员依次添加
var childs = $.tree_getChildNodes({id:'nextactors',node:node});
for(var i=0;i<childs.length;i++){
var child = childs[i];
nodes.push(child);
}
}else{
nodes.push(node);
}
var listobj = document.getElementById("nextactors2");
if(checked){
//1、如果是增加
for(var i=0;i<nodes.length;i++){
var _n = nodes[i];
var actorid = _n.id;
var actortype = _n.attributes.actortype;
var hasSame = false;
//1.1、如果有相同的ID则不处理
var options = listobj.options;
for(var i=0;i<options.length;i++){
var opt = options[i];
if(opt.value == actorid+","+actortype){
hasSame = true;
break;
}
}
//1.2、如果是不同的ID则添加
if(!hasSame){
var option = new Option(actorid,actorid+','+actortype);
if(listobj){
listobj.options.add(option);
}
}
}
}else{
for(var i=0;i<nodes.length;i++){
var _n = nodes[i];
var actorid = _n.id;
var actortype = _n.attributes.actortype;
//2、如果是删除
var options = listobj.options;
for(var j=0;j<options.length;j++){
var opt = options[j];
if(opt.value == actorid+','+actortype){
listobj.remove(j);
j = j - 1;//注意这一行
}
}
}
}
}
//提交
function task_submit(){
$.wait_open();
var _data = [];
var _comment = $('#comment').val();
if('sign'==_nodetype&&'0'==_islastactor){
//提交前首先验证当前操作是否确实是最后一步
$.cuajax({
url:'wdk?action=wdk.wf&method=task_submit_checklast&ajaxparam='+new Date().getTime(),
method:"post",
timeout:WDK_Timeout,
data:{
pdid:_pdid
,piid:_piid
,nodename:_nodename
},
success:function(result) {
var jres = $.str2json(result);
if('0'==jres.islastactor){
/*
_data ={
forwardtype:'next'
,nodename:_nodename
,nodetype:_nodetype
,pdid:_pdid
,piid:_piid
,taskid:jtask.taskid
,subtaskid:jtask.subtaskid
,signtype:jtask.signtype
,actorid:jtask.actorid
,actortype:jtask.actortype
,comment:_comment
,nextnode:''
,nextnodetype:''
,nextactors:''
,tasktype:jtask.tasktype
,originactorid:jtask.originactorid
,originactortype:jtask.originactortype
,agenttype:jtask.agenttype
};
*/
_data = {
task:jtask.task
,forwardtype:'next'
,comment:_comment
};
doSubmit(_data);
}else{
alert('当前操作是会签最后一步,请选择下一办理环节');
window.location.reload();
}
},
error:function(result){
alert('网络错误!result='+result);
}
});
}else{
var _nextnode = $("input[name='nextnode'][type='radio']:checked").val();
var _next_pdid = _nextnode.split(',')[0];
var _next_nodename = _nextnode.split(',')[1];
var _next_nodetype = _nextnode.split(',')[2];
var _next_actors = [];
//是否顺序
var _signtype = $("input[name='signtype']:checked").val();
if('sign'==_next_nodetype&&'1'==_signtype){
//如果是按顺序会签,则从右边顺序列表中读取
var listobj = document.getElementById("nextactors2");
var options = listobj.options;
for(var i=0;i<options.length;i++){
var opt = options[i];
_next_actors.push(opt.value);
}
}else{
var tree_checked = $.tree_getCheckedNode({id:'nextactors'});
if(null!=tree_checked){
for(var i=0;i<tree_checked.length;i++){
var node = tree_checked[i];
if(!node){
continue;
}
var node_id = node.id;
var node_type = node.attributes.actortype;
if(-1==node_id.indexOf('dept_')){
_next_actors.push(node_id+","+node_type);
}
}
}
}
if('end'!=_next_nodetype
&&'frok'!=_next_nodetype
&&'join'!=_next_nodetype
&&'custom'!=_next_nodetype
&&'decision'!=_next_nodetype
&&_next_actors.length<1){
$.wait_close();
alert('请选择办理者!');
return;
}
/*
_data ={
forwardtype:'next'
,nodename:_nodename
,nodetype:_nodetype
,pdid:_pdid
,piid:_piid
,taskid:jtask.taskid
,subtaskid:jtask.subtaskid
,signtype:_signtype
,actorid:jtask.actorid
,actortype:jtask.actortype
,comment:_comment
,nextnode:_next_nodename
,nextnodetype:_next_nodetype
,nextactors:_next_actors.join(';')
,tasktype:jtask.tasktype
,originactorid:jtask.originactorid
,originactortype:jtask.originactortype
};
*/
_data = {
task:jtask.task
,forwardtype:'next'
,comment:_comment
,nextnode:_next_nodename
,nextnodetype:_next_nodetype
,nextactors:_next_actors.join(';')
};
doSubmit(_data);
}
}
function doSubmit(data){
//下一环节是子流程的结束环节,同时当前子流程是最后一个子流程
if('end'==data.nextnodetype&&'1'==_islastsub){
var _pnextnode = $("input[name='pnextnode'][type='radio']:checked").val();
var _pnext_pdid = _pnextnode.split(',')[0];
var _pnext_nodename = _pnextnode.split(',')[1];
var _pnext_nodetype = _pnextnode.split(',')[2];
data.ptarget = _pnext_nodename;
data.ptargettype = _pnext_nodetype;
}
$.cuajax({
url:'wdk?action=wdk.wf&method=task_submit&ajaxparam='+new Date().getTime(),
method:"post",
timeout:WDK_Timeout,
data:data,
success:function(result) {
$.wait_close();
var jres = $.str2json(result);
alert(jres.desc);
if('1'==jres.code){
$.tab_closeTop();
}else if('2'==jres.code){ //已经是最后一步,重新加载页面
//location.href = location.href+"&islast=1";
}
},
error:function(result){
alert('网络错误!result='+result);
}
});
}
</script>
</head>
<body class="easyui-layout" style="padding:0px;margin:0px;background-color:#FFFFFF;">
<!-- 按钮 -->
<div id="layout_toolbar" data-options="region:'north',border:false,collapsed:false" style="height:30px;overflow:hidden;border:1px solid #ddd;text-align:left;" >
<a class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-ok'" href="javascript:void(0)" onclick="task_submit()">提交</a>
</div>
<!-- 表格 -->
<div id="layout_content" data-options="region:'center',border:false,collapsed:false" style="overflow:hidden;border:1px solid #ddd;" >
<div class="fitem" style="height:70px;">
<div style="float:left;">
<div style="float:left;">
<span class="title">办理意见:</span>
<div id="comment" style="width:200px;height:60px;overflow:auto;border:1px solid #d4a375">
</div>
</div>
<div style="float:left;position:absolute;right:0px;width:50%;">
<span class="title">请选择办理意见:</span>
<div style="width:200px;height:60px;overflow:auto;border:1px solid #d4a375">
<a href="javascript:void" onclick="javascript:document.getElementById('comment').innerText='同意';return false;">同意</a><br>
<a href="javascript:void" onclick="javascript:document.getElementById('comment').innerText='同意发';return false;">同意发</a><br>
<a href="javascript:void" onclick="javascript:document.getElementById('comment').innerText='同意测试';return false;">同意测试</a><br>
<a href="javascript:void" onclick="javascript:document.getElementById('comment').innerText='同意转发';return false;">同意转发</a><br>
<a href="javascript:void" onclick="javascript:document.getElementById('comment').innerText='同意意见';return false;">同意意见</a><br>
<a href="javascript:void" onclick="javascript:document.getElementById('comment').innerText='全部同意';return false;">全部同意</a><br>
<a href="javascript:void" onclick="javascript:document.getElementById('comment').innerText='同意签发';return false;">同意签发</a><br>
</div>
</div>
</div>
&nbsp;
</div>
<div class="fitem">
<span class="title">当前办理环节:</span>
<span id="nodename">&nbsp;</span>
</div>
<div class="fitem">
<span class="title">当前人员:</span>
<span id="actorid">&nbsp;</span>
</div>
<div class="fitem" id="item_signinfo" style="height:70px;display:none;">
<span class="title">会签信息:</span>
<div id="signinfo" style="height:70px;width:200px;overflow:auto;">
</div>
</div>
<div class="fitem" id="item_nextnode">
<span class="title">下一办理环节:</span>
<div id="nextnodes">
<input name="nextnode" type="radio" value="">
</div>
</div>
<div class="fitem" id="item_parentnextnode" style="display:none;">
<span class="title">父流程下一环节:</span>
<div id="parentnextnodes">
<input name="parentnextnode" type="radio" value="">
</div>
</div>
<div class="fitem" id="item_signtype" style="display:none;">
<span class="title">会签顺序:</span>
<div>
<input name="signtype" id="signtype_0" onclick="signtype_onclick('0')" type="radio" value="0" checked>同时办理
<input name="signtype" id="signtype_1" onclick="signtype_onclick('1')" type="radio" value="1">顺序办理
</div>
</div>
<div id="item_nextactors" class="fitem" style="height:160px;">
<div style="float:left;">
<span class="title">办理人:</span>
<div id="nextactors" style="width:200px;height:150px;overflow:auto;border:1px solid #d4a375">
</div>
</div>
<div id="item_nextactors2" style="float:left;position:absolute;right:0px;width:50%;display:none;">
<span class="title">办理人顺序:</span>
<div style="width:200px;height:150px;overflow:auto;">
<select id="nextactors2" name="nextactors2" class="txt" multiple="multiple" style="width:200px;height:150px;border:1px solid #d4a375;">
</select>
</div>
</div>
&nbsp;
</div>
</div>
</body>
</html>