创建基础数据服务
This commit is contained in:
@@ -0,0 +1,48 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { HttpClientService } from '../services/http-client.service';
|
||||||
|
import { Subject } from 'rxjs'
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class BasicDataService{
|
||||||
|
public checkin_group;
|
||||||
|
public checkin_group_subject = new Subject<any>();
|
||||||
|
public gate;
|
||||||
|
public gate_subject = new Subject<any>();
|
||||||
|
public terminal;
|
||||||
|
public terminal_subject = new Subject<any>();
|
||||||
|
public chut;
|
||||||
|
public chut_subject = new Subject<any>();
|
||||||
|
public stand;
|
||||||
|
public stand_subject = new Subject<any>();
|
||||||
|
public carousel;
|
||||||
|
public carousel_subject = new Subject<any>();
|
||||||
|
public checkin_desk;
|
||||||
|
public checkin_desk_subject = new Subject<any>();
|
||||||
|
public airport;
|
||||||
|
public airport_subject = new Subject<any>();
|
||||||
|
public city;
|
||||||
|
public city_subject = new Subject<any>();
|
||||||
|
public aircraft_type;
|
||||||
|
public aircraft_type_subject = new Subject<any>();
|
||||||
|
public aircraft;
|
||||||
|
public aircraft_subject = new Subject<any>();
|
||||||
|
public terminal_area;
|
||||||
|
public terminal_area_subject = new Subject<any>();
|
||||||
|
public airline;
|
||||||
|
public airline_subject = new Subject<any>();
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private httpClient:HttpClientService
|
||||||
|
){}
|
||||||
|
|
||||||
|
loadBasicData(){
|
||||||
|
console.log('---')
|
||||||
|
this.httpClient.get('/adminapi/basicdata/checkinGroups').subscribe(
|
||||||
|
data=>{
|
||||||
|
console.log(data)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
import { ChangeDetectorRef } from '@angular/core';
|
import { ChangeDetectorRef } from '@angular/core';
|
||||||
|
|
||||||
import { HttpClientService } from '../../services/http-client.service';
|
import { HttpClientService } from '../../services/http-client.service';
|
||||||
|
import {BasicDataService} from '../basic-data-service'
|
||||||
|
|
||||||
import dateFormatter from '../../utils/data-formatter';
|
import dateFormatter from '../../utils/data-formatter';
|
||||||
import routeType from '../../utils/route-type';
|
import routeType from '../../utils/route-type';
|
||||||
@@ -18,9 +19,15 @@ import * as $ from 'jquery';
|
|||||||
export class MainComponent implements OnInit {
|
export class MainComponent implements OnInit {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|
||||||
|
private basicDataService:BasicDataService,
|
||||||
private httpCilent: HttpClientService,
|
private httpCilent: HttpClientService,
|
||||||
private changeDetectorRef: ChangeDetectorRef
|
private changeDetectorRef: ChangeDetectorRef
|
||||||
) { }
|
) {
|
||||||
|
this.basicDataService.checkin_group_subject.subscribe(val=>{
|
||||||
|
console.log(val)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public raw_data: Array<object> = []; //原始数据,即航班计划
|
public raw_data: Array<object> = []; //原始数据,即航班计划
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { NgZorroAntdModule } from 'ng-zorro-antd'
|
|||||||
import { PipesModule } from '../../pipes/pipes.module';
|
import { PipesModule } from '../../pipes/pipes.module';
|
||||||
import { MainComponent } from './main.component';
|
import { MainComponent } from './main.component';
|
||||||
import { MainRoutingModule } from './main-routing.module'
|
import { MainRoutingModule } from './main-routing.module'
|
||||||
|
import {BasicDataService} from '../basic-data-service'
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -16,6 +17,7 @@ import { MainRoutingModule } from './main-routing.module'
|
|||||||
PipesModule,
|
PipesModule,
|
||||||
MainRoutingModule
|
MainRoutingModule
|
||||||
],
|
],
|
||||||
declarations: [MainComponent]
|
declarations: [MainComponent],
|
||||||
|
providers:[BasicDataService]
|
||||||
})
|
})
|
||||||
export class MainModule { }
|
export class MainModule { }
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
|
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
|
||||||
|
import { BasicDataService } from './basic-data-service'
|
||||||
|
|
||||||
import { map, filter, mergeMap } from 'rxjs/operators';
|
import { map, filter, mergeMap } from 'rxjs/operators';
|
||||||
import { pipe } from 'rxjs'
|
import { pipe } from 'rxjs'
|
||||||
@@ -184,8 +185,11 @@ export class PagesComponent implements OnInit {
|
|||||||
}]
|
}]
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
|
private basicDataService:BasicDataService,
|
||||||
private activatedRoute: ActivatedRoute
|
private activatedRoute: ActivatedRoute
|
||||||
) { }
|
) {
|
||||||
|
this.basicDataService.loadBasicData();
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
let activeRoute = this.router.url;
|
let activeRoute = this.router.url;
|
||||||
|
|||||||
@@ -5,12 +5,15 @@ import { PagesRoutingModule } from './pages-routing.module'
|
|||||||
|
|
||||||
import { ComponentsModule } from '../components/components.module'
|
import { ComponentsModule } from '../components/components.module'
|
||||||
|
|
||||||
|
import { BasicDataService } from './basic-data-service'
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
ComponentsModule,
|
ComponentsModule,
|
||||||
PagesRoutingModule,
|
PagesRoutingModule,
|
||||||
],
|
],
|
||||||
declarations: [PagesComponent]
|
declarations: [PagesComponent],
|
||||||
|
providers: [BasicDataService]
|
||||||
})
|
})
|
||||||
export class PagesModule { }
|
export class PagesModule { }
|
||||||
|
|||||||
Reference in New Issue
Block a user