You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

239 lines
6.1 KiB

  1. //每页数据的显示个数
  2. var pagesize = 10;
  3. var tttHTML ='';
  4. window.onload = function(){
  5. var cur = "";
  6. var currpage = getPar("currpage");
  7. var keywords = '';
  8. //var lineStyle = '';
  9. if (!currpage) {
  10. cur = 1;
  11. keywords = $('#keywords').val();
  12. // lineStyle = $("#select_bar_style").val()
  13. } else{
  14. cur = currpage;
  15. keywords = getPar('keywords');
  16. $('#keywords').val(keywords);
  17. // lineStyle = getPar('lineStyle');
  18. //$('#select_bar_style').val(lineStyle);
  19. }
  20. tttHTML = $('#list').html();
  21. searchInfo(cur,keywords);
  22. }
  23. //查询
  24. function searchInfo(cur,keywords){
  25. if(!cur){
  26. cur = 1;
  27. }
  28. if(!keywords){
  29. keywords = $('#keywords').val();
  30. // lineStyle = $('#select_bar_style').val();
  31. }
  32. $.ajax({
  33. url:'./st-xm/Model/linemanager/new_stationManagerList.php',
  34. type: "post",
  35. data:{
  36. //lineStyle:lineStyle,
  37. keywords:keywords,
  38. currpage:cur,
  39. pagesize:pagesize
  40. },
  41. async:false,
  42. dataType: "json",
  43. success: function (data) {
  44. console.log(data);
  45. if(data.code == 1){
  46. console.log(data.info);
  47. var sum = data.totalNum;
  48. if(sum == 0){
  49. alert('没有相关站点');
  50. }
  51. var tag = "test";
  52. var sendurl = './new_search_station.html?keywords='+keywords;
  53. getPager(sendurl, sum, cur, pagesize,tag,'currpage');
  54. reloadInfo(data);
  55. }
  56. },
  57. fail: function (data) {
  58. alert('加载相关数据失败');
  59. }
  60. });
  61. if(cur!=1){
  62. var keywords = getPar('keywords');
  63. $('#keywords').val(keywords);
  64. // var lineStyle = getPar('lineStyle');
  65. // $('#lineStyle').val(lineStyle);
  66. }
  67. }
  68. //添加线路
  69. function addLine(){
  70. // window.location.href='./add_line.html';
  71. // window.open('./add_station.html');
  72. $.cookie("path_url",cookie_path+"add_station.html",{domain:domain_path});
  73. window.open(system_path);
  74. }
  75. //加载数据
  76. function reloadInfo(data){
  77. console.log( data.list);
  78. var list = data.list;
  79. var newHTML='';
  80. for(var i=0;i<list.length;i++){
  81. var tempHTML=tttHTML;
  82. tempHTML=tempHTML.replace('[站点名称]',list[i].RES_NAME);
  83. tempHTML=tempHTML.replace('[父级POI]',list[i].STATION_POI);
  84. // tempHTML=tempHTML.replace('[中文全称]',list[i].station_quancheng);
  85. // tempHTML=tempHTML.replace('[中文简称]',list[i].station_jianchen);
  86. // tempHTML=tempHTML.replace('[站点类型]',list[i].station_type);
  87. // tempHTML=tempHTML.replace('[经度]',list[i].station_jindu);
  88. // tempHTML=tempHTML.replace('[纬度]',list[i].station_weidu);
  89. // tempHTML=tempHTML.replace('[userid_style]','userid_style'+list[i].prod_id);
  90. // tempHTML=tempHTML.replace('[oneCheck]',list[i].prod_id);
  91. // tempHTML=tempHTML.replace('[oneCheckName]',list[i].prod_id);
  92. // if(list[i].bus_type==256){
  93. // var str = '<a target="_Blank" href="./change_line.html?prod_id=' +list[i].prod_id + '&line_name='+list[i].prod_name+'">修改</a>'+'<a target="_Blank" style="margin-left: 20px;" href="./sell_manage_shuttlebus.html?prod_id=' +list[i].prod_id+'&lineNameJC='+list[i].property+'&lineName='+list[i].prod_name+'">管理票种</a>';
  94. // }else{
  95. // var str = '<a target="_Blank" href="./change_line.html?prod_id=' +list[i].prod_id + '&line_name='+list[i].prod_name+'">修改</a>'+'<a target="_Blank" style="margin-left: 20px;" href="./sell_manage.html?prod_id=' +list[i].prod_id+'&lineNameJC='+list[i].property+'&lineName='+list[i].prod_name+'">管理票种</a>';
  96. // }
  97. // tempHTML=tempHTML.replace('[操作]',str);
  98. newHTML+=tempHTML;
  99. }
  100. $('#list').html(newHTML);
  101. $('#count').html('共'+data.totalNum+'条记录');
  102. }
  103. //启用
  104. function startUse(){
  105. var ary = new Array();
  106. $('.ace_check').each(function(index, item) {
  107. if (this.checked && index != 0) {
  108. ary.push($(this).attr('name'));
  109. }
  110. });
  111. if (ary.length <= 0) {
  112. alert('请勾选!!!');
  113. return;
  114. }
  115. var pro_str = ary.join(',');
  116. alert(pro_str);
  117. $.ajax({
  118. url:'./st-xm/control.php', //请求地址
  119. type: "post", //请求方式
  120. data:{
  121. type:"linemanager_start",
  122. id:pro_str
  123. },
  124. async:false,
  125. dataType: "json",
  126. success: function (date1) {
  127. if(date1.code == 0){
  128. $('.ace_check').each(function(index, item) {
  129. if (this.checked && index != 0) {
  130. var stopid = $(this).attr('name');
  131. //改变账号状态
  132. $('#userid_style'+stopid).html('启用');
  133. }
  134. });
  135. }
  136. },
  137. fail: function (date) {
  138. alert('停用失败');
  139. }
  140. });
  141. }
  142. //停用
  143. function stopUse(){
  144. var ary = new Array();
  145. $('.ace_check').each(function(index, item) {
  146. if (this.checked && index != 0) {
  147. ary.push($(this).attr('name'));
  148. }
  149. });
  150. if (ary.length <= 0) {
  151. alert('请勾选!!!');
  152. return;
  153. }
  154. var pro_str = ary.join(',');
  155. alert(pro_str);
  156. $.ajax({
  157. url:'./st-xm/control.php', //请求地址
  158. type: "post", //请求方式
  159. data:{
  160. type:"linemanager_stop",
  161. id:pro_str
  162. },
  163. async:false,
  164. dataType: "json",
  165. success: function (date1) {
  166. if(date1.code == 0){
  167. $('.ace_check').each(function(index, item) {
  168. if (this.checked && index != 0) {
  169. var stopid = $(this).attr('name');
  170. //改变账号状态
  171. $('#userid_style'+stopid).html('停用');
  172. }
  173. });
  174. }
  175. },
  176. fail: function (date) {
  177. alert('停用失败');
  178. }
  179. });
  180. }
  181. //复选框判断
  182. function select_checked(index) {
  183. //index=0最上面的全选 index=1表示的是下面所有的
  184. var cur_check = $('.ace_check')[0];
  185. var checkList = $('.ace_check');
  186. var checkCount = checkList.length - 1;
  187. var true_count = 0;
  188. for (var i = 1; i < checkList.length; i++) {
  189. if (index == '0') {
  190. checkList[i].checked = cur_check.checked;
  191. } else {
  192. if (checkList[i].checked == false) {
  193. cur_check.checked = false
  194. } else {
  195. true_count = true_count + 1;
  196. }
  197. }
  198. }
  199. //判断下面是否选中完
  200. if (checkCount == true_count) {
  201. cur_check.checked = true;
  202. }
  203. }
  204. //得到url上的参数
  205. function getPar(par){
  206. var local_url = document.location.href;
  207. local_url = decodeURI(local_url);
  208. var get = local_url.indexOf(par +"=");
  209. if(get == -1){
  210. return false;
  211. }
  212. var get_par = local_url.slice(par.length + get + 1);
  213. var nextPar = get_par.indexOf("&");
  214. if(nextPar != -1){
  215. get_par = get_par.slice(0, nextPar);
  216. }
  217. return get_par;
  218. }