1 import { Component, OnInit } from '@angular/core';
2 import { NzMessageService } from 'ng-zorro-antd';
3 import * as moment from 'moment';
4 import { SlicingTaskServices } from '.././../../../core/services/slicingTaskServices';
5 import { TASK_PROCESSING_STATUS } from '../../../../../constants/constants';
8 selector: 'app-slicing-task-management',
9 templateUrl: './slicing-task-management.component.html',
10 styleUrls: ['./slicing-task-management.component.less']
12 export class SlicingTaskManagementComponent implements OnInit {
14 constructor(private myhttp: SlicingTaskServices, private message: NzMessageService) { }
16 showDetail: boolean = false;
17 showProcess: boolean = false;
20 moduleTitle: 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')
48 processingStatusChange(): void {
51 if (this.selectedValue) {
52 this.getListOfProcessingStatus();
58 getListOfProcessingStatus(): void {
59 const { selectedValue, pageNum, pageSize } = this;
61 this.myhttp.getTaskProcessingStatus(selectedValue, pageNum + '', pageSize + '').subscribe(res => {
62 const { result_header: { result_code }, result_body } = res
63 if (+result_code === 200) {
64 const { slicing_task_list, record_number } = result_body;
65 this.dataFormatting(slicing_task_list)
66 this.total = record_number;
68 this.message.error('Failed to get form data')
74 pageSizeChange(pageSize: number): void {
75 this.pageSize = pageSize + '';
76 const { selectedValue } = this;
78 this.getListOfProcessingStatus();
84 pageNumChange(pageNum: number): void {
85 this.pageNum = pageNum + '';
86 const { selectedValue } = this;
88 this.getListOfProcessingStatus();
94 dataFormatting(list: any): void {
95 this.listOfData = list.map(item => {
96 item.create_time = moment(item.create_time).format('YYYY-MM-DD hh:mm')
97 switch (item.processing_status) {
100 item.operation = '任务处理'
102 case 'Waiting to Confirm':
103 item.status = '审核阶段';
104 item.operation = '任务处理'
107 item.status = '切片创建中';
108 item.operation = '查看进度'
111 item.status = '创建完成';
112 item.operation = '查看结果'
119 showdetail(data: any): void {
120 this.taskId = data.task_id;
121 this.moduleTitle = data.status;
122 if (data.status === '审核阶段') {
123 this.showDetail = true;
125 this.showProcess = true;