优化展示
This commit is contained in:
@@ -114,6 +114,8 @@ export default {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const data = await deviceService.getDevices();
|
const data = await deviceService.getDevices();
|
||||||
|
// Default sort by ID ascending
|
||||||
|
data.sort((a, b) => a.id - b.id);
|
||||||
this.allDevices = data;
|
this.allDevices = data;
|
||||||
this.tableData = this.buildTreeData(data);
|
this.tableData = this.buildTreeData(data);
|
||||||
this.originalTableData = [...this.tableData]; // 保存原始顺序
|
this.originalTableData = [...this.tableData]; // 保存原始顺序
|
||||||
|
|||||||
@@ -52,8 +52,9 @@
|
|||||||
<el-table-column prop="execute_count" label="已执行次数" min-width="120" sortable="custom" />
|
<el-table-column prop="execute_count" label="已执行次数" min-width="120" sortable="custom" />
|
||||||
<el-table-column prop="status" label="状态" min-width="100" sortable="custom">
|
<el-table-column prop="status" label="状态" min-width="100" sortable="custom">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag v-if="scope.row.status === 0" type="danger">禁用</el-tag>
|
<el-tag v-if="scope.row.status === 0" type="danger">禁用计划</el-tag>
|
||||||
<el-tag v-else-if="scope.row.status === 1" type="success">启用</el-tag>
|
<el-tag v-else-if="scope.row.status === 1" type="success">启用计划</el-tag>
|
||||||
|
<el-tag v-else-if="scope.row.status === 3" type="danger">执行失败</el-tag>
|
||||||
<el-tag v-else type="info">执行完毕</el-tag>
|
<el-tag v-else type="info">执行完毕</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -66,11 +67,13 @@
|
|||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button size="small" @click="editPlan(scope.row)">编辑</el-button>
|
<el-button size="small" @click="editPlan(scope.row)">编辑</el-button>
|
||||||
<el-button size="small" @click="showDetails(scope.row)">详情</el-button>
|
<el-button size="small" @click="showDetails(scope.row)">详情</el-button>
|
||||||
<el-button v-if="scope.row.status === 1" size="small" type="warning" @click="stopPlan(scope.row)" :loading="stoppingPlanId === scope.row.id">
|
<el-button
|
||||||
停止
|
size="small"
|
||||||
</el-button>
|
:type="scope.row.status === 1 ? 'warning' : 'primary'"
|
||||||
<el-button v-else size="small" @click="startPlan(scope.row)" :loading="startingPlanId === scope.row.id">
|
@click="scope.row.status === 1 ? stopPlan(scope.row) : startPlan(scope.row)"
|
||||||
启动
|
:loading="stoppingPlanId === scope.row.id || startingPlanId === scope.row.id"
|
||||||
|
>
|
||||||
|
{{ scope.row.status === 1 ? '停止' : '启动' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button size="small" type="danger" @click="deletePlan(scope.row)">删除</el-button>
|
<el-button size="small" type="danger" @click="deletePlan(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -156,7 +159,10 @@ export default {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await apiClient.plans.list();
|
const response = await apiClient.plans.list();
|
||||||
this.plans = response.data?.plans || [];
|
let fetchedPlans = response.data?.plans || [];
|
||||||
|
// Default sort by ID ascending
|
||||||
|
fetchedPlans.sort((a, b) => a.id - b.id);
|
||||||
|
this.plans = fetchedPlans;
|
||||||
this.originalPlans = [...this.plans]; // Keep a copy of the original order
|
this.originalPlans = [...this.plans]; // Keep a copy of the original order
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.error = err.message || '未知错误';
|
this.error = err.message || '未知错误';
|
||||||
|
|||||||
Reference in New Issue
Block a user