moveSubTask.vue
4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<template>
<!-- 内层dialog -->
<el-dialog
width="630px"
title="视频迁移"
:visible.sync="innerVisible"
append-to-body
>
<el-table
height="286"
:data="moveTaskData"
stripe
border
style="width: 100%"
highlight-current-row
@current-change="handleCurrentChange"
>
<el-table-column
align="center"
prop="task_name"
label="任务名称"
></el-table-column>
<el-table-column align="center" prop="status" label="状态">
<template slot-scope="scope">
<div v-html="statusFormatter(scope.row)"></div>
</template>
</el-table-column>
<el-table-column
align="center"
prop="task_algo_type"
label="算法类型"
:formatter="typeFormatter"
></el-table-column>
<el-table-column
align="center"
prop="store_conf.name"
label="储存配置"
></el-table-column>
<el-table-column
align="center"
prop="resource_use"
label="场景占用"
></el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="movetask">确 定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data() {
return {
innerVisible: false,
moveTaskData: [],
curTaskData: {},
curSubTaskData: {},
curRow: {}
};
},
methods: {
initMoveTask(sutaskdata, taskData) {
this.curTaskData = taskData;
this.curSubTaskData = sutaskdata;
this.getTaskList();
},
handleClose() {
this.innerVisible = false;
},
handleCurrentChange(val) {
this.curRow = val;
},
getTaskList() {
this.tableData = [];
let offset = (this.page - 1) * this.pageSize;
this.$api.task
.getTask({
limit: 10000,
offset: 0,
task_algo_type: this.curTaskData.task_algo_type,
source_type: "pull_video_stream",
task_type: "normal",
resource_use: this.curTaskData.resource_use || ""
})
.then(res => {
this.total = res.total_num;
if (res.list_data == null) {
this.tableData = [];
} else {
let taskArr = [];
for (let i = 0; i < res.list_data.length; i++) {
if (res.list_data[i].task_id == this.curTaskData.task_id) {
break;
} else {
taskArr.push(res.list_data[i]);
}
}
if (taskArr.length > 0) {
this.moveTaskData = taskArr;
this.innerVisible = true;
} else {
this.$message({
message: "没有符合的任务",
type: "warning"
});
}
}
})
.catch(error => {});
},
typeFormatter(row, column, cellValue, index) {
if (cellValue == 0) {
return "交通";
} else if (cellValue == 1) {
return "客流";
} else if (cellValue == 2) {
return "行为分析";
} else if (cellValue == 3) {
return "违停";
} else if (cellValue == 5) {
return "交通行人";
} else if (cellValue == 7) {
return "综合流量";
} else {
return "未知";
}
},
statusFormatter(row) {
if (row.status == "Running") {
return "<span class='runningbox statusbox'>工作中</span>";
} else if (row.status == "Finished") {
return "<span class='finishedbox statusbox'>已完成</span>";
} else if (row.status == "Pause") {
return "<span class='pausebox statusbox'>暂停</span>";
} else if (row.status == "Error") {
return "<span class='errorbox statusbox'>异常</span>";
} else if (row.status == "Deleted") {
return "<span class='deletebox statusbox'>已删除</span>";
} else {
return "<span class='nomoralbox statusbox'>未部署</span>";
}
},
movetask() {
let data = {
subtask_id: this.curSubTaskData.subtask_id
};
this.$api.task.moveTask(this.curTaskData.task_id, data).then(res => {
console.log(res);
});
}
}
};
</script>
<style></style>