api and model 4,5,6,7

parent cce363b7
...@@ -24,8 +24,8 @@ export class DepartmentListComponent implements OnInit { ...@@ -24,8 +24,8 @@ export class DepartmentListComponent implements OnInit {
this.getBu2List() this.getBu2List()
} }
getBu2List() { getBu2List() {
this.bu2Service.getList().subscribe(response => { this.bu2Service.getBu2().subscribe(response => {
console.log("31313 : ",response) console.log("31313 : ", response)
this.bu2List = response this.bu2List = response
this.searchChange() this.searchChange()
}) })
...@@ -40,9 +40,9 @@ export class DepartmentListComponent implements OnInit { ...@@ -40,9 +40,9 @@ export class DepartmentListComponent implements OnInit {
x.edesc.toLowerCase().includes(this.search)) x.edesc.toLowerCase().includes(this.search))
} }
selectBu2(bu2: Bu2Model) { selectBu2(bu2: Bu2Model) {
this.bu1Service.getById(bu2.parent).subscribe(response =>{ this.bu1Service.getBu1ById(bu2.parent).subscribe(response => {
this.bu1 = response this.bu1 = response
console.log(this.bu1) console.log(this.bu1)
}) })
this.bu2 = new MyBu2Model(bu2) this.bu2 = new MyBu2Model(bu2)
} }
......
...@@ -18,7 +18,7 @@ export class DepartmentRegisterComponent implements OnInit { ...@@ -18,7 +18,7 @@ export class DepartmentRegisterComponent implements OnInit {
this.getBu1List() this.getBu1List()
} }
getBu1List() { getBu1List() {
this.bu1Service.getList().subscribe(response => { this.bu1Service.getBu1().subscribe(response => {
this.bu1List = response this.bu1List = response
this.searchChange() this.searchChange()
}) })
......
...@@ -43,6 +43,10 @@ import { HttpRequestInterceptor } from 'src/app/shared/services/http-request.int ...@@ -43,6 +43,10 @@ import { HttpRequestInterceptor } from 'src/app/shared/services/http-request.int
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { Bu2Service } from 'src/app/shared/services/bu2.service'; import { Bu2Service } from 'src/app/shared/services/bu2.service';
import { Bu3Service } from 'src/app/shared/services/bu3.service'; import { Bu3Service } from 'src/app/shared/services/bu3.service';
import { Bu4Service } from 'src/app/shared/services/bu4.service';
import { Bu5Service } from 'src/app/shared/services/bu5service';
import { Bu6Service } from 'src/app/shared/services/bu6.service';
import { Bu7Service } from 'src/app/shared/services/bu7.service';
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -90,7 +94,7 @@ import { Bu3Service } from 'src/app/shared/services/bu3.service'; ...@@ -90,7 +94,7 @@ import { Bu3Service } from 'src/app/shared/services/bu3.service';
HttpClientModule, HttpClientModule,
FormsModule FormsModule
], ],
providers: [Bu1Service,Bu2Service,Bu3Service ,{ providers: [Bu1Service,Bu2Service,Bu3Service,Bu4Service,Bu5Service,Bu6Service,Bu7Service,{
provide: HTTP_INTERCEPTORS, provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor, useClass: HttpRequestInterceptor,
multi: true, multi: true,
......
export interface Bu4Model {
bu4id: string;
tdesc: string;
edesc: string;
parent: string;
companyId: string;
}
export class MyBu4Model implements Bu4Model {
bu4id: string;
tdesc: string;
edesc: string;
parent: string;
companyId: string;
constructor(data: Partial<Bu4Model>) {
this.bu4id = data.bu4id || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
this.parent = data.parent || ""
this.companyId = data.companyId || ""
}
}
export interface Bu5Model {
bu5id: string;
tdesc: string;
edesc: string;
parent: string;
companyId: string;
}
export class MyBu5Model implements Bu5Model {
bu5id: string;
tdesc: string;
edesc: string;
parent: string;
companyId: string;
constructor(data: Partial<Bu5Model>) {
this.bu5id = data.bu5id || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
this.parent = data.parent || ""
this.companyId = data.companyId || ""
}
}
export interface Bu6Model {
bu6id: string;
tdesc: string;
edesc: string;
parent: string;
companyId: string;
}
export class MyBu6Model implements Bu6Model {
bu6id: string;
tdesc: string;
edesc: string;
parent: string;
companyId: string;
constructor(data: Partial<Bu6Model>) {
this.bu6id = data.bu6id || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
this.parent = data.parent || ""
this.companyId = data.companyId || ""
}
}
export interface Bu7Model {
bu7id: string;
tdesc: string;
edesc: string;
parent: string;
companyId: string;
}
export class MyBu7Model implements Bu7Model {
bu7id: string;
tdesc: string;
edesc: string;
parent: string;
companyId: string;
constructor(data: Partial<Bu7Model>) {
this.bu7id = data.bu7id || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
this.parent = data.parent || ""
this.companyId = data.companyId || ""
}
}
...@@ -11,10 +11,10 @@ export class Bu1Service { ...@@ -11,10 +11,10 @@ export class Bu1Service {
urlApi = environment.baseUrl + this.api urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) { constructor(private http: HttpClient) {
} }
getList(): Observable<Bu1Model[]> { getBu1(): Observable<Bu1Model[]> {
return this.http.get<Bu1Model[]>(this.urlApi + "/lists") return this.http.get<Bu1Model[]>(this.urlApi + "/lists")
} }
getById(bu1id:string): Observable<Bu1Model> { getBu1ById(bu1id:string): Observable<Bu1Model> {
return this.http.get<Bu1Model>(this.urlApi + "/"+bu1id) return this.http.get<Bu1Model>(this.urlApi + "/"+bu1id)
} }
// post(body: Bu1Model) { // post(body: Bu1Model) {
......
...@@ -4,29 +4,29 @@ import { Observable } from 'rxjs'; ...@@ -4,29 +4,29 @@ import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { Bu2Model } from '../model/bu2.model'; import { Bu2Model } from '../model/bu2.model';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class Bu2Service { export class Bu2Service {
api = "/bu2" api = "/bu2"
urlApi = environment.baseUrl + this.api urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) { constructor(private http: HttpClient) {
} }
getList(): Observable<Bu2Model[]> { getBu2(): Observable<Bu2Model[]> {
return this.http.get<Bu2Model[]>(this.urlApi + "/lists") return this.http.get<Bu2Model[]>(this.urlApi + "/lists")
} }
getById(bu2id:string): Observable<Bu2Model> { getBu2ById(bu2id: string): Observable<Bu2Model> {
return this.http.get<Bu2Model>(this.urlApi + "/"+bu2id) return this.http.get<Bu2Model>(this.urlApi + "/" + bu2id)
} }
// post(body: Bu1Model) { // post(body: Bu1Model) {
// return this.http.post(this.urlApi, body) // return this.http.post(this.urlApi, body)
// } // }
// delete(body: Bu1Model) { // delete(body: Bu1Model) {
// const options = { // const options = {
// headers: new HttpHeaders({ // headers: new HttpHeaders({
// "Content-Type": "application/json", // "Content-Type": "application/json",
// }), // }),
// body: body // body: body
// }; // };
// return this.http.delete(this.urlApi, options) // return this.http.delete(this.urlApi, options)
// } // }
} }
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { Bu4Model } from '../model/bu4.model';
@Injectable({
providedIn: 'root'
})
export class Bu4Service {
api = "/bu4"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getBu4(): Observable<Bu4Model[]> {
return this.http.get<Bu4Model[]>(this.urlApi + "/lists")
}
getBu4ById(bu4id: string): Observable<Bu4Model> {
return this.http.get<Bu4Model>(this.urlApi + "/" + bu4id)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
}
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { Bu5Model } from '../model/bu5.model';
@Injectable({
providedIn: 'root'
})
export class Bu5Service {
api = "/bu5"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getBu5(): Observable<Bu5Model[]> {
return this.http.get<Bu5Model[]>(this.urlApi + "/lists")
}
getBu5ById(bu5id: string): Observable<Bu5Model> {
return this.http.get<Bu5Model>(this.urlApi + "/" + bu5id)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
}
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { Bu6Model } from '../model/bu6.model';
@Injectable({
providedIn: 'root'
})
export class Bu6Service {
api = "/bu6"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getBu6(): Observable<Bu6Model[]> {
return this.http.get<Bu6Model[]>(this.urlApi + "/lists")
}
getBu6ById(bu6id: string): Observable<Bu6Model> {
return this.http.get<Bu6Model>(this.urlApi + "/" + bu6id)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
}
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { Bu7Model } from '../model/bu7.model';
@Injectable({
providedIn: 'root'
})
export class Bu7Service {
api = "/bu7"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getBu7(): Observable<Bu7Model[]> {
return this.http.get<Bu7Model[]>(this.urlApi + "/lists")
}
getBu7ById(bu7id: string): Observable<Bu7Model> {
return this.http.get<Bu7Model>(this.urlApi + "/" + bu7id)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment