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.
 
 
 
 

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