1 import { Component, OnInit } from '@angular/core';
2 import { NzMessageService } from 'ng-zorro-antd';
3 import { SlicingTaskServices } from '.././../../../core/services/slicingTaskServices';
4 import { TASK_PROCESSING_STATUS } from '../../../../../constants/constants';
7 selector: 'app-slicing-task-management',
8 templateUrl: './slicing-task-management.component.html',
9 styleUrls: ['./slicing-task-management.component.less']
11 export class SlicingTaskManagementComponent implements OnInit {
13 constructor(private myhttp: SlicingTaskServices, private message: NzMessageService) { }
15 showDetail: boolean = false;
16 showProcess: boolean = false;
17 selectedValue = 'all';
19 moduleTitle: string = "";
20 moduleOperation: string;
21 listOfData: any[] = [];
22 statusOptions: any[] = TASK_PROCESSING_STATUS;
23 loading: boolean = false;
25 pageSize: string = '10';
26 pageNum: string = '1';
33 const { pageNum, pageSize } = this;
35 this.myhttp.getSlicingTaskList(pageNum, pageSize).subscribe(res => {
36 const { result_header: { result_code }, result_body } = res
37 if (+result_code === 200) {
38 const { slicing_task_list, record_number } = result_body;
39 this.dataFormatting(slicing_task_list);
40 this.total = record_number;
42 this.message.error('Failed to get form data');
45 }, ({ status, statusText }) => {
46 this.message.error(status + ' (' + statusText + ')');
51 processingStatusChange(): void {
54 if (this.selectedValue && this.selectedValue !== 'all') {
55 this.getListOfProcessingStatus();
61 getListOfProcessingStatus(): void {
62 const { selectedValue, pageNum, pageSize } = this;
64 this.myhttp.getTaskProcessingStatus(selectedValue, pageNum + '', pageSize + '').subscribe(res => {
65 const { result_header: { result_code }, result_body } = res
66 if (+result_code === 200) {
67 const { slicing_task_list, record_number } = result_body;
68 this.dataFormatting(slicing_task_list)
69 this.total = record_number;
71 this.message.error('Failed to get form data');
74 }, ({ status, statusText }) => {
75 this.message.error(status + ' (' + statusText + ')');
81 pageSizeChange(pageSize: number): void {
82 this.pageSize = pageSize + '';
83 const { selectedValue } = this;
84 if (selectedValue && selectedValue !== 'all') {
85 this.getListOfProcessingStatus();
91 pageNumChange(pageNum: number): void {
92 this.pageNum = pageNum + '';
93 const { selectedValue } = this;
94 if (selectedValue && selectedValue !== 'all') {
95 this.getListOfProcessingStatus();
101 dataFormatting(list: any): void {
102 this.listOfData = list.map(item => {
103 switch (item.processing_status) {
105 // item.status = '规划阶段';
106 item.operation = 'Process Task'
108 case 'Waiting to Confirm':
109 // item.status = '审核阶段';
110 item.operation = 'Process Task'
112 case 'WaitingToConfirm':
113 // item.status = '审核阶段';
114 item.operation = 'Process Task'
117 // item.status = '切片创建中';
118 item.operation = 'View Progress'
121 // item.status = '创建完成';
122 item.operation = 'View Result'
129 showdetail(data: any): void {
130 this.taskId = data.task_id;
131 this.moduleTitle = data.task_name;
132 if (data.processing_status === 'Waiting to Confirm' || data.processing_status === 'WaitingToConfirm') {
133 this.showDetail = true;
135 this.moduleOperation = data.operation;
136 this.showProcess = true;
140 handelCancel(obj: any): void {
141 this.showDetail = obj.showDetail;
143 if (this.selectedValue && this.selectedValue !== 'all') {
144 this.getListOfProcessingStatus();