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";
6 selector: "app-slicing-task-management",
7 templateUrl: "./slicing-task-management.component.html",
8 styleUrls: ["./slicing-task-management.component.less"],
10 export class SlicingTaskManagementComponent implements OnInit {
11 constructor(private myhttp: SlicingTaskServices) {}
13 @Input() currentTabTitle;
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";
28 ngOnChanges(changes: SimpleChanges) {
30 changes.currentTabTitle.currentValue === "Slicing Task Management"
37 console.log("11.24 1732");
41 const { pageNum, pageSize } = this;
42 this.loading = true; // todo
43 this.myhttp.getSlicingTaskList(pageNum, pageSize).then((res) => {
44 const { slicing_task_list, record_number } = res.result_body;
45 this.dataFormatting(slicing_task_list);
46 this.total = record_number;
51 processingStatusChange(): void {
54 if (this.selectedValue && this.selectedValue !== "all") {
55 this.getListOfProcessingStatus();
61 getListOfProcessingStatus(): void {
62 const { selectedValue, pageNum, pageSize } = this;
64 let getTaskProcessingStatusFailedCallback = () => {
69 .getTaskProcessingStatus(
73 getTaskProcessingStatusFailedCallback
76 const { result_body } = res;
77 const { slicing_task_list, record_number } = result_body;
78 this.dataFormatting(slicing_task_list);
79 this.total = record_number;
84 pageSizeChange(pageSize: number): void {
85 this.pageSize = pageSize + "";
86 const { selectedValue } = this;
87 if (selectedValue && selectedValue !== "all") {
88 this.getListOfProcessingStatus();
94 pageNumChange(pageNum: number): void {
95 this.pageNum = pageNum + "";
96 const { selectedValue } = this;
97 if (selectedValue && selectedValue !== "all") {
98 this.getListOfProcessingStatus();
104 dataFormatting(list: any): void {
105 this.listOfData = list.map((item) => {
106 switch (item.processing_status) {
108 // item.status = '规划阶段';
109 item.operation = "Process Task";
111 case "Waiting to Confirm":
112 // item.status = '审核阶段';
113 item.operation = "Process Task";
115 case "WaitingToConfirm":
116 // item.status = '审核阶段';
117 item.operation = "Process Task";
120 // item.status = '切片创建中';
121 item.operation = "View Progress";
124 // item.status = '创建完成';
125 item.operation = "View Result";
132 showdetail(data: any): void {
133 this.taskId = data.task_id;
134 this.moduleTitle = data.task_name;
136 data.processing_status === "Waiting to Confirm" ||
137 data.processing_status === "WaitingToConfirm"
139 this.showDetail = true;
141 this.moduleOperation = data.operation;
142 this.showProcess = true;
146 handelCancel(obj: any): void {
147 this.showDetail = obj.showDetail;
149 if (this.selectedValue && this.selectedValue !== "all") {
150 this.getListOfProcessingStatus();