1 import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
2 import { NzMessageService } from 'ng-zorro-antd';
3 import { SlicingTaskServices } from '../../../../../core/services/slicingTaskServices'
6 selector: 'app-check-process-model',
7 templateUrl: './check-process-model.component.html',
8 styleUrls: ['./check-process-model.component.less']
10 export class CheckProcessModelComponent implements OnInit {
12 @Input() moduleTitle: string;
13 @Input() showProcess: boolean;
14 @Input() taskId: string;
16 @Output() cancel = new EventEmitter<boolean>();
18 constructor(private http: SlicingTaskServices, private message: NzMessageService) { }
21 businessRequirement: any[];
24 currentProgress: number = 1;
26 isSpinning: boolean = false;
27 isGetData: boolean = false;
32 if (this.showProcess) {
33 this.isSpinning = true;
37 clearTimeout(this.timer);
38 this.isGetData = false;
43 this.http.getSlicingBasicInfo(this.taskId).subscribe(res => {
45 this.isSpinning = false;
47 this.isGetData = true;
49 const { result_body, result_header: { result_code } } = res;
50 if (+result_code === 200) {
58 business_demand_info: { service_snssai, coverage_area_ta_list }
61 this.checkDetail = [{ task_id, task_name, create_time, processing_status, service_snssai }];
63 business_demand_info.area = coverage_area_ta_list.map(item => {
64 item = item.split(';').join(' - ')
68 let area = ["北京;北京市;海淀区", "北京;北京市;西城区", "北京;北京市;昌平区"].map(item => {
69 item = item.split(';').join(' - ')
72 this.businessRequirement = [{...business_demand_info, area}];
74 this.NSTinfo = [nst_info];
76 const errorMessage = this.moduleTitle === '切片创建中' ? 'Failed to get data' : 'Viewing results failed';
77 this.message.error(errorMessage)
83 this.http.getSlicingCreateProgress(this.taskId).subscribe(res => {
85 this.isSpinning = false;
87 this.isGetData = true;
89 const { result_body, result_header: { result_code } } = res;
90 if (+result_code === 200) {
92 Object.keys(result_body).forEach(item => {
93 let currentProgress = 1
94 let status = 'process';
95 if (+result_body[item] === 100) {
99 const title = item === 'an_progress' ? 'An' : (item === 'tn_progress' ? 'Tn' : 'Cn')
100 let obj = { [item]: result_body[item], currentProgress, title, status };
103 this.data = [this.data];
104 let flag: boolean = false;
105 Object.values(result_body).forEach(item => {
111 this.timer = setTimeout(() => {
116 this.message.error('Failed to get progress')
122 this.showProcess = false;
123 this.cancel.emit(this.showProcess)