map-ajax-getdata.js 2.73 KB
/**
 * MapGetAjaxData :ajax异步请求
 * 
 * - - - - - -》 getSectionCacheList :获取路段列表
 * 
 * - - - - - -》 getzdlyInfo :获取站点列表
 * 
 * - - - - - -》 getLikeStationName :查询是否有已存在站点名称
 * 
 * - - - - - -》 getStationCode:查询站点编码
 * 
 * - - - - - -》 findCacheUpStationRouteCode:查询上一个缓存站点的序号
 * 
 * - - - - - -》 findCacheUpSectionRouteCode:查询上一个缓存路段的序号
 * 
 * - - - - - -》 stationCacheSave:新增缓存站点保存
 * 
 * - - - - - -》 stationCacheUpdate:站点缓存更新
 * 
 * - - - - - -》 sectionUpdate : 编辑线路走向保存
 * 
 * - - - - - -》 getIdLineName:获取线路名称
 */

var MapGetAjaxData = function(){
	 
	var ajaxData = {
			// 获取路段列表
			getSectionCacheList : function(lineId,dir,callback) {
				$get('/sectionroute/findCacheSection',{'lineId' : lineId , 'dir' : dir},function(resultdata) {
					callback && callback(resultdata);
				});
			},
			getzdlyInfo : function(params,callback) {
				$get('/stationroute/cacheList',params,function(array) {
					callback && callback(array);
				});
			},			
			// 查询是否有已存在站点名称
			getLikeStationName : function (stationName,callback) {
				 $get('/station/all', {stationName_eq: stationName}, function(array){
					 callback && callback(array);
				 });
			},			
			// 查询站点编码
			getStationCode : function(callback) {
				$get('/station/getStationCode',null,function(stationCode) {
					if(stationCode>0) {
						callback && callback(stationCode);
					}
				});
			},
			findCacheUpStationRouteCode : function(params,callback) {
				$get('/stationroute/findCacheUpStationRouteCode',params,function(result) {
					callback && callback(result);
				});
			},			
			findCacheUpSectionRouteCode : function(lineId,dir,sectionRouteCode,callback) {
				$get('/sectionroute/findCacheUpSectionRouteCode',{'lineId' : lineId , 'direction' : dir, 'sectionRouteCode':sectionRouteCode},function(result) {
					callback && callback(result);
				});
			},
			// 新增缓存站点保存
			stationCacheSave : function(station,callback) {
				$post('/station/stationCacheSave',station,function(data) {
					debugger
					callback && callback(data);
				});
			},
			// 缓存站点更新
			stationCacheUpdate : function(station,callback) {
				$post('/station/stationCacheUpdate',station,function(data) {
					callback && callback(data);
				});
			},			
			// 获取线路名称
			getIdLineName : function (id,callback) {
				
				$get('/line/' + id ,null, function(result){
					
					callback && callback(result);
					
				});
				
			},
	}	
	return ajaxData;	
}();