📄 chargetype.jsp
字号:
<%@ page language="java" pageEncoding="gbk" import="bean.ChargeItem,java.util.*,dbManager.DBManager,java.sql.ResultSet"%>
<html>
<head>
<title>收费类型管理</title>
<link rel="stylesheet" type="text/css" href="../../../css/secondcss.css">
<script type="text/javascript">
// 删除操作提示
function DeleteInfo()
{
if( form1.dropTypeName.value == "00")
{
alert('请选择要删除的收费类型');
return false;
}
else if( confirm("您确定要删除该收费类型吗?如果删除将无法恢复!") )
{
form1.action="../../../deleteChargeType.do";
form1.submit();
}
}
// 页面加载时的操作
function pageOnload( index )
{
if( index != null )
{
form1.dropTypeName.options[index].selected = true;
form1.newTypeName.value=form1.dropTypeName.value;
form1.newTypeName.readOnly = true;
}
}
// 查看收费类型
function change()
{
if( form1.dropTypeName.value == "00")
{
alert('请选择要查询的收费类型');
return false;
}
else
{
form1.hdIndex.value=form1.dropTypeName.selectedIndex;
form1.action="../../../changeType.do";
form1.submit();
}
}
// 增加新的收费类型
function addNewType()
{
document.getElementById('tab').style.visibility = 'visible';
form1.newTypeName.value = "";
form1.newTypeName.readOnly = false;
form1.newTypeName.focus();
form1.dropSelectedRate.options.length=0;
}
// 验证选择的收费项目是否为空
function saveNewType()
{
if( form1.newTypeName.value.length==0)
{
alert('收费类型名称不能为空!');
return false;
}
if( form1.dropSelectedRate.options.length==0 )
{
alert('请至少选择一种收费项目!');
return false;
}
else
{
var dsps = form1.dropSelectedRate.options;
for( var i=0; i<dsps.length;i++)
{
dsps[i].selected = true;
}
form1.action="../../../addChargeType.do";
if(form1.newTypeName.readOnly)
{
form1.action="../../../editChargeType.do";
}
form1.submit();
}
}
// 选择单个或多个收费项目
function addRate( btnID )
{
var daps = form1.dropAllRate.options;
var dsps = form1.dropSelectedRate.options;
var ds = form1.dropSelectedRate;
for( var i=0; i<daps.length;i++)
{
if( btnID == 'sAll') // 如果点击的是全部选择按钮,让每一项都选中。
daps[i].selected = true;
if( daps[i].selected )
{
var obj = document.createElement("option");
obj.text = daps[i].text;
obj.value = daps[i].value;
for( var j=0; j<dsps.length; j++ )
{
if( dsps[j].text == obj.text )
break;
}
if(j==dsps.length ) // 如果没有重复的项,则添加,负责不重复添加
ds.add( obj );
}
daps[i].selected = false; // 移动被选择的项后让选中的项不再被选中。
}
}
// 移除被选中的项
function moveRate()
{
var dsps = form1.dropSelectedRate.options;
var ds = form1.dropSelectedRate;
for( var i=0; i<dsps.length; i++ )
{
if(dsps[i].selected )
{
ds.remove(i); // 删除后指针会下移以为,因此需将索引向上移动以为
i--;
}
}
}
</script>
</head>
<%
String index = request.getParameter("n"); // 选择的收费类型的索引号
%>
<body onload="pageOnload(<%=index %>)">
<form id="form1" name="form1" method="post">
<table width="99%" border="0" style="border-top-width: 0px; border-left-width: 0px; background: none transparent scroll repeat 0% 0%;
border-bottom-width: 0px; letter-spacing: 0px; border-right-width: 0px; border-spacing: 0px">
<!--按钮操作表格-->
<tr>
<td width="36%"><div align="left"><strong><font size="3">收费类型管理</font></strong></div></td>
<td width="11%"><div align="right">收费类型:</div></td>
<td width="9%">
<input type="hidden" name="hdIndex" value=""> <!--传递选择的收费类型的索引-->
<select name="dropTypeName" onchange="return change();" style="font-size: 9pt">
<option value="00">请选择</option>
<%
DBManager db = new DBManager();
String selType = "select * from t_type";
ResultSet rsType = db.getResult(selType);
while( rsType.next() )
{
%>
<option value="<%=rsType.getString("typeID") %>"><%=rsType.getString("typeName") %></option>
<%
}
db.close();
%>
</select>
</td>
<td width="8%"><img src="../../../images/zengjia1.gif" width="69" height="22px" style="cursor:hand"
onmousemove="this.src='../../../images/zengjia2.gif'"
onmouseout="this.src='../../../images/zengjia1.gif'"
onmousedown="this.src='../../../images/zengjia3.gif'"
onmouseup="this.src='../../../images/zengjia2.gif'"
onclick="return addNewType()"></td>
<td width="8%"><img src="../../../images/shanchu1.gif" width="69" height="22px" style="cursor:hand"
onmousemove="this.src='../../../images/shanchu2.gif'"
onmouseout="this.src='../../../images/shanchu1.gif'"
onmousedown="this.src='../../../images/shanchu3.gif'"
onmouseup="this.src='../../../images/shanchu2.gif'"
onclick="return DeleteInfo();"></td>
<td width="8%"><img src="../../../images/dayin1.gif" width="69" height="22px" style="cursor:hand"
onmousemove="this.src='../../../images/dayin2.gif'"
onmouseout="this.src='../../../images/dayin1.gif'"
onmousedown="this.src='../../../images/dayin3.gif'"
onmouseup="this.src='../../../images/dayin2.gif'"
onclick="if(confirm('您确定打印吗?')){ window.print();}"></td>
</tr>
</table>
<br>
<hr color="green">
<br>
<!--增加新的收费类型表格-->
<table id="tab" width="60%" style="border-top-width: 0px; border-left-width: 0px; background: none transparent scroll repeat 0% 0%;
border-bottom-width: 0px; letter-spacing: 0px; border-right-width: 0px; border-spacing: 0px;visibility: hidden;">
<tr style="height: 18px">
<td style="text-align: left;">收费类型名称:
<input type="text" name="newTypeName" style="text-align: center;width: 100px;height: 20px;font-size: 9pt">
</td>
</tr>
</table>
<!--主内容显示表格-->
<table width="60%" style="border-top-width: 0px; border-left-width: 0px; background: none transparent scroll repeat 0% 0%;
border-bottom-width: 0px; letter-spacing: 0px; border-right-width: 0px; border-spacing: 0px">
<tbody>
<tr style="background-color:#5D7B9D;color:white; ">
<td style="text-align: left">所有的收费项目</td>
<td></td>
<td style="text-align: left">已选择的收费项目</td>
</tr>
<tr style="background-color: #F7F6F3;color:#333333; ">
<td style="width: 10%" valign="top">
<select name="dropAllRate" multiple="multiple" size="20" style="width: 100%;font-size: 9pt">
<%
db = new DBManager();
String allType = "select * from t_rate";
ResultSet rsAllType = db.getResult(allType);
while( rsAllType.next() )
{
%>
<option value="<%=rsAllType.getString("rateID") %>"><%=rsAllType.getString("rateName") %></option>
<%
}
db.close();
%>
</select>
</td>
<td style="width: 3%" valign="middle">
<input id ="sOne" type="button" value=">" style="height: 20px;width: 99%" onclick="addRate(this.id);" title="添加被选中的项"/>
<input id ="sAll" type="button" value=">>" style="height: 20px;width: 99%" onclick="addRate(this.id);" title="添加全部"/>
<input id ="dOne" type="button" value="<" style="height: 20px;width: 99%" onclick="moveRate();" title="移除被选中的项"/>
<input id ="dAll" type="button" value="<<" style="height: 20px;width: 99%" onclick="form1.dropSelectedRate.options.length=0" title="移除全部"/>
</td>
<td style="width: 10%" valign="top">
<select name="dropSelectedRate" multiple="multiple" size="20" style="width: 100%;font-size: 9pt">
<%
List arrayList = (ArrayList)session.getAttribute("rates");
if( arrayList != null )
{
for( int i=0; i<arrayList.size(); i++)
{
ChargeItem chargeItem = (ChargeItem)arrayList.get(i);
%>
<option value=<%=chargeItem.getRateID() %> ><%=chargeItem.getRateName() %></option>
<%
}
}
session.setAttribute("rates",null);
%>
</select>
</td>
</tr>
<tr >
<td style="width: 10%"></td>
<td style="width: 3%"></td>
<td style="width:10%">
<img src="../../../images/baocun1.gif" height="22px" style="cursor:hand;"
onmousemove="this.src='../../../images/baocun2.gif'"
onmouseout="this.src='../../../images/baocun1.gif'"
onmousedown="this.src='../../../images/baocun3.gif'"
onmouseup="this.src='../../../images/baocun2.gif'"
onclick="return saveNewType();">
<img src="../../../images/fanhui1.gif"height="22px" style="cursor:hand;"
onmousemove="this.src='../../../images/fanhui2.gif'"
onmouseout="this.src='../../../images/fanhui1.gif'"
onmousedown="this.src='../../../images/fanhui3.gif'"
onmouseup="this.src='../../../images/fanhui2.gif'"
onclick="window.location='chargeType.jsp'">
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -