1 import { Component, OnInit, Input, SimpleChanges } from "@angular/core";
2 import { SlicingTaskServices } from "@src/app/core/services/slicingTaskServices";
3 import { TASK_PROCESSING_STATUS } from "./constants";
4 import { INTERVAL_TIME } from "../constant";
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 {
12 constructor(private myhttp: SlicingTaskServices) {}
14 @Input() currentTabTitle;
16 showDetail: boolean = false;
17 showProcess: boolean = false;
18 selectedValue = "all";
20 moduleTitle: string = "";
21 moduleOperation: string;
22 listOfData: any[] = [];
23 statusOptions: any[] = TASK_PROCESSING_STATUS;
24 loading: boolean = false;
26 pageSize: string = "10";
27 pageNum: string = "1";
28 intervalTime: number = INTERVAL_TIME;
30 ngOnChanges(changes: SimpleChanges) {
32 changes.currentTabTitle.currentValue === "Slicing Task Management"
39 console.log("11.24 1732");
43 const { pageNum, pageSize } = this;
45 let getSlicingTaskListFailedCallback = () => {
52 getSlicingTaskListFailedCallback
55 const { slicing_task_list, record_number } = res.result_body;
56 this.dataFormatting(slicing_task_list);
57 this.total = record_number;
62 processingStatusChange(): void {
65 if (this.selectedValue && this.selectedValue !== "all") {
66 this.getListOfProcessingStatus();
72 getListOfProcessingStatus(): void {
73 const { selectedValue, pageNum, pageSize } = this;
75 let getTaskProcessingStatusFailedCallback = () => {
80 .getTaskProcessingStatus(
84 getTaskProcessingStatusFailedCallback
87 const { result_body } = res;
88 const { slicing_task_list, record_number } = result_body;
89 this.dataFormatting(slicing_task_list);
90 this.total = record_number;
95 pageSizeChange(pageSize: number): void {
96 this.pageSize = pageSize + "";
97 const { selectedValue } = this;
98 if (selectedValue && selectedValue !== "all") {
99 this.getListOfProcessingStatus();
105 pageNumChange(pageNum: number): void {
106 this.pageNum = pageNum + "";
107 const { selectedValue } = this;
108 if (selectedValue && selectedValue !== "all") {
109 this.getListOfProcessingStatus();
115 dataFormatting(list: any): void {
116 this.listOfData = list.map((item) => {
117 switch (item.processing_status) {
119 // item.status = '规划阶段';
120 item.operation = "Process Task";
122 case "Waiting to Confirm":
123 // item.status = '审核阶段';
124 item.operation = "Process Task";
126 case "WaitingToConfirm":
127 // item.status = '审核阶段';
128 item.operation = "Process Task";
131 // item.status = '切片创建中';
132 item.operation = "View Progress";
135 // item.status = '创建完成';
136 item.operation = "View Result";
143 showdetail(data: any): void {
144 this.taskId = data.task_id;
145 this.moduleTitle = data.task_name;
147 data.processing_status === "Waiting to Confirm" ||
148 data.processing_status === "WaitingToConfirm"
150 this.showDetail = true;
152 this.moduleOperation = data.operation;
153 this.showProcess = true;
157 handelCancel(obj: any): void {
158 this.showDetail = obj.showDetail;
160 if (this.selectedValue && this.selectedValue !== "all") {
161 this.getListOfProcessingStatus();
166 }, this.intervalTime);