alone.js
2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/**
* 单线路调度
*/
var _alone = (function(){
//暂时用文字判断上下行
var upCode = '上行'
,downCode = '下行';
var aloneObject = {
init: function(){
_data.queryRealSchedule(lineCodes, function(schList){
for(var lineCode in schList){
//按上下行拆分数据
var rs = splitDir(schList[lineCode])
,htmlStr = template('alone_main_temp', {up: rs.up, down: rs.down});
$('#tab_line_' + lineCode).append(htmlStr).find('._body')
//滚动条
.slimscroll({
height: 'calc(100% - 80px)',
alwaysVisible: true
});
//底部svg
_data.queryStationRoute(lineCode , 'lineSvg' + lineCode , drawSvg.init);
}
//绑定右键菜单事件
_menu.bindClickMenu();
$('.console-log .log-item-list').slimscroll({
height: '100%'
})
//托管Question
$('#tgQuestion').popover({
content: template('tg_question_info_temp', {}),
html: true,
placement: 'left',
trigger: 'hover',
container: '.portlet-fullscreen'
});
//备注POPOVER
$('.remarks-popover').popover({trigger: 'hover',container: '.portlet-fullscreen',placement:'bottom'});
});
//$('.tab-pane.aloneline')
/*_data.queryStationRoute('10904' , 'lineSvg10904' , drawSvg.init);
*/
},
//刷新班次
refreshSchedule: function(schedule){
//xlBm
var tr = $('tr[data-id='+schedule.id+']', '#tab_line_' + schedule.xlBm)[0]
,cells = tr.cells, name;
$.each(cells, function(i, cell){
name = $(cell).data('name');
if(name == 'remarks'){
var link = $(cell).find('a');
if(link.length == 0){
$(cell).append('<a class="remarks-popover" href="javascript:;" data-toggle="popover" data-content="'+schedule[name]+'" >备注</a>')
}
else{
link.attr('data-content', schedule[name]);
}
}
else{
$(cell).text(schedule[name]);
}
});
}
}
function splitDir(list){
var rs = {up: [], down: []};
$.each(list, function(){
if(this.xlDir == upCode)
rs.up.push(this);
else
rs.down.push(this);
});
return rs;
}
return aloneObject;
})();