//每页数据的显示个数 var pagesize = 10; var tttHTML =''; window.onload = function(){ var cur = ""; var currpage = getPar("currpage"); var keywords = ''; //var lineStyle = ''; if (!currpage) { cur = 1; keywords = $('#keywords').val(); // lineStyle = $("#select_bar_style").val() } else{ cur = currpage; keywords = getPar('keywords'); $('#keywords').val(keywords); // lineStyle = getPar('lineStyle'); //$('#select_bar_style').val(lineStyle); } tttHTML = $('#list').html(); searchInfo(cur,keywords); } //查询 function searchInfo(cur,keywords){ if(!cur){ cur = 1; } if(!keywords){ keywords = $('#keywords').val(); // lineStyle = $('#select_bar_style').val(); } $.ajax({ url:'./st-xm/Model/linemanager/new_stationManagerList.php', type: "post", data:{ //lineStyle:lineStyle, keywords:keywords, currpage:cur, pagesize:pagesize }, async:false, dataType: "json", success: function (data) { console.log(data); if(data.code == 1){ console.log(data.info); var sum = data.totalNum; if(sum == 0){ alert('没有相关站点'); } var tag = "test"; var sendurl = './new_search_station.html?keywords='+keywords; getPager(sendurl, sum, cur, pagesize,tag,'currpage'); reloadInfo(data); } }, fail: function (data) { alert('加载相关数据失败'); } }); if(cur!=1){ var keywords = getPar('keywords'); $('#keywords').val(keywords); // var lineStyle = getPar('lineStyle'); // $('#lineStyle').val(lineStyle); } } //添加线路 function addLine(){ // window.location.href='./add_line.html'; // window.open('./add_station.html'); $.cookie("path_url",cookie_path+"add_station.html",{domain:domain_path}); window.open(system_path); } //加载数据 function reloadInfo(data){ console.log( data.list); var list = data.list; var newHTML=''; for(var i=0;i修改'+'管理票种'; // }else{ // var str = '修改'+'管理票种'; // } // tempHTML=tempHTML.replace('[操作]',str); newHTML+=tempHTML; } $('#list').html(newHTML); $('#count').html('共'+data.totalNum+'条记录'); } //启用 function startUse(){ var ary = new Array(); $('.ace_check').each(function(index, item) { if (this.checked && index != 0) { ary.push($(this).attr('name')); } }); if (ary.length <= 0) { alert('请勾选!!!'); return; } var pro_str = ary.join(','); alert(pro_str); $.ajax({ url:'./st-xm/control.php', //请求地址 type: "post", //请求方式 data:{ type:"linemanager_start", id:pro_str }, async:false, dataType: "json", success: function (date1) { if(date1.code == 0){ $('.ace_check').each(function(index, item) { if (this.checked && index != 0) { var stopid = $(this).attr('name'); //改变账号状态 $('#userid_style'+stopid).html('启用'); } }); } }, fail: function (date) { alert('停用失败'); } }); } //停用 function stopUse(){ var ary = new Array(); $('.ace_check').each(function(index, item) { if (this.checked && index != 0) { ary.push($(this).attr('name')); } }); if (ary.length <= 0) { alert('请勾选!!!'); return; } var pro_str = ary.join(','); alert(pro_str); $.ajax({ url:'./st-xm/control.php', //请求地址 type: "post", //请求方式 data:{ type:"linemanager_stop", id:pro_str }, async:false, dataType: "json", success: function (date1) { if(date1.code == 0){ $('.ace_check').each(function(index, item) { if (this.checked && index != 0) { var stopid = $(this).attr('name'); //改变账号状态 $('#userid_style'+stopid).html('停用'); } }); } }, fail: function (date) { alert('停用失败'); } }); } //复选框判断 function select_checked(index) { //index=0最上面的全选 index=1表示的是下面所有的 var cur_check = $('.ace_check')[0]; var checkList = $('.ace_check'); var checkCount = checkList.length - 1; var true_count = 0; for (var i = 1; i < checkList.length; i++) { if (index == '0') { checkList[i].checked = cur_check.checked; } else { if (checkList[i].checked == false) { cur_check.checked = false } else { true_count = true_count + 1; } } } //判断下面是否选中完 if (checkCount == true_count) { cur_check.checked = true; } } //得到url上的参数 function getPar(par){ var local_url = document.location.href; local_url = decodeURI(local_url); var get = local_url.indexOf(par +"="); if(get == -1){ return false; } var get_par = local_url.slice(par.length + get + 1); var nextPar = get_par.indexOf("&"); if(nextPar != -1){ get_par = get_par.slice(0, nextPar); } return get_par; }