按钮
<c:if test="${rolename == 'pcgb1'}">
<button type="button" class="btn btn-info"
"BatchAnnouncement()" authorityUrl="exportStuYjOrXyk">批次公布</button>
</c:if>
<c:if test="${rolename == 'pcgb2'}">
<button type="button" class="btn btn-info"
"BatchGongbu()" authorityUrl="exportStuYjOrXyk">批次审核</button>
</c:if>
模态框
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" style="width:1000px;height:800px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">批次公布信息</h4>
</div>
<div id="tableOne" class="modal-body">
<table id="example1"
class="table table-bordered table-striped dataTable no-footer"
role="grid" aria-describedby="example1_info">
<thead>
<th style="width: 2%;"><input type="checkbox" class="checkbox" "quanxuan(this)"/> </th>
<th style="width: 10%;">批次</th>
<th style="width: 10%;">报考人数</th>
<th style="width: 10%;">录取人数</th>
<th style="width: 10%;">流水号</th>
<th style="width: 10%;">最高分</th>
<th style="width: 10%;">最低分</th>
<th style="width: 10%;">平均分</th>
<th style="width: 10%;">录取进程</th>
<th style="width: 10%;">结束时间</th>
<th style="width: 10%;">备注</th>
</thead>
<tbody id="table">
<tr>
<td class="td">${data.batchName}</td>
<td class="td">1</td>
<td class="td">1</td>
<td class="td">1</td>
<td class="td">1</td>
<td class="td">1</td>
<td class="td">1</td>
<td class="td">
<select id="lqjc" "" style="width:100px">
<option value="">请选择</option>
<option value="1" >录取未开始</option>
<option value="2" >录取中</option>
<option value="3" >录取结束</option>
</select></td>
<td class="td"><input id="jieshuTime" type="date" value=""/></td>
<td class="td"><input id="beizhu" type="type" value=""/></td>
</tr>
</tbody>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭
</button>
<!-- <button type="button" class="btn btn-primary" "tijiao()">提交更改</button> -->
<c:if test="${rolename == 'pcgb1'}">
<a class="btn btn-primary" "tijiao()">提交更改</a>
</c:if>
<c:if test="${rolename == 'pcgb2'}">
<a class="btn btn-primary" "Querenfabu()">确认发布</a>
<a class="btn btn-primary" "tuihuichushen()">退回初审</a>
</c:if>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div>
使用jquery的模板
<script id="tableTmpl" type="text/x-jquery-tmpl">
{{each(rowIndex,value) rows}}
<tr>
<td class=""><input type="checkbox" class="qx" value="{{= id1}}"/></td>
<td class="td">{{= batchName}}</td>
<td class="td">{{= bkrs}}</td>
<td class="td">{{= lqrs}}</td>
<td class="td">{{= other1}}</td>
<td class="td">{{= zgf}}</td>
<td class="td">{{= zdf}}</td>
<td class="td">{{= pjf}}</td>
<td class="td">
<select id="lqjc" "" style="width:100px">
<option value="">请选择</option>
<option value="录取未开始" >录取未开始</option>
<option value="录取中" >录取中</option>
<option value="录取结束" >录取结束</option>
</select></td>
<td class="td"><input id="jieshuTime" type="date"/></td>
<td class="td"><input id="beizhu" type="type" value=""/></td>
<td style="display:none">{{= provinceName}}</td>
</tr>
{{/each}}
</script>
<script id="tableTmplshen" type="text/x-jquery-tmpl">
{{each(rowIndex,value) rows}}
<tr>
<td class=""><input type="checkbox" class="qx" value="{{= ID}}" id="shenheId"/></td>
<td class="td">{{= ITEM}}</td>
<td class="td">{{= BKRS}}</td>
<td class="td">{{= LQRS}}</td>
<td class="td">{{= OTHER1}}</td>
<td class="td">{{= ZGF}}</td>
<td class="td">{{= ZDF}}</td>
<td class="td">{{= PJF}}</td>
<td class="td">
<select id="lqjc" "" style="width:100px">
<option value="" {{if LQZT == "请选择"}}selected{{/if}}>请选择</option>
<option value="录取未开始" {{if LQZT == "录取未开始"}}selected{{/if}}>录取未开始</option>
<option value="录取中" {{if LQZT == "录取中"}}selected{{/if}}>录取中</option>
<option value="录取结束" {{if LQZT == "录取结束"}}selected{{/if}}>录取结束</option>
</select></td>
<td class="td"><input id="jieshuTime" type="date" value="{{= LQDATE}}"/></td>
<td class="td"><input id="beizhu" type="type" value="{{= REMARK}}"/></td>
<td style="display:none">{{= provinceName}}</td>
</tr>
{{/each}}
</script>
ajax方法
// 批次公布
function BatchAnnouncement() {
var ids = getCheckBoxIds();
var year = $("#yearid").val();
// alert(ids);
if (ids == "") {
alert("对不起,请选择批次!");
return;
}else{
$.ajax({
type : "post",
url : basePath + "/student/stupichixingxi/BatchAnnouncement.do",
data:{"ids":ids,"year":year},
success : function(data) {
$("#table").html("");
var data1 = {"rows":data};
$("#tableTmpl").tmpl(data1).appendTo("#table");
$('#myModal').modal('show');
}
});
}
}
// 审核
function BatchGongbu() {
var year = $("#yearid").val();
// alert(ids);
$.ajax({
type : "post",
url : basePath + "/student/stupichixingxi/BatchGongbu.do",
data:{"year":year},
success : function(data) {
$("#table").html("");
var data1 = {"rows":data};
$("#tableTmplshen").tmpl(data1).appendTo("#table");
$('#myModal').modal('show');
}
});
}
// 批次第一次提交
function tijiao(){
var year = $("#yearid").val();
$("#table").find("tr").each(function(){
if($(this).children().eq(0).find("input").is(":checked"))
{
var tdArr=$(this).children();
var batch = tdArr.eq(0).find('input').val();
var batchName = tdArr.eq(1).text();
var bkrs = tdArr.eq(2).text();
var lqrs = tdArr.eq(3).text();
var other1 = tdArr.eq(4).text();
var zgf = tdArr.eq(5).text();
var zdf = tdArr.eq(6).text();
var pjf = tdArr.eq(7).text();
var lqjc = tdArr.eq(8).find('select').val();
var jieshuTime = tdArr.eq(9).find('input').val();
var beizhu = tdArr.eq(10).find('input').val();
var provinceName = tdArr.eq(11).text();
$.ajax({
type:"post",
dataType : "text",
url:basePath+"/student/stupichixingxi/Tijiao.do",
data:{"batch":batch,"year":year,"batchName":batchName,"bkrs":bkrs,
"lqrs":lqrs,"other1":other1,"zgf":zgf,"zdf":zdf,"pjf":pjf,
"lqjc":lqjc,"jieshuTime":jieshuTime,"beizhu":beizhu,"provinceName":provinceName},
success:function(data){
}
});}
});
$('#myModal').modal('hide');
}
// 退回初审,这里直接删除表数据
function tuihuichushen(){
if(confirm("是否确定退回")){
$("#table").find("tr").each(function(){
/* var ischecked=$(this).children().eq(0).find("input").is(":checked")?$(this).children():$(this).children(); */
if($(this).children().eq(0).find("input").is(":checked"))
{
var ischecked=$(this).children();
var batch = ischecked.eq(0).find('input').val();
var batchName = ischecked.eq(1).text();
var bkrs = ischecked.eq(2).text();
var lqrs = ischecked.eq(3).text();
var other1 = ischecked.eq(4).text();
var zgf = ischecked.eq(5).text();
var zdf = ischecked.eq(6).text();
var pjf = ischecked.eq(7).text();
var lqjc = ischecked.eq(8).find('select').val();
var jieshuTime = ischecked.eq(9).find('input').val();
var beizhu = ischecked.eq(10).find('input').val();
var provinceName = ischecked.eq(11).text();
$.ajax({
type:"post",
dataType : "text",
url:basePath+"/student/stupichixingxi/Tuihuichushen.do",
data:{"batch":batch},
success:function(data){
}
});
}
});
$('#myModal').modal('hide');
}
}
// 确认提交 ,可以修改部分字段,并且把FBSTATE的状态设为1
function Querenfabu(){
if(confirm("是否确定提交")){
$("#table").find("tr").each(function(){
if($(this).children().eq(0).find("input").is(":checked"))
{
var ischecked=$(this).children();
var batch = ischecked.eq(0).find('input').val();
var batchName = ischecked.eq(1).text();
var bkrs = ischecked.eq(2).text();
var lqrs = ischecked.eq(3).text();
var other1 = ischecked.eq(4).text();
var zgf = ischecked.eq(5).text();
var zdf = ischecked.eq(6).text();
var pjf = ischecked.eq(7).text();
var lqjc = ischecked.eq(8).find('select').val();
var jieshuTime = ischecked.eq(9).find('input').val();
var beizhu = ischecked.eq(10).find('input').val();
$.ajax({
type:"post",
dataType : "text",
url:basePath+"/student/stupichixingxi/Querenfabu.do",
data:{"batch":batch,lqjc:lqjc,jieshuTime:jieshuTime,beizhu:beizhu},
success:function(data){
}
});
}
});
// toMainUrl("/student/stupichixingxi/BatchGongbu.do");
$('#myModal').modal('hide');
}
}