2018-06-03 22:26:41 +08:00

156 lines
6.4 KiB
Plaintext

<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/IncludeBegin.jsp"%>
<style>
.gridtable{border-collapse:collapse;}
.gridtable td,th {
border-width: 1px;
padding: 2px;
border-style: solid;
background-color: #FFFFFF;
border-color:#D9D9D9;
}
</style>
<%
String sButtons[][] = {
{"true","","Button","新增","保存修改","addUser()","","","",""},
{"true","","Button","修改","保存修改","editUser()","","","",""},
{"true","","Button","删除","保存修改","deleteUser()","","","",""},
{"true","","Button","保存","保存修改","saveUserToPage()","","","",""}
};
String flowno=CurPage.getParameter("flowno");
String selectbase=CurPage.getParameter("selectbase");
if(selectbase==null){selectbase="false";}
%>
<%@ include file="/Frame/resources/include/ui/include_buttonset.jspf"%>
<br>
<form name="myiframe0" id="myiframe0" style="margin:0px;width: 100%">
<table cellspacing="0" cellpadding="0" style="width:100%;" class="gridtable">
<tr>
<td class="td-header" style="width:10%">编号</td>
<td class="td-header" style="width:20%">人员类型</td>
<td class="td-header" style="display:none">人员</td>
<td class="td-header">人员</td>
</tr>
</table>
<div style="overflow: auto;height:400">
<table id="id_table" cellspacing="0" cellpadding="0" style="width:100%;" class="gridtable">
</table>
</div>
</form>
<script type="text/javascript">
function saveUserToPage(){
var trs=$("#id_table tr");
var json=[];
for(var i=0;i<trs.length;i++){
var tds=trs[i].childNodes;
json.push("{usertype:\""+tds[1].innerText+"\",userinfo:\""+tds[2].innerText+"\"}")
}
parent.AsDialog.ClosePage("["+json+"]");
}
function initTabel(){
/*
var jsonData=[{usertype:'指定人员',userinfo:'1'},
{usertype:'指定部门角色',userinfo:'2'},
{usertype:'指定角色人员',userinfo:'3'},
{usertype:'指定部门',userinfo:'4'},
{usertype:'流程经过所有人员',userinfo:'5'},
{usertype:'流程中指定步骤的人员',userinfo:'6'},
{usertype:'提人所在部门的角色',userinfo:'7'},
{usertype:'流程发起人所在部门的角色',userinfo:'8'},
{usertype:'根据SQL语句',userinfo:'9'},
{usertype:'根据java代码',userinfo:'10'}
];
*/
var sjsonData='<%=CurPage.getParameter("userinfo")%>';
if(sjsonData.length>10){
var jsonData=eval("("+sjsonData+")");
for(var i=0;i<jsonData.length;i++){
var usertype=jsonData[i].usertype;
if(usertype=="指定人员"||usertype=="指定角色"||usertype=="指定部门"){
var showMessage=getUserMessageShow(jsonData[i].userinfo);
$("<tr><td style='width:10%'><input type='checkbox'/></td><td style='width:20%'>"+jsonData[i].usertype+"</td><td style='display:none'>"+jsonData[i].userinfo+"</td><td style='width:70%;word-wrap:break-word;word-break:break-all;'>"+showMessage+"</td></tr>").appendTo($("#id_table"));
}else{
$("<tr><td style='width:10%'><input type='checkbox'/></td><td style='width:20%'>"+jsonData[i].usertype+"</td><td style='display:none'>"+jsonData[i].userinfo+"</td><td style='width:70%;word-wrap:break-word;word-break:break-all;'>"+jsonData[i].userinfo+"</td></tr>").appendTo($("#id_table"));
}
}
}
}
function getUserMessageShow(message){
var vMessage=message.split(",");
var showMessage="";
for(var i=1;i<vMessage.length;i=i+2){
if(showMessage!=""){showMessage=showMessage+",";}
showMessage=showMessage+vMessage[i];
}
return showMessage
}
$(function(){
initTabel();
});
function addUser(){
var sparam="rowindex=-1&usertype=&userinfo="+"&flowno=<%=flowno%>&selectbase=<%=selectbase%>";
var sUrl="/AppConfig/FlowManage/FlowUserConfig/FlowUser.jsp";
AsDialog.PopView(sUrl,sparam,"dialogWidth=600px;dialogHeight=400px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(sReturn){
insertUser(sReturn);
},"步骤修改");
}
function deleteUser(){
var cindex=getCheckIndex()
if(cindex==-1){alert("请选择删除的数据");return false;}
$('#id_table tr:eq('+cindex+')').remove();
}
function editUser(){
var cindex=getCheckIndex()
if(cindex==-1){alert("请选择要修改的数据");return false;}
var trs=$("#id_table tr:eq("+cindex+")");
var tds=trs[0].childNodes;
var sparam="rowindex="+cindex+"&usertype="+tds[1].innerText+"&userinfo="+tds[2].innerText+"&flowno=<%=flowno%>&selectbase=<%=selectbase%>";
var sUrl="/AppConfig/FlowManage/FlowUserConfig/FlowUser.jsp";
AsDialog.PopView(sUrl,sparam,"dialogWidth=600px;dialogHeight=400px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(sReturn){
insertUser(sReturn);
},"步骤修改");
}
function insertUser(sReturn){
if(sReturn==""){return false;}
if(sReturn.rowindex=="-1"){
var tIndex = $("#id_table tr").length;
var usertype=sReturn.usertype
if(usertype=="指定人员"||usertype=="指定角色"||usertype=="指定部门"){
var showMessage=getUserMessageShow(sReturn.userinfo);
$("<tr><td style='width:10%'><input type='checkbox' /></td><td style='width:20%'>"+sReturn.usertype+"</td><td style='display:none'>"+sReturn.userinfo+"</td><td style='width:70%;word-wrap:break-word;word-break:break-all;'>"+showMessage+"</td></tr>").appendTo($("#id_table"));
}else{
$("<tr><td style='width:10%'><input type='checkbox' /></td><td style='width:20%'>"+sReturn.usertype+"</td><td style='display:none'>"+sReturn.userinfo+"</td><td style='width:70%;word-wrap:break-word;word-break:break-all;'>"+sReturn.userinfo+"</td></tr>").appendTo($("#id_table"));
}
}else{
var trs=$("#id_table tr:eq("+sReturn.rowindex+")");
var tds=trs[0].childNodes;
tds[1].innerText=sReturn.usertype;
var usertype=sReturn.usertype
if(usertype=="指定人员"||usertype=="指定角色"||usertype=="指定部门"){
var showMessage=getUserMessageShow(sReturn.userinfo);
tds[2].innerText=sReturn.userinfo;
tds[3].innerText=showMessage;
}else{
tds[2].innerText=sReturn.userinfo;
tds[3].innerText=sReturn.userinfo;
}
}
}
function getCheckIndex(){
var checkboxs=$("#id_table input[type='checkbox']");
for(var i=0;i<checkboxs.length;i++){
if(checkboxs[i].checked){
return i;
}
}
return -1;
}
</script>
<%@ include file="/Frame/page/jspf/include/jsp_syntaxhighlighter.jspf"%>
<%@ include file="/IncludeEnd.jsp"%>