section-ajax-getdata.js 1.22 KB
/**
 * @description : (TODO) GetAjaxData :封装ajax异步请求方法
 * 
 * @author bsth@lq
 * 
 * @version 1.0
 */

var GetAjaxData = function(){
	var ajaxData = {
			// 根据ID查询路段信息.
			getSectionRouteInfoById : function(sectionId,callback){
				$get('/sectionroute/findSectionRouteInfoFormId',{'id':sectionId},function(r) {
					return callback && callback(r);
				});
			},
			
			getStation : function(id_,dir_,callback) {
				var treeDateJson = [];
				$get('/stationroute/findStations',{'line.id_eq' : id_ , 'directions_eq' : dir_},function(resultdata) {
					treeDateJson = createTreeData(resultdata);
					callback && callback(treeDateJson);
				});
			},
			
			findUpSectionRouteCode : function(lineId,diraction,sectionRouteCode,callback) {
				$get('/sectionroute/findUpSectionRouteCode',{lineId:lineId,direction:diraction,sectionRouteCode:sectionRouteCode},function(result) {
					callback && callback(result);
				});
				
			 },
			 
			// 编辑线路走向保存
			sectionUpdate:function(section,callback) {
				
				$post('/section/sectionUpdate',section,function(data) {
					
					callback && callback(data);
					
				})
				
			}
	}
	
	return ajaxData;
	
}();