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;
43 let getSlicingTaskListFailedCallback = () => {
50 getSlicingTaskListFailedCallback
53 const { slicing_task_list, record_number } = res.result_body;
54 this.dataFormatting(slicing_task_list);
55 this.total = record_number;
60 processingStatusChange(): void {
63 if (this.selectedValue && this.selectedValue !== "all") {
64 this.getListOfProcessingStatus();
70 getListOfProcessingStatus(): void {
71 const { selectedValue, pageNum, pageSize } = this;
73 let getTaskProcessingStatusFailedCallback = () => {
78 .getTaskProcessingStatus(
82 getTaskProcessingStatusFailedCallback
85 const { result_body } = res;
86 const { slicing_task_list, record_number } = result_body;
87 this.dataFormatting(slicing_task_list);
88 this.total = record_number;
93 pageSizeChange(pageSize: number): void {
94 this.pageSize = pageSize + "";
95 const { selectedValue } = this;
96 if (selectedValue && selectedValue !== "all") {
97 this.getListOfProcessingStatus();
103 pageNumChange(pageNum: number): void {
104 this.pageNum = pageNum + "";
105 const { selectedValue } = this;
106 if (selectedValue && selectedValue !== "all") {
107 this.getListOfProcessingStatus();
113 dataFormatting(list: any): void {
114 this.listOfData = list.map((item) => {
115 switch (item.processing_status) {
117 // item.status = '规划阶段';
118 item.operation = "Process Task";
120 case "Waiting to Confirm":
121 // item.status = '审核阶段';
122 item.operation = "Process Task";
124 case "WaitingToConfirm":
125 // item.status = '审核阶段';
126 item.operation = "Process Task";
129 // item.status = '切片创建中';
130 item.operation = "View Progress";
133 // item.status = '创建完成';
134 item.operation = "View Result";
141 showdetail(data: any): void {
142 this.taskId = data.task_id;
143 this.moduleTitle = data.task_name;
145 data.processing_status === "Waiting to Confirm" ||
146 data.processing_status === "WaitingToConfirm"
148 this.showDetail = true;
150 this.moduleOperation = data.operation;
151 this.showProcess = true;
155 handelCancel(obj: any): void {
156 this.showDetail = obj.showDetail;
158 if (this.selectedValue && this.selectedValue !== "all") {
159 this.getListOfProcessingStatus();