alone.js 1.44 KB
/**
 * 单线路调度
 */

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'
				});
			});
			
			//$('.tab-pane.aloneline')
			/*_data.queryStationRoute('10904' , 'lineSvg10904' , drawSvg.init);
			*/
			
		}
	}
	
	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;
})();