/// /// module System{ export function classifyCity(regionalismInfo: Array){ var result = []; angular.forEach(regionalismInfo, (item) =>{ if(result.indexOf(item.cityName) == -1) result.push(item.cityName); }); return result; } export function classifyCountry(regionalismInfo: Array, 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 = []; public systemInfo: Array = []; public regionalismInfo: Array = []; public sqlInfo: Array = []; //public checkInfo: Array = []; public constructor(){ this.updateCodeInfo(); this.updateExcelInfo(); this.updateSqlInfo(); //this.updateCheckInfo(); //console.log(classifyCountry(this.regionalismInfo, '南京市')); } public updateExcelInfo(){ var result = []; $.ajax({ async: false, type: "POST", url: "/java/console/api/fileOperation/findAll", success: (data) =>{ if(data) result = data.data; } }); this.systemInfoList = result; } public updateSqlInfo(){ var result = []; $.ajax({ async: false, type: "POST", url: "/java/console/api/filePackage/findAll", success: (data) =>{ if(data) result = data.data; } }); this.sqlInfo = result; } public updateCodeInfo(){ var result = []; $.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"]; } /*public updateCheckInfo(){ var result = null; $.ajax({ async: false, type : "POST", url : "/java/console/api/checkout/findAll", success : function(data) { if(data){ result = data.data; } } }); this.checkInfo = result; }*/ } _module.factory('SystemModel', ['$rootScope', '$http', ($rootScope, $http) => { return new systemModelServices(); }]); }