Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

480 строки
15 KiB

  1. //取权限缓存
  2. var user_type = getStorage("user_type");
  3. //一个页面的线路条数
  4. var pagesize = 10;
  5. //当前页数
  6. var currpage = 1;
  7. //根据线路编号和名称检索
  8. var line_code = $("#line_text").val();
  9. //运营公司
  10. var supply_id = "-1";
  11. //产品线
  12. var product_line = "-1";
  13. //线路状态
  14. var line_status = "-1";
  15. //线路类型
  16. var line_type = "255";
  17. //总页数
  18. var totalpage = "";
  19. var sing_listHTML = '';
  20. var com_listHTML = '';
  21. $(document).ready(function () {
  22. if (user_type == "0") {
  23. $("#line1").show();
  24. $("#line2").show();
  25. $("#line3").show();
  26. line_type = "255";
  27. } else if (user_type == "1") {
  28. $("#line1").show();
  29. $("#line2").hide();
  30. $("#line3").hide();
  31. line_type = "255";
  32. } else if (user_type == "2") {
  33. $("#line1").hide();
  34. $("#line2").show();
  35. $("#line3").hide();
  36. $("#line2").removeClass("com_line btn-primary");
  37. $("#line2").addClass("sole_line");
  38. line_type = "256";
  39. } else if (user_type == "3") {
  40. $("#line1").hide();
  41. $("#line2").hide();
  42. $("#line3").show();
  43. $("#line3").removeClass("com_line btn-primary");
  44. $("#line3").addClass("sole_line");
  45. $("#sample-table-1").hide();
  46. $("#sample-table-2").show();
  47. line_type = "316";
  48. } else if (user_type == "4") {
  49. $("#line1").show();
  50. $("#line2").show();
  51. $("#line3").hide();
  52. line_type = "255";
  53. } else if (user_type == "5") {
  54. $("#line1").show();
  55. $("#line2").hide();
  56. $("#line3").show();
  57. line_type = "255";
  58. } else if (user_type == "6") {
  59. $("#line1").hide();
  60. $("#line2").show();
  61. $("#line3").show();
  62. line_type = "256";
  63. $("#line2").removeClass("com_line btn-primary");
  64. $("#line2").addClass("sole_line");
  65. }
  66. $("#line3").hide();
  67. sing_listHTML = $('#sing_list').html();
  68. com_listHTML = $('#com_list').html();
  69. line_list_baseinfo();
  70. selectOnePage(1);
  71. });
  72. //头部切换
  73. function cut_car_type(index) {
  74. $(".top").children().addClass("com_line btn-primary");
  75. $(index).addClass("sole_line");
  76. $(index).removeClass("com_line btn-primary");
  77. $("#line_text").val("");
  78. $("#yunying_company").val("-1");
  79. $("#state").val("-1");
  80. $("#product_type").val("-1");
  81. line_type = $(index).attr("line_type");
  82. if (line_type == "316") {
  83. $("#product_line").show();
  84. $("#sample-table-2").show();
  85. $("#sample-table-1").hide();
  86. } else {
  87. $("#product_line").hide();
  88. $("#sample-table-1").show();
  89. $("#sample-table-2").hide();
  90. }
  91. supply_id = $("#yunying_company").val();
  92. line_code = $("#line_text").val();
  93. line_status = $("#state").val();
  94. selectOnePage(1);
  95. }
  96. //加载配置信息
  97. function line_list_baseinfo() {
  98. $.ajax({
  99. url: base_api + 'lineManager/index.php',//请求地址
  100. data: {tp: "singleLine_getLineListBase"},
  101. type: "post", //请求方式
  102. dataType: "json",
  103. success: function (data) {
  104. console.log(data);
  105. if (data.code == 0) {
  106. get_baseinfo(data.supply_list, data.product_list);
  107. } else {
  108. ZZAlertInfo(data.info);
  109. }
  110. }
  111. });
  112. }
  113. //替换线路加载配置信息
  114. function get_baseinfo(data1, data2) {
  115. var temp1 = '<option value="-1">请选择</option>';
  116. var temp2 = '<option value="-1">请选择</option>';
  117. for (var i = 0, j = data1.length; i < j; i++) {
  118. temp1 += '<option value="' + data1[i].supplier_id + '">' + data1[i].supplier_name + '</option>';
  119. }
  120. for (var i = 0, j = data2.length; i < j; i++) {
  121. temp2 += '<option value="' + data2[i].id + '">' + data2[i].type_name + '</option>';
  122. }
  123. $("#yunying_company").html(temp1);
  124. $("#product_type").html(temp2);
  125. }
  126. //加载线路列表
  127. function selectOnePage(page) {
  128. if (line_type != "316"){
  129. $('.yunying_company').hide();
  130. $('#yunying_company').hide();
  131. }else{
  132. $('.yunying_company').show();
  133. $('#yunying_company').show();
  134. }
  135. supply_id = $("#yunying_company").val();
  136. line_code = $("#line_text").val();
  137. line_status = $("#state").val();
  138. product_line = $("#product_type").val();
  139. if (line_type == "316") {
  140. $.ajax({
  141. url: base_api + 'lineManager/index.php', //请求地址
  142. data: {
  143. tp: "groupLine_getLineList",
  144. page_size: pagesize,
  145. current_page: page,
  146. line_code: line_code,
  147. supply_id: supply_id,
  148. line_status: line_status,
  149. product_type: product_line,
  150. line_type: line_type
  151. },
  152. type: "post", //请求方式
  153. dataType: "json",
  154. async: false,
  155. success: function (data) {
  156. if (data.code == 0) {
  157. console.log(data);
  158. totalpage = data.page.total_page;
  159. comReloadData(data.line_list);
  160. if (totalpage == 0) {
  161. $('.pageDiv').hide();
  162. } else {
  163. createPage(currpage, totalpage);
  164. $('.pageDiv').show();
  165. }
  166. } else {
  167. ZZAlertInfo(data.info);
  168. }
  169. }
  170. });
  171. } else {
  172. $.ajax({
  173. url: base_api + 'lineManager/index.php', //请求地址
  174. data: {
  175. tp: "singleLine_getLineList",
  176. page_size: pagesize,
  177. current_page: page,
  178. line_code: line_code,
  179. supply_id: supply_id,
  180. line_status: line_status,
  181. line_type: line_type
  182. },
  183. type: "post", //请求方式
  184. dataType: "json",
  185. async: false,
  186. success: function (data) {
  187. if (data.code == 0) {
  188. console.log(data);
  189. totalpage = data.page.total_page;
  190. singReloadData(data.line_list);
  191. if (totalpage == 0) {
  192. $('.pageDiv').hide();
  193. } else {
  194. createPage(currpage, totalpage);
  195. $('.pageDiv').show();
  196. }
  197. } else {
  198. ZZAlertInfo(data.info);
  199. }
  200. }
  201. });
  202. }
  203. }
  204. //替换加载列表
  205. function get_linelist(data) {
  206. var temp = '';
  207. for (var i = 0, j = data.length; i < j; i++) {
  208. temp += '<option value="' + data[i].supplier_id + '">' + data[i].supplier_name + '</option>';
  209. }
  210. $("#yunying_company").html(temp);
  211. }
  212. //加载单一线路列表数据
  213. function singReloadData(data) {
  214. var list = data;
  215. var newHTML = '';
  216. for (var i = 0; i < list.length; i++) {
  217. var tempHTML = sing_listHTML;
  218. tempHTML = tempHTML.replace('[sing线路编号]', list[i].line_code);
  219. tempHTML = tempHTML.replace('[sing线路名称]', list[i].line_name);
  220. // tempHTML=tempHTML.replace('[类目]',list[i].line_sub_type);
  221. tempHTML = tempHTML.replace('[sing票种数量]', list[i].cnt);
  222. tempHTML = tempHTML.replace('[sing运营公司]', list[i].org_name);
  223. tempHTML = tempHTML.replace('[sing状态]', list[i].disabled_status);
  224. tempHTML = tempHTML.replace('[sing_userid_style]', 'userid_style' + list[i].line_id);
  225. tempHTML = tempHTML.replace('[singOneCheckName]', list[i].line_id);
  226. var str = '<a style="margin-right: 10px;" target="view_window" onclick="open_new_path(this)" go_path="web/lineManager/singline_sell_ticket_type.html?line_type=' + line_type + '&line_id=' + list[i].line_id + '">票种管理</a><a target="view_window" onclick="open_new_path(this)" go_path="web/lineManager/singline_baseinfo.html?line_id=' + list[i].line_id + '">修改</a>';
  227. tempHTML = tempHTML.replace('[sing操作]', str);
  228. newHTML += tempHTML;
  229. }
  230. $('#sing_list').html(newHTML);
  231. $('#sing_list').show();
  232. }
  233. //加载组合线路列表数据
  234. function comReloadData(data) {
  235. var list = data;
  236. var newHTML = '';
  237. for (var i = 0; i < list.length; i++) {
  238. var tempHTML = com_listHTML;
  239. tempHTML = tempHTML.replace('[com线路编号]', list[i].line_code);
  240. tempHTML = tempHTML.replace('[com线路名称]', list[i].line_name);
  241. tempHTML = tempHTML.replace('[com产品线]', list[i].product_type_name);
  242. tempHTML = tempHTML.replace('[com票种数量]', list[i].cnt);
  243. tempHTML = tempHTML.replace('[com运营公司]', list[i].org_name);
  244. tempHTML = tempHTML.replace('[com状态]', list[i].disabled_status);
  245. tempHTML = tempHTML.replace('[com_userid_style]', 'userid_style' + list[i].line_id);
  246. tempHTML = tempHTML.replace('[comOneCheckName]', list[i].line_id);
  247. var str = '<a target="view_window" style="margin-right: 10px;" onclick="open_new_path(this)" go_path="web/lineManager/comsell_ticket_type.html?line_id=' + list[i].line_id + '">票种管理</a><a target="view_window" onclick="open_new_path(this)" go_path="web/lineManager/amend_com_line.html?line_id=' + list[i].line_id + '">修改</a>';
  248. tempHTML = tempHTML.replace('[com操作]', str);
  249. newHTML += tempHTML;
  250. }
  251. $('#com_list').html(newHTML);
  252. }
  253. //创建分页控件
  254. function createPage(currpage, totalpage) {
  255. $(".pageDiv").createPage({
  256. pageCount: totalpage,//总页数
  257. current: currpage,//当前页
  258. turndown: 'true',//是否显示跳转框,显示为true,不现实为false,一定记得加上引号...
  259. backFn: function (p) {
  260. if (line_type == "316") {
  261. $.ajax({
  262. url: base_api + 'lineManager/index.php', //请求地址
  263. data: {
  264. tp: "groupLine_getLineList",
  265. page_size: pagesize,
  266. current_page: p,
  267. line_code: line_code,
  268. supply_id: supply_id,
  269. line_status: line_status,
  270. product_type: product_line,
  271. line_type: line_type
  272. },
  273. type: "post", //请求方式
  274. dataType: "json",
  275. async: false,
  276. success: function (data) {
  277. if (data.code == 0) {
  278. console.log(data);
  279. totalpage = data.page.total_page;
  280. comReloadData(data.line_list);
  281. } else {
  282. ZZAlertInfo(data.info);
  283. }
  284. }
  285. });
  286. } else {
  287. $.ajax({
  288. url: base_api + 'lineManager/index.php', //请求地址
  289. data: {
  290. tp: "singleLine_getLineList",
  291. page_size: pagesize,
  292. current_page: p,
  293. line_code: line_code,
  294. supply_id: supply_id,
  295. line_status: line_status,
  296. line_type: line_type
  297. },
  298. type: "post",
  299. dataType: "json",
  300. async: false,
  301. success: function (data) {
  302. if (data.code == "0") {
  303. console.log(data);
  304. totalpage = data.page.total_page;
  305. singReloadData(data.line_list);
  306. } else {
  307. ZZAlertInfo(data.info);
  308. }
  309. }
  310. });
  311. }
  312. }
  313. });
  314. }
  315. //查询
  316. function searchInfo() {
  317. selectOnePage(1);
  318. }
  319. //复选框判断
  320. function select_checked(index) {
  321. //index=0最上面的全选 index=1表示的是下面所有的
  322. var cur_check = $('.ace_check')[0];
  323. var checkList = $('.ace_check');
  324. var checkCount = checkList.length - 1;
  325. var true_count = 0;
  326. for (var i = 1; i < checkList.length; i++) {
  327. if (index == '0') {
  328. checkList[i].checked = cur_check.checked;
  329. } else {
  330. if (checkList[i].checked == false) {
  331. cur_check.checked = false
  332. } else {
  333. true_count = true_count + 1;
  334. }
  335. }
  336. }
  337. //判断下面是否选中完
  338. if (checkCount == true_count) {
  339. cur_check.checked = true;
  340. }
  341. }
  342. //得到url上的参数
  343. function getPar(par) {
  344. var local_url = document.location.href;
  345. local_url = decodeURI(local_url);
  346. var get = local_url.indexOf(par + "=");
  347. if (get == -1) {
  348. return false;
  349. }
  350. var get_par = local_url.slice(par.length + get + 1);
  351. var nextPar = get_par.indexOf("&");
  352. if (nextPar != -1) {
  353. get_par = get_par.slice(0, nextPar);
  354. }
  355. return get_par;
  356. }
  357. //停用选中项
  358. function stopSelect() {
  359. var ary = new Array();
  360. $('.ace_check').each(function (index, item) {
  361. if (this.checked && index != 0) {
  362. ary.push($(this).attr('name'));
  363. }
  364. });
  365. if (ary.length <= 0) {
  366. ZZAlertInfo('请勾选!!!');
  367. return;
  368. }
  369. var pro_str = ary.join(',');
  370. var data = {
  371. tp: "singleLine_lineStop",
  372. line_id: pro_str
  373. }
  374. $.ajax({
  375. url: base_api + 'lineManager/index.php', //请求地址
  376. type: "post", //请求方式
  377. data: data,
  378. async: false,
  379. dataType: "json",
  380. success: function (data) {
  381. console.log(data);
  382. if (data.code == 0) {
  383. $('.ace_check').each(function (index, item) {
  384. if (this.checked && index != 0) {
  385. var stopid = $(this).attr('name');
  386. $('#userid_style' + stopid).text('停用');
  387. }
  388. });
  389. ZZAlertInfo('停用成功!');
  390. }
  391. }
  392. });
  393. }
  394. //启用选中项
  395. function startSelect() {
  396. var ary = new Array();
  397. $('.ace_check').each(function (index, item) {
  398. if (this.checked && index != 0) {
  399. ary.push($(this).attr('name'));
  400. }
  401. });
  402. if (ary.length <= 0) {
  403. ZZAlertInfo('请勾选!!!');
  404. return;
  405. }
  406. var pro_str = ary.join(',');
  407. var data = {
  408. tp: "singleLine_lineStart",
  409. line_id: pro_str
  410. }
  411. $.ajax({
  412. url: base_api + 'lineManager/index.php', //请求地址
  413. type: "post", //请求方式
  414. data: data,
  415. dataType: "json",
  416. success: function (data) {
  417. console.log(data);
  418. if (data.code == 0) {
  419. $('.ace_check').each(function (index, item) {
  420. if (this.checked && index != 0) {
  421. var stopid = $(this).attr('name');
  422. $('#userid_style' + stopid).text('启用');
  423. }
  424. });
  425. ZZAlertInfo('启用成功!');
  426. }
  427. }
  428. });
  429. }
  430. function addline() {
  431. if (line_type == "316") {
  432. window.location.href = "combination_line.html";
  433. } else {
  434. window.location.href = "singline_baseinfo.html";
  435. }
  436. }