70 lines
1.6 KiB
TypeScript
70 lines
1.6 KiB
TypeScript
/// <reference path="../../includes.ts"/>
|
|
/// <reference path="systemPlugin.ts"/>
|
|
module System{
|
|
|
|
export function classifyCity(regionalismInfo: Array<any>){
|
|
var result = [];
|
|
angular.forEach(regionalismInfo, (item) =>{
|
|
if(result.indexOf(item.cityName) == -1)
|
|
result.push(item.cityName);
|
|
});
|
|
return result;
|
|
}
|
|
|
|
export function classifyCountry(regionalismInfo: Array<any>, cityName: string){
|
|
var result = [];
|
|
angular.forEach(regionalismInfo, (item) =>{
|
|
if(item.cityName == cityName)
|
|
result.push({
|
|
name: item.districtName,
|
|
code: item.code
|
|
});
|
|
});
|
|
return result;
|
|
}
|
|
|
|
class systemModelServices{
|
|
public systemInfoList: Array<any> = [];
|
|
public systemInfo: Array<any> = [];
|
|
public regionalismInfo: Array<any> = [];
|
|
|
|
public constructor(){
|
|
//this.updateSystemInfoList();
|
|
this.updateCodeInfo();
|
|
//console.log(classifyCountry(this.regionalismInfo, '南京市'));
|
|
}
|
|
|
|
//执行数据更新操作
|
|
public updateSystemInfoList(){
|
|
var result = [];
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: '/java/console/api/system/infoList',
|
|
success: (data) =>{
|
|
if(data)
|
|
result = data;
|
|
}
|
|
});
|
|
}
|
|
|
|
public updateCodeInfo(){
|
|
var result=null;
|
|
$.ajax({
|
|
async: false,
|
|
type : "POST",
|
|
url : "/java/console/api/code/list",
|
|
success : function(data) {
|
|
if(data){
|
|
result = data;
|
|
}
|
|
}
|
|
});
|
|
this.regionalismInfo = result.regionalism;
|
|
this.systemInfo = result.system;
|
|
}
|
|
}
|
|
|
|
_module.factory('SystemModel', ['$rootScope', '$http', ($rootScope, $http) => {
|
|
return new systemModelServices();
|
|
}]);
|
|
} |