<%@ page language="java" pageEncoding="utf-8"%>
<div id="modal-dataInfo" tabindex="-1" data-backdrop="static" class="modal fade" style="margin-top: -50px;display:none;width:800px;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" id="modal-stackable-label">
<button type="button" data-dismiss="modal" aria-hidden="true" id="closeId" class="close">×</button>
<h4 class="modal-title">节目列表</h4>
</div>
<div class="modal-body">
<table class="ul-form">
<tr><td width="80px;" align="right">节目名称:</td>
<td width="130px;">
<input id="recordname" type="text" />
</td>
<td colspan="2">
<button style="margin-bottom: 5px;" class="btn btn-primary" οnclick="toPage_panelInfoData(1,2);">查询</button>
<button style="margin-bottom: 5px;" class="btn btn-primary" οnclick="saveData();">保存</button>
</td>
</tr>
</table>
<table id="dataInfoTable" class="table table-striped table-bordered" style="">
<thead>
<tr>
<th>
<input type="checkbox" id="changeBox" οnclick="checkAll(this,'panelId');"/>
</th>
<!-- <th style="width: 10%">节目ID</th> -->
<th style="width: 35%">节目名称</th>
<th style="width: 20%">节目状态</th>
<th style="width: 30%">节目类型</th>
</tr>
</thead>
<tbody></tbody>
</table>
<div class="text-center center" style="">
<input type="hidden" value="" id="hidden_flg">
<input type="hidden" value="1" id="current">
当前第<input id="resourcePageNo_dataInfo" type="text" style="width:30px;height:20px;"/>/<span id="resourceTotalPage_dataInfo"></span>页
共<span id="resourceTotalRecord_dataInfo"></span>条数据
<span id="previous_dataInfo"><a href="#" οnclick="previous_dataInfo()" >上一页</a></span>
<span id="next_dataInfo"><a href="#" οnclick="next_dataInfo()">下一页</a></span>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
//全选、全不选
function checkAll(obj, cName) {
var checkboxs = document.getElementsByName(cName);
for ( var i = 0; i < checkboxs.length; i+=1) {
checkboxs[i].checked = obj.checked;
}
}
//上一页
function previous_dataInfo() {
var current = $("#resourcePageNo_dataInfo").val();
var reg = new RegExp("^[0-9]*$");
if(!reg.test(current)){
alert("页码请输入数字!");
return false;
}
current = parseInt(current);
if (current>1){
current=current-1;
}
$("#resourcePageNo_dataInfo").val(current);
//页面封装的查询方法
toPage_panelInfoData(current,2);
}
//下一页
function next_dataInfo(){
var current = $("#resourcePageNo_dataInfo").val();
var reg = new RegExp("^[0-9]*$");
if(!reg.test(current)){
alert("页码请输入数字!");
return false;
}
current = parseInt(current)+1;
var resourceTotalPage = parseInt($("#resourceTotalPage_dataInfo").html());
if(current>resourceTotalPage){
return false;
}
$("#resourcePageNo").val(current);
//页面封装的查询方法
toPage_panelInfoData(current,2);
}
function choiceData() {
var seriesId = document.getElementById("seriesId").value;
if(seriesId ==null || seriesId =="null" || seriesId ==""){
$.jBox.error('请选择系列!', '系统提示', '');
return;
}
$("#modal-dataInfo").modal('show');
$("#dataInfoTable tbody tr").empty("");
document.getElementById("resourcePageNo_dataInfo").value="";
document.getElementById("resourceTotalPage_dataInfo").innerText="";
document.getElementById("resourceTotalRecord_dataInfo").innerText="";
toPage_panelInfoData(1);
}
webapp='${ctx}';
function toPage_panelInfoData(pageNo){
var datainfoname = document.getElementById("recordname").value;
$.ajax({
type : "POST",
url : webapp + "/seriesrecordmap/seriesRecordMap/getRecordInfo",
dataType : "json",
data : {"name":datainfoname,"pageNo":pageNo},
error : function(data) {
//alert('操作失败!');
},
success : function(data) {
$("#dataInfoTable thead tr").empty("");
$("#dataInfoTable tbody tr").empty("");
var dataInfoTablethead = $("#dataInfoTable > thead");
var dataInfoTable = $("#dataInfoTable > tbody");
var html="";
var list = data.result;
// var theadstr='<th style="width: 10%"><input type="checkbox" id="changeBox" οnclick="checkAll(this,\"panelId\");"/></th><th style="width: 35%">名称</th><th style="width: 20%">节目状态</th><th style="width: 35%">节目类型</th>';
var theadstr="<th style=\"width: 10%\"><input type=\"checkbox\" id=\"changeBox\" οnclick=\"checkAll(this,'panelId');\"/></th><th style=\"width: 35%\">名称</th><th style=\"width: 20%\">节目状态</th><th style=\"width: 20%\">节目类型</th><th style=\"width: 15%\">排序号</th>";
dataInfoTablethead.html(theadstr);
for(i=0; i<list.length;i++){
html+="<tr><td><input type=\"checkbox\" name=\"panelId\" value=\""+list[i].id+"\"/></td>";
// html+='<td>'+list[i].id+'</td>';
html+='<td>'+list[i].name+'</td>';
html+='<td>';
var injectionFlg = list[i].injectionFlg;
if(injectionFlg==1){
html+="注入成功";
}else{
html+="注入成功";
}
html+="</td>";
html+='<td>';
var type= list[i].type;
if(type==1){
html+="录播";
}else{
html+="点播";
}
html+="</td>";
html+="<td><input type=\"text\" id=\""+list[i].id+"\" name=\"sort\" value=\"\" οnkeyup=\"this.value=this.value.replace(/\D/g,'')\" style=\"width:50px;margin:0;padding:0;text-align:center;height: 15px;\" /><span style=\"color: red;\">*</span></tr></td>";
html+='</tr>';
//html+='<td><img src="'+list[i].url+'" style="max-width: 100px;max-height: 100px;"></td></tr>';
}
dataInfoTable.html(html);
$("#resourcePageNo_dataInfo").val(data.pageNo);
$("#resourceTotalRecord_dataInfo").html(data.totalRecord);
$("#resourceTotalPage_dataInfo").html(data.totalPage);
if(data.pageNo == 1){
$("#previous_dataInfo").html("上一页");
}else{
$("#previous_dataInfo").html("<a href='#' οnclick='previous_dataInfo()'>上一页</a>");
}
if(data.pageNo == data.totalPage){
$("#next_dataInfo").html("下一页");
}else{
$("#next_dataInfo").html("<a href='#' οnclick='next_dataInfo()'>下一页</a>");
}
}
});
}
function saveData(){
getCheckBox(0);
}
//获取选中
function getCheckBox(isSingle) {
var ids = "";
var idArr = new Array();
$('input[name="panelId"]:checked').each(function(){
var pid = $(this).val();
var sor = $("#"+pid).val()
if(sor==null||sor==""){
sor="-1";
}
idArr.push(pid+"_"+sor);//向数组中添加元素
});
/* $('input[name="panelId"]:checked').each(function(){
var pid = $(this).val();
idArr.push(pid);//向数组中添加元素
}); */
//可以多选
if(isSingle==0){
if(idArr.length==0){
alert("未选择数据!");
return;
} else{
for(var i=0; i<idArr.length; i++){
ids += idArr[i] + ",";
}
}
}else{
if(idArr.length==0){
alert("未选择数据!");
return;
} else if(idArr.length>1){
alert("只能选中一条记录!");
return ;
}
}
var seriesId = document.getElementById("seriesId").value;
var recordId = document.getElementById("recordName").value;
$.ajax({
type : "POST",
url : webapp + "/seriesrecordmap/seriesRecordMap/saveRecordInfo",
dataType : "json",
data : {"seriesId":seriesId,"ids":ids},
error : function(data) {
//alert('操作失败!');
},
success : function(data) {
if(data.message=="success"){
alert("保存成功!");
var returnUrl = webapp + "/seriesrecordmap/seriesRecordMap/list?seriesId="+seriesId+"&recordName="+recordId;
window.location.href = returnUrl;
}else{
alert("保存失败!")
}
}
});
$("#modal-dataInfo").modal('hide');
}
</script>
checkbox 全部选中,全部去除选中js代码
猜你喜欢
转载自blog.csdn.net/world_the_begin/article/details/104535830
今日推荐
周排行