var HTML = '';
//记录添加的 tr id
var n = 0;
//记录途径顺序
var m = 1;
window.onload = function(){
// HTML = $('#tr_replace').html();
$('#tr_replace').hide();
}
//根据用户输入检索
function lineListSearch(listId){
$.ajax({
url:'./st-xm/Model/linemanager/stationListSearch.php', //请求地址
type: "post", //请求方式
// data: data, //请求参数
data:{
stationName:listId
},
async:false,
dataType: "json",
success: function (data) {
console.log(data);
if(data.code == 0){
$('#line_name_search').show();
var line_list = document.getElementById("line_name_search");
var list = data.list;
var htmlStr = "";
for (var i=0;i'+list[i].res_name+'';
}
line_list.innerHTML = htmlStr;
}
},
fail: function (data) {
}
});
}
//选中一个站点
function click_select(id,name){
$('#line_list').val(name);
$('#line_name_search').hide();
$('#station_select').val(id);
}
//添加一条线路
function addOneLine(){
var line_list = $('#line_list').val();
if (line_list == "") {
swal(
'添加线路失败',
'未选择站点信息',
'error'
);
return;
}
var stationId = $('#station_select').val();
var poiAry = '';
var checkPortAry = '';
var poiIdAry = '';
var checkPortIdAry = '';
var ifHasCheckport = '';
//站点id对应每一条站点信息
// var stationId = '';
//请求站点相关的数据
$.ajax({
url:'./st-xm/Model/linemanager/stationInfo.php', //请求地址
type: "post",
data:{stationId:stationId},
async:false,
dataType: "json",
success: function (data) {
console.log(data);
if(data.code == 0){
//(poi)
var poiListStr = data.list.parent_area_name_list;
//得到截取后返回的数组(poi)
poiAry = intercept(poiListStr);
//(poi)id
var poiListIdStr = data.list.parent_area_id_list;
//得到截取后返回的数组(poi)
poiIdAry = intercept(poiListIdStr);
ifHasCheckport = data.list.checkport_res_name;
if (data.list.checkport_res_id != 0) {
//检票口数组
checkPortAry = data.list.checkport_res_name.split(',');
//检票口id数组
checkPortIdAry = data.list.checkport_res_id.split(',');
}
//站点proid
stationId = data.list.res_id;
}
},
fail: function (data) {
}
});
//tbody
var line = document.getElementById('line_list_info');
//tr
var tr = document.createElement("tr");
tr.id = m;
var newHtml = '';
var tempHTML = $('#tr_replace').html();
tempHTML = tempHTML.replace('[途径顺序]',m);
tempHTML = tempHTML.replace('[orderid]','orderid'+m);
tempHTML = tempHTML.replace('[站点]',$('#line_list').val());
tempHTML = tempHTML.replace('[station_type_td]','station_type_td'+m);
tempHTML = tempHTML.replace('[select_poi]','select_poi'+m);
tempHTML = tempHTML.replace('[teller]','teller'+m);
tempHTML = tempHTML.replace('[teller_station]','teller_station'+m);
tempHTML = tempHTML.replace('[stationid]','stationid'+m);
tempHTML = tempHTML.replace('[timeid]','timeid'+m);
tempHTML = tempHTML.replace('[updown]','updown'+m);
tempHTML = tempHTML.replace('[del]',m);
tempHTML = tempHTML.replace('time_out','time_out'+m);
tempHTML = tempHTML.replace('[station_type]','station_type'+m);
tempHTML = tempHTML.replace('[hideid]','hideid'+m);
tempHTML = tempHTML.replace('[hideid_id]',stationId);
line.appendChild(tr);
var str = '删除';
tempHTML = tempHTML.replace('[删除]',str);
tr.innerHTML = tempHTML;
//替换poi
var poiHTML = '';
for (var i = poiAry.length-1; i>=0;i --) {
var tempHTML1 = '';
tempHTML1 = tempHTML1.replace('请选择',poiAry[i]);
tempHTML1 = tempHTML1.replace('0',poiIdAry[i]);
poiHTML += tempHTML1;
}
$('#select_poi'+m).html(poiHTML);
//替换检票口
if (ifHasCheckport=='') {
$('#teller'+m).html('-');
}else{
var checkportHTML = '';
for (var i = 0; i 1){
// for (var i = 0 ; i