8d61029ed6c832fdaf4f15cc427e6647c1f4d8d8
[usecase-ui.git] /
1 import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
2 import { SlicingTaskServices } from '../../../../../core/services/slicingTaskServices';
3 import { BUSINESS_REQUIREMENT } from '../../../../../../constants/constants';
4
5 @Component({
6   selector: 'app-slicing-task-model',
7   templateUrl: './slicing-task-model.component.html',
8   styleUrls: ['./slicing-task-model.component.less']
9 })
10 export class SlicingTaskModelComponent implements OnInit {
11   @Input() showDetail: boolean;
12   @Input() moduleTitle: string;
13   @Input() taskId: string;
14   @Output() cancel = new EventEmitter<boolean>();
15
16   constructor(private http: SlicingTaskServices) { }
17
18   // 业务需求列表
19   businessList: object[] = BUSINESS_REQUIREMENT;
20   // 配置审核详情
21   checkDetail: object[] = [{}];
22   //业务需求信息
23   businessRequirement: object[] = [{}];
24   //匹配NST信息 
25   NSTinfo: object[] = [{}];
26   // 共享切片实例
27   selectedServiceId: string;
28   selectedServiceName: string;
29   // 子网实例
30   slicingSubnet: any[] =  [
31     {
32       title: '无线域',
33       slicingId: '',
34       slicingName: ''
35     },
36     {
37       title: '传输域',
38       slicingId: '',
39       slicingName: ''
40     },
41     {
42       title: '核心网域',
43       slicingId: '',
44       slicingName: ''
45     }
46   ]
47
48   ngOnInit() { }
49   
50   ngOnChanges() {
51     if (this.showDetail) {
52       this.getautidInfo();
53     }
54   }
55
56   getautidInfo(): void {
57     this.http.getAuditInfo(this.taskId).subscribe( res => {
58       const { result_header: { result_code } } = res;
59       if (+result_code === 200) {
60         const { task_id, task_name, create_timer, processing_status, business_demand_info, nst_info, nsi_nssi_info, business_demand_info: { service_snssai } } = res.result_body;
61         const { 
62           suggest_nsi_id, 
63           suggest_nsi_name, 
64           an_suggest_nssi_id, 
65           an_suggest_nssi_name, 
66           tn_suggest_nssi_id, 
67           tn_suggest_nssi_name, 
68           cn_suggest_nssi_id, 
69           cn_suggest_nssi_name } = nsi_nssi_info;
70         // 处理配置审核详情数据
71         this.checkDetail = [{ task_id, task_name, create_timer, processing_status, service_snssai }];
72         // 业务需求信息数据
73         this.businessRequirement = [business_demand_info];
74         this.NSTinfo = [nst_info];
75         // 共享切片实例
76         this.selectedServiceId = suggest_nsi_id;
77         this.selectedServiceName = suggest_nsi_name;
78         // 子网实例
79         this.slicingSubnet[0].slicingId = an_suggest_nssi_id;
80         this.slicingSubnet[0].slicingName = an_suggest_nssi_name;
81         this.slicingSubnet[1].slicingId = tn_suggest_nssi_id;
82         this.slicingSubnet[1].slicingName = tn_suggest_nssi_name;
83         this.slicingSubnet[2].slicingId = cn_suggest_nssi_id;
84         this.slicingSubnet[2].slicingName = cn_suggest_nssi_name;
85       }
86     })
87   }
88
89
90
91
92
93
94   serviceId = ['46da8cf8-0878-48ac-bea3-f2200959411a', '46da8cf8-0878-48ac-bea3-f2200959411b', '46da8cf8-0878-48ac-bea3-f2200959411c'];
95   serviceData: {} = {
96     "46da8cf8-0878-48ac-bea3-f2200959411a": "eMBB instancela",
97     "46da8cf8-0878-48ac-bea3-f2200959411b": "eMBB instancelb",
98     "46da8cf8-0878-48ac-bea3-f2200959411c": "eMBB instancelc",
99   };
100
101
102
103   serviceIdChange(value: string): void {
104     this.selectedServiceName = this.serviceData[value];
105     console.log(this.selectedServiceName, "=====")
106   }
107   resetService() {
108     this.selectedServiceId = "";
109     this.serviceIdChange(this.selectedServiceId);
110   }
111
112   handleCancel() {
113     this.showDetail = false;
114     this.cancel.emit(this.showDetail);
115   }
116   handleOk() {
117     this.handleCancel();
118     // 对应操作逻辑未编写
119
120   }
121 }