e2867489949f82b82584175c09e6b43fdec872b0
[usecase-ui.git] /
1 import { Component, OnInit, Input } from '@angular/core';
2 import { NzModalService } from "ng-zorro-antd";
3 import { SlicingTaskServices } from '.././../../../../../core/services/slicingTaskServices';
4 import { NsiModelComponent } from "../../nsi-management/nsi-model/nsi-model.component";
5
6 @Component({
7     selector: 'app-slicing-business-model',
8     templateUrl: './slicing-business-model.component.html',
9     styleUrls: ['./slicing-business-model.component.less']
10 })
11 export class SlicingBusinessModelComponent implements OnInit {
12
13     constructor(
14         private myhttp: SlicingTaskServices,
15         private modalService: NzModalService
16     ) {
17     }
18
19     @Input() businessId;
20     businessRequirement: any[];
21     NSTinfo: any[] = [];
22     nsiInfo: any[] = [];
23     taskModel: boolean = false;
24     isSpinning: boolean = true;
25     ngOnInit() {
26         console.log(this.businessId, "id");
27         this.getDetail()
28     }
29
30     getDetail() {
31         this.myhttp.getSlicingBusinessDetail(this.businessId).subscribe(res => {
32             this.isSpinning = false;
33             const { result_body, result_header: { result_code } } = res;
34             if (+result_code === 200) {
35                 const { business_demand_info, business_demand_info: { coverage_area_ta_list }, nst_info, nsi_info } = result_body;
36                 business_demand_info.area = coverage_area_ta_list.map(item => {
37                     item = item.split(';').join('-');
38                     return item
39                 });
40                 // area : Front-end analog data
41                 let area = ["Haidian District;Beijing;Beijing", "Xicheng District;Beijing;Beijing", "Changping District;Beijing;Beijing"].map(item => {
42                     item = item.split(';').join(' - ');
43                     return item
44                 });
45                 this.businessRequirement = [{ ...business_demand_info, area }];
46                 this.NSTinfo = [nst_info];
47                 if (nsi_info.nsi_id !== null) {
48                     this.nsiInfo = [nsi_info];
49                 }
50             }
51         })
52     }
53     showdetail(data) {
54         console.log(data, "data.nsi_id");
55         const nsiModal = this.modalService.create({
56             nzTitle: "Detail",
57             nzContent: NsiModelComponent,
58             nzWidth: "70%",
59             nzOkText: null,
60             nzCancelText: null,
61             nzComponentParams: {
62                 nsiId: data.nsi_id
63             }
64         });
65     }
66 }