<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ChannelMaintain</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-ui-1.9.2.custom.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.form.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/index.css"/>
<!-- <script type="text/javascript">
var path = "${path}";
</script> -->
<script type="text/javascript">
function queryDetailF(url, spid, pname, status){
/* var distributor ='';
$("input[name='distributor']").each(function(){
if($(this).attr("checked")){
distributor += $(this).val()+",";
}
});
distributor = distributor.substring(0, distributor.length-1);
var operator='';
$("input[name='operator']:checked").each(function(){
operator+= "'"+$(this).val()+"',";
});
operator = operator.substring(0, operator.length-1);
var parvalue='';
$("input[name='parvalue']:checked").each(function(){
parvalue+= $(this).val()+",";
});
parvalue = parvalue.substring(0, parvalue.length-1); */
$.post(url,{
provider:spid,
province:pname,
status:status
},function(data){
$('#chanellist').html(data);
},'html');
};
function do_query(){
//alert('do_query');
var url = 'doQuery.htm';
$.post(url,$('#channelMaintainForm').serialize(),
function(data){
$('#chanellist').html(data);
},'html');
};
//开启按扭
function openDetailF(url,spid,pname){
debugger;
$.post(url,{status:0},function(data){
if(data == 1){
alert('开启成功!');
$.post('queryDetail.htm',{
provider:spid,
province:pname
},function(data){
$('#chanellist').html(data);
//do_query();
});
}else{
alert('开启失败!');
}
});
};
//关闭按钮
function closeDetailF(url,spid,pname){
$.get(url,{status:1},function(data){
if(data == 1){
alert('关闭成功!');
$.post('queryDetail.htm',{
provider:spid,
province:pname
},function(data){
$('#chanellist').html(data);
},'html');
}else{
alert('关闭失败!');
}
});
};
</script>
<script type="text/javascript">
$(document).ready(function(){
//查询按钮
$('#query').click(function(){
if($('#provider').val()==''){
alert('供货商不能为空!');
return false;
}
if($('#province').val()==''){
alert('省份不能为空!');
return false;
}
do_query();
});
$('#alldistributors').click(function(){
if ($(this).attr('checked')){
$('input[name="distributor"]').attr('checked',true);
}else{
$('input[name="distributor"]').attr('checked',false);
}
});
$('#alloperators').click(function(){
if ($(this).attr('checked')){
$('input[name="operator"]').attr('checked',true);
}else{
$('input[name="operator"]').attr('checked',false);
}
});
$('#allparvalues').click(function(){
if ($(this).attr('checked')){
$('input[name="parvalue"]').attr('checked',true);
}else{
$('input[name="parvalue"]').attr('checked',false);
}
});
$('#openBtn').click(function(){
$('#channelMaintainForm').ajaxSubmit({
url:'toOpenChannel.htm',
beforeSubmit: function(){
if($('#provider').val()==''){
alert('供货商不能为空!');
return false;
}
if($('#province').val()==''){
alert('省份不能为空!');
return false;
}
$('#openBtn').val('开启中...');
$('#openBtn').attr('disabled', true);
$('#closeBtn').attr('disabled', true);
}, success: function(data){
if (data == 'success') {
alert('开启成功!');
$('#openBtn').val('开启');
$('#openBtn').attr('disabled', false);
$('#closeBtn').attr('disabled', false);
do_query();
}else{
alert('开启失败!');
$('#openBtn').val('开启');
$('#openBtn').attr('disabled', false);
$('#closeBtn').attr('disabled', false);
}
}
});
});
$('#closeBtn').click(function(){
$('#channelMaintainForm').ajaxSubmit({
url:'toCloseChannel.htm',
beforeSubmit: function(){
if($('#provider').val()==''){
alert('供货商不能为空!');
return false;
}
if($('#province').val()==''){
alert('省份不能为空!');
return false;
}
$('#closeBtn').val('关闭中...');
$('#openBtn').attr('disabled', true);
$('#closeBtn').attr('disabled', true);
}, success: function(data){
if (data == 'success') {
alert('关闭成功!');
$('#closeBtn').val('关闭');
$('#openBtn').attr('disabled', false);
$('#closeBtn').attr('disabled', false);
do_query();
}else{
alert('关闭失败!');
$('#openBtn').val('关闭');
$('#openBtn').attr('disabled', false);
$('#closeBtn').attr('disabled', false);
}
}
});
});
});
</script>
</head>
<body>
<div style="background-color:#F9F9F9;">
<p style='font-size:18pt;'>ChannelMain</p>
<form action="doQuery.htm" method="post" id="channelMaintainForm">
<div>
<label><b>供货商:</b>
<select id="provider" name="provider">
<option></option>
<c:forEach items="${providers}" var="sp">
<option value="${sp.spid }">${sp.spName }</option>
</c:forEach>
<option value="0">全部</option>
</select>
</label>
<label><b>省份:</b>
<select id="province" name="province">
<option></option>
<c:forEach items="${provinces}" var="p">
<option value="${p.name }">${p.name }</option>
</c:forEach>
<option value="0">全部</option>
</select>
</label>
</div><br/>
<div>
全部<input type="checkbox" id="alldistributors"/>
<label>
<b>分销商: </b>
<c:forEach items="${distributors}" var="trib">
<input type="checkbox" value="${trib.id}" name="distributor" id="distributor"/>
<c:out value="${trib.cpname}" />
</c:forEach>
</label>
</div><br/>
<div>
全选<input type="checkbox" id="alloperators" name="alloperators"/>
<label><b>运营商:</b>
<c:forEach items="${operators}" var="oper">
<input type="checkbox" name="operator" value="${oper.shortname}" id="operator"/>${oper.name }
</c:forEach>
</label>
</div><br/>
<div>
全选<input type="checkbox" id="allparvalues" name="allparvalues"/>
<label><b>面值:</b>
<c:forEach items="${parvalues}" var="pv">
<input type="checkbox" value="${pv.parvalue }" id="parvalue" name="parvalue"/>
<fmt:formatNumber value="${pv.parvalue/100 }" pattern="#"></fmt:formatNumber>
</c:forEach>元
</label>
</div>
<div>
<input type="button" id="query" value="查询" name="query"/>
<input type="button" id="openBtn" value="开启"/>
<input type="button" id="closeBtn" value="关闭"/>
</div>
</form>
</div>
<div id="chanellist">
</div>
</body>
</html>
jsp范例
最新推荐文章于 2024-03-06 10:42:19 发布