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

112 lines
4.1 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 routeType=CurPage.getParameter("RouteType");
%>
<%@ 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">条件</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("{stepno:\""+tds[1].innerText+"\",stepcondition:\""+tds[2].innerText+"\"}")
}
parent.AsDialog.ClosePage("["+json+"]");
}
function initTabel(){
var sjsonData='<%=CurPage.getParameter("StepInfo")%>';
if(sjsonData.length>10){
var jsonData=eval("("+sjsonData+")");
for(var i=0;i<jsonData.length;i++){
$("<tr><td style='width:10%'><input type='checkbox'/>"+i+"</td><td style='width:20%'>"+jsonData[i].stepno+"</td><td style='width:70%;word-wrap:break-word;word-break:break-all;'>"+jsonData[i].stepcondition.replace("@","#")+"</td></tr>").appendTo($("#id_table"));
}
}
}
$(function(){
initTabel();
});
function addUser(){
var sparam="RowIndex=-1&RouteType=<%=routeType%>&StepNo=&StepCondition=&FlowNo=<%=flowno%>";
var sUrl="/AppConfig/FlowManage/FlowStepConfig/FlowStep.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+"&StepNo="+tds[1].innerText+"&StepCondition="+tds[2].innerText.replace("#","@")+"&FlowNo=<%=flowno%>&RouteType=<%=routeType%>";
alert(sparam);
var sUrl="/AppConfig/FlowManage/FlowStepConfig/FlowStep.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;
$("<tr><td style='width:10%'><input type='checkbox' /></td><td style='width:20%'>"+sReturn.stepno+"</td><td style='width:70%;word-wrap:break-word;word-break:break-all;'>"+sReturn.stepcondition+"</td></tr>").appendTo($("#id_table"));
}else{
var trs=$("#id_table tr:eq("+sReturn.rowindex+")");
var tds=trs[0].childNodes;
tds[1].innerText=sReturn.stepno;
tds[2].innerText=sReturn.stepcondition;
}
}
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"%>