282 lines
10 KiB
Plaintext
282 lines
10 KiB
Plaintext
<%@page import="com.amarsoft.biz.workflow.*"%>
|
||
<%@page import="com.amarsoft.are.lang.StringX"%>
|
||
<%@page contentType="text/html; charset=GBK"%>
|
||
<%@include file="/Frame/resources/include/include_begin.jspf"%>
|
||
<%
|
||
String taskNo = CurPage.getParameter("TaskNo");
|
||
if(StringX.isSpace(taskNo)) taskNo = "";
|
||
String userID = CurUser.getUserID();
|
||
FlowTask ft = new FlowTask(taskNo,Sqlca);
|
||
String flowNo = ft.FlowNo;
|
||
String[] phaseOpinion = ft.getChoiceList();
|
||
int iNum = phaseOpinion.length;
|
||
%>
|
||
<style>
|
||
.opinion-style{
|
||
width:100%;
|
||
overflow:hidden;
|
||
display:inline-block;
|
||
margin-bottom:2px;
|
||
outline:none;
|
||
}
|
||
.opinion-style2{
|
||
overflow:hidden;
|
||
display:inline-block;
|
||
margin-bottom:2px;
|
||
outline:none;
|
||
}
|
||
a.opinion-style:hover{
|
||
background-color:A8CAE5;
|
||
outline:none;
|
||
}
|
||
.opinion-focus{
|
||
background-color:A8CAE5;
|
||
}
|
||
</style>
|
||
<div>
|
||
<table>
|
||
<tr>
|
||
<td width="50%" align="right"><%=new Button("提交","确认提交","javascript:commitAction();","","btn_icon_Submit","").getHtmlText()%></td>
|
||
<td width="50%" align="center"><%=new Button("放弃","放弃提交","javascript:doCancel();","","btn_icon_delete","").getHtmlText()%></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div id="opinionset">
|
||
<div style="margin-top:10px;margin-left:15px;font-size:12px;">
|
||
<font color="#000000"><b>请选择下一阶段提交动作1:</b></font>
|
||
</div>
|
||
<div style="margin-top:10px;margin-left:10px;font-size:12px;border:1px solid lightgray;padding:10px;">
|
||
<%
|
||
for(int i=0;i<iNum;i++){
|
||
out.println("<a class='opinion-style2' href='javascript:void(0)' onclick='doActionList(this)'>"+
|
||
"<input type='radio' name='phaseopinion' value='" + phaseOpinion[i] + "' >" + phaseOpinion[i]+ "</input></a>");
|
||
}
|
||
%>
|
||
</div>
|
||
</div>
|
||
<div id="actionset"></div>
|
||
<div>
|
||
<table width="100%" align="center">
|
||
<tr>
|
||
<td align="center"><b><span id="phaseinfo" style="color: #FF0000" ></span></b></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<script type="text/javascript">
|
||
var taskNo = "<%=taskNo%>";
|
||
var actionSet = $("#actionset");
|
||
var phaseInfoSet = $("#phaseinfo");
|
||
var bActionReqiured = true; //是否需要选择动作(如果为退回一类的,就不需要选择下一步Action了)
|
||
//提交动作选择
|
||
function doActionList(obj){
|
||
alert(11);
|
||
//var phaseOpinion = $(obj).val();//$("#PhaseOpinion").find("option:selected").val()
|
||
$(obj).siblings().removeClass("opinion-focus");
|
||
$(obj).addClass("opinion-focus");
|
||
var phaseOpinion = $(obj).find("input").val();
|
||
$(obj).find("input").prop("checked","true");
|
||
if(!phaseOpinion){
|
||
alert("请选择提交动作!");
|
||
actionSet.empty().hide();
|
||
phaseInfoSet.text("");
|
||
return;
|
||
}else{
|
||
getNextActionList(phaseOpinion);
|
||
}
|
||
}
|
||
|
||
function getNextActionList(phaseOpinion){
|
||
//获取下阶段的阶段属性(可能多个阶段)
|
||
var nextPhaseAttrs = RunJavaMethodTrans("com.amarsoft.app.flow.FlowAction","getNextPhaseAttr","TaskNo="+taskNo+",PhaseOpinion="+phaseOpinion);
|
||
var nextPhases = nextPhaseAttrs.split("@");
|
||
//非并行阶段
|
||
if(nextPhases.length==1){
|
||
var nextPhaseDes = "";
|
||
nextPhaseDes = nextPhases[0].split(",")[2];
|
||
//如果节点类型为任务池或结束或补充资料则隐藏动作选择框
|
||
if(nextPhaseDes == "POOL" || nextPhaseDes == "END" || nextPhaseDes == "SUPPLY" || nextPhaseDes == "FORK&POOL"){
|
||
bActionReqiured = false;
|
||
}else{
|
||
bActionReqiured = true;
|
||
}
|
||
}
|
||
if(bActionReqiured){
|
||
var actionList = RunJavaMethodTrans("com.amarsoft.app.flow.FlowAction","getActionList","TaskNo="+taskNo+",PhaseOpinion="+phaseOpinion);
|
||
if(actionList == "CONTINUE"){
|
||
actionSet.empty().hide();
|
||
phaseInfoSet.text("所选阶段没有用户可以选择,请确认!");
|
||
return;
|
||
}
|
||
phaseInfoSet.text("");
|
||
actionSet.empty().show();
|
||
if(nextPhases.length>1){
|
||
for(var i = 0; i < nextPhases.length; i++){
|
||
var mPhaseName = nextPhases[i].split(",")[1];
|
||
var mPhaseNo = nextPhases[i].split(",")[0];
|
||
var mPhaseDes = nextPhases[i].split(",")[2];
|
||
if(mPhaseDes == "POOL" || mPhaseDes == "END"|| mPhaseDes == "SUPPLY" || mPhaseDes == "FORK&POOL"){}else{
|
||
actionSet.append("<div style='margin-top:10px;margin-left:15px;font-size:12px;'><font color='#000000'><b>请选择"+mPhaseName+"用户:</b></font></div><div id='phaseaction"+i+"' style='margin-top:10px;margin-left:10px;font-size:12px;border:1px solid lightgray;padding:5px;'></div>");
|
||
var phaseAction = $("#phaseaction"+i);
|
||
for(var j=0;j<actionList.split("@").length;j++){
|
||
var userIDStr = actionList.split("@")[j];
|
||
var userID = userIDStr.split(" ")[0];
|
||
if(userID.indexOf("|")>-1){
|
||
var phaseNo = userID.split("|")[0];
|
||
if(mPhaseNo == phaseNo){
|
||
userIDStr = userIDStr.replace(phaseNo+"|","");
|
||
phaseAction.append("<a class='opinion-style' href='javascript:void(0)' onclick='getNextPhaseInfo(this)'><input type='radio' name='phaseaction"+i+"' value='"+userIDStr+"'>"+userIDStr+"</input></a>");
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}else{
|
||
var mPhaseName = nextPhases[0].split(",")[1];
|
||
var mPhaseNo = nextPhases[0].split(",")[0];
|
||
actionSet.append("<div style='margin-top:10px;margin-left:15px;font-size:12px;'><font color='#000000'><b>请选择"+mPhaseName+"用户:</b></font></div><div id='phaseaction' style='margin-top:10px;margin-left:10px;font-size:12px;border:1px solid lightgray;padding:5px;'></div>");
|
||
var phaseAction = $("#phaseaction");
|
||
var isMeeting = AsControl.RunJavaMethodTrans("com.amarsoft.app.flow.FlowAction","isMeeting","FlowNo=<%=flowNo%>,PhaseNo="+mPhaseNo);
|
||
var type = "radio";
|
||
if(isMeeting == "yes")type="checkbox";
|
||
for(var j=0;j<actionList.split("@").length;j++){
|
||
var userIDStr = actionList.split("@")[j];
|
||
phaseAction.append("<a class='opinion-style' href='javascript:void(0)' onclick='getNextPhaseInfo(this)'><input type='"+type+"' name='phaseaction' value='"+userIDStr+"'>"+userIDStr+"</input></a>");
|
||
}
|
||
}
|
||
}else{
|
||
actionSet.empty().hide();
|
||
getNextPhaseInfo("");
|
||
}
|
||
}
|
||
|
||
/*~[Describe=获取所选择的提交动作;InputParam=无;OutPutParam=无;]~*/
|
||
function getNextActionValue(nextPhases){
|
||
var phaseAction = "";
|
||
if(nextPhases.length==1){
|
||
var nextPhaseDes = "";
|
||
nextPhaseDes = nextPhases[0].split(",")[2];
|
||
if(nextPhaseDes == "POOL" || nextPhaseDes == "FORK&POOL"){
|
||
var phaseOpinion = $("input[name='phaseopinion']:checked").val();
|
||
phaseAction = RunJavaMethodTrans("com.amarsoft.app.flow.FlowAction","getActionList","TaskNo="+taskNo+",PhaseOpinion="+phaseOpinion);
|
||
}else if(nextPhaseDes == "END"){
|
||
phaseAction = "system";
|
||
}else{
|
||
var checkedbox = [];
|
||
$("input[name='phaseaction']:checked").each(function(){
|
||
checkedbox.push($(this).val());
|
||
});
|
||
phaseAction = checkedbox.join("@");
|
||
}
|
||
}else{
|
||
|
||
var phaseOpinion = $("input[name='phaseopinion']:checked").val();
|
||
var actionList = RunJavaMethodTrans("com.amarsoft.app.flow.FlowAction","getActionList","TaskNo="+taskNo+",PhaseOpinion="+phaseOpinion);
|
||
|
||
for(var i = 0; i < nextPhases.length; i++){
|
||
|
||
var mPhaseName = nextPhases[i].split(",")[1];
|
||
var mPhaseNo = nextPhases[i].split(",")[0];
|
||
var mPhaseDes = nextPhases[i].split(",")[2];
|
||
var mPhaseAction = "";
|
||
if(mPhaseDes == "POOL" || mPhaseDes == "FORK&POOL"){
|
||
for(var j=0;j<actionList.split("@").length;j++){
|
||
var userIDStr = actionList.split("@")[j];
|
||
var userID = userIDStr.split(" ")[0];
|
||
if(userID.indexOf("|")>-1){
|
||
var phaseNo = userID.split("|")[0];
|
||
if(mPhaseNo == phaseNo){
|
||
mPhaseAction = mPhaseAction + "@" + userIDStr;
|
||
}
|
||
}
|
||
}
|
||
if(mPhaseAction.indexOf("@")>-1) mPhaseAction = mPhaseAction.substring(1);
|
||
phaseAction +="@"+ mPhaseAction;
|
||
}else{
|
||
var mPhaseAction = $("input[name='phaseaction"+i+"']:checked").val();
|
||
phaseAction +="@" + mPhaseNo+"|"+ mPhaseAction;
|
||
}
|
||
|
||
if(!mPhaseAction){
|
||
alert("请选择"+mPhaseName+"用户!");
|
||
return;
|
||
}
|
||
|
||
}
|
||
if(phaseAction.indexOf("@")>-1) phaseAction = phaseAction.substring(1);
|
||
|
||
}
|
||
return phaseAction;
|
||
}
|
||
//获取下一阶段动作
|
||
function getNextPhaseInfo(obj){
|
||
//var phaseOpinion = $("#phaseopinion").val();
|
||
var phaseOpinion = $("input[name='phaseopinion']:checked").val();
|
||
$(obj).siblings().removeClass("opinion-focus");
|
||
$(obj).addClass("opinion-focus");
|
||
$(obj).find("input").each(function(){
|
||
//$(this).attr('checked',!this.checked);
|
||
if($(this).attr('checked')){
|
||
$(this).removeAttr('checked');
|
||
}else{
|
||
$(this).attr('checked','true');
|
||
}
|
||
});
|
||
var nextPhaseInfo = RunJavaMethodTrans("com.amarsoft.app.flow.FlowAction","getNextPhaseInfo","TaskNo="+taskNo+",PhaseOpinion="+phaseOpinion);
|
||
phaseInfoSet.text(nextPhaseInfo);
|
||
}
|
||
|
||
//提交动作
|
||
function commitAction(){
|
||
|
||
var phaseOpinion = $("input[name='phaseopinion']:checked").val();
|
||
var nextPhaseAttrs = RunJavaMethodTrans("com.amarsoft.app.flow.FlowAction","getNextPhaseAttr","TaskNo="+taskNo+",PhaseOpinion="+phaseOpinion);
|
||
var nextPhases = nextPhaseAttrs.split("@");
|
||
|
||
if(!phaseOpinion){
|
||
alert("请选择提交动作!");
|
||
actionSet.empty().hide();
|
||
phaseInfoSet.text("");
|
||
return;
|
||
}
|
||
var phaseAction = "";
|
||
if(true){
|
||
phaseAction = getNextActionValue(nextPhases);
|
||
if(!phaseAction){
|
||
alert("请选择提交用户信息!");
|
||
return;
|
||
};
|
||
}
|
||
var param = "TaskNo="+taskNo+",PhaseAction="+phaseAction+",PhaseOpinion="+phaseOpinion;
|
||
var joinNode = RunJavaMethodTrans("com.amarsoft.app.flow.FlowAction","isJoinNode",param);
|
||
if(joinNode=="1"){//如果是join节点
|
||
var joinUserID = RunJavaMethodTrans("com.amarsoft.app.flow.FlowAction","getJoinUser",param);
|
||
var curUserID = phaseAction.split(" ")[0];
|
||
if(curUserID!=joinUserID && joinUserID!=""){
|
||
alert("先前分支的提交人为"+joinUserID+",请选择相同人员");
|
||
return;
|
||
};
|
||
}
|
||
|
||
var nextPhaseInfo = phaseInfoSet.text();
|
||
if (!confirm("该笔业务的"+nextPhaseInfo+"\r\n你确定提交吗?")) return;
|
||
alert("TaskNo="+taskNo+",PhaseOpinion="+phaseOpinion+",UserID=<%=userID%>,PhaseAction="+phaseAction);
|
||
var returnValue = RunJavaMethodTrans("com.amarsoft.app.flow.FlowAction","submit","TaskNo="+taskNo+",PhaseOpinion="+phaseOpinion+",UserID=<%=userID%>,PhaseAction="+phaseAction);
|
||
top.returnValue = returnValue;
|
||
top.close();
|
||
}
|
||
|
||
function init(){
|
||
actionSet.empty().hide();
|
||
}
|
||
window.onload = function(){
|
||
init();
|
||
};
|
||
function doCancel(){
|
||
if(confirm("您确定要放弃此次提交吗?")){
|
||
top.returnValue = "_CANCEL_";
|
||
top.close();
|
||
}
|
||
}
|
||
</script>
|
||
<%@include file="/Frame/resources/include/include_end.jspf"%>
|