system.service.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import {Injectable} from "@angular/core";
  2. import {Events} from "ionic-angular";
  3. import {AppConfig} from "../app.config";
  4. import {ServiceCommon} from "./service.common";
  5. import {Http} from "@angular/http";
  6. import {ResultMessage} from "../../viewmodel/result";
  7. import {DictionaryItemView} from "../../viewmodel/common/dictionaryItemView";
  8. @Injectable()
  9. export class SystemService {
  10. constructor (public events: Events, private http: Http) {
  11. }
  12. getDictionaryItemViewList(dictionaryCode:string): Promise<ResultMessage>{
  13. let url: string = AppConfig.getServiceUrl();
  14. url += "CommonServices/GetDictionaryViewList";
  15. return this.http.post(url, JSON.stringify({ dictionaryCode:dictionaryCode}), {headers: ServiceCommon.getHeader()})
  16. .toPromise()
  17. .then(res => {
  18. let dictionaryItemList = res.json();
  19. if(dictionaryItemList)
  20. {
  21. return{
  22. isSuccess: true,
  23. message: "",
  24. data: res.json().map(x => {
  25. return {
  26. dictionaryItemID:x.DictionaryItemID,
  27. dictionaryCode:x.DictionaryCode,
  28. dictionaryName:x.DictionaryName,
  29. orderNo:x.OrderNo,
  30. code:x.Code,
  31. name:x.Name,
  32. value:x.Value,
  33. } as DictionaryItemView
  34. })
  35. }as ResultMessage;
  36. }
  37. })
  38. }
  39. getSchoolAreaListWithoutSocial(): Promise<ResultMessage>{
  40. let url: string = AppConfig.getServiceUrl();
  41. url += "UserServices/GetSchoolAreaWithoutSocial";
  42. return this.http.post(url, JSON.stringify({ bindType:2}), {headers: ServiceCommon.getHeader()})
  43. .toPromise()
  44. .then(res => {
  45. let dictionaryItemList = res.json();
  46. if(dictionaryItemList)
  47. {
  48. return{
  49. isSuccess: true,
  50. message: "",
  51. data: dictionaryItemList
  52. } as ResultMessage;
  53. }
  54. })
  55. }
  56. }