Revert "完善后台任务中心历史摘要视图"

This reverts commit 1db8681636.
This commit is contained in:
Liu
2026-05-01 12:45:40 +08:00
parent 024624126e
commit 17264f91e6
8 changed files with 7 additions and 496 deletions

View File

@@ -42,44 +42,11 @@
<el-tag :type="statusTag(scope.row.last_status)">{% raw %}{{ scope.row.last_status || 'never' }}{% endraw %}</el-tag>
</template>
</el-table-column>
<el-table-column label="健康状态" width="120" align="center">
<template slot-scope="scope">
<el-tag :type="healthTag(scope.row.health_status)">{% raw %}{{ healthLabel(scope.row.health_status) }}{% endraw %}</el-tag>
</template>
</el-table-column>
<el-table-column label="最近成功" min-width="165">
<template slot-scope="scope">
{% raw %}{{ formatDateTime(scope.row.latest_success_at) }}{% endraw %}
</template>
</el-table-column>
<el-table-column label="最近失败原因" min-width="240">
<template slot-scope="scope">
<div class="cell-ellipsis" :title="scope.row.latest_failure_summary || scope.row.last_error || '-'">
{% raw %}{{ scope.row.latest_failure_summary || scope.row.last_error || '-' }}{% endraw %}
</div>
</template>
</el-table-column>
<el-table-column label="历史执行" width="150" align="center">
<template slot-scope="scope">
<div class="history-metrics">
<span class="metric-success">{% raw %}{{ `成 ${scope.row.history_success_count || 0}` }}{% endraw %}</span>
<span class="metric-fail">{% raw %}{{ `失 ${scope.row.history_fail_count || 0}` }}{% endraw %}</span>
</div>
<div class="history-total">{% raw %}{{ `共 ${scope.row.history_total_count || 0}` }}{% endraw %}</div>
</template>
</el-table-column>
<el-table-column label="操作" min-width="360">
<el-table-column label="操作" min-width="280">
<template slot-scope="scope">
<div class="action-row">
<el-button size="mini" type="primary" plain @click="openEdit(scope.row)">编辑</el-button>
<el-button size="mini" type="success" plain @click="triggerNow(scope.row)">立即触发</el-button>
<el-button
size="mini"
:type="scope.row.enabled ? 'warning' : 'success'"
plain
@click="toggleEnabled(scope.row)">
{% raw %}{{ scope.row.enabled ? '停用' : '启用' }}{% endraw %}
</el-button>
<el-button size="mini" type="text" @click="viewLogs(scope.row)">日志</el-button>
</div>
</template>
@@ -230,25 +197,6 @@ new Vue({
if (status === 'running') return 'warning'
return 'info'
},
healthTag(status) {
if (status === 'healthy') return 'success'
if (status === 'running') return 'warning'
if (status === 'failed') return 'danger'
if (status === 'degraded') return 'warning'
if (status === 'disabled') return 'info'
return ''
},
healthLabel(status) {
const mapping = {
healthy: '健康',
running: '执行中',
failed: '异常',
degraded: '有告警',
disabled: '停用',
idle: '待运行'
}
return mapping[status] || '待运行'
},
formatDateTime(value) {
// 统一清洗时间展示:去掉 ISO 'T',并兼容字符串与日期对象。
if (!value) return ''
@@ -382,25 +330,6 @@ new Vue({
}
await this.loadSchedules()
},
async toggleEnabled(row) {
const payload = {
action_name: row.action_name,
description: row.description,
enabled: !row.enabled,
trigger_type: row.trigger_type,
trigger_config: row.trigger_config,
target_scope: row.target_scope,
target_config: row.target_config,
payload: row.payload || {}
}
const resp = await axios.put(`/plugin_schedules/api/schedules/${row.id}`, payload)
if (resp.data.success) {
this.$message.success(row.enabled ? '已停用' : '已启用')
await this.loadSchedules()
} else {
this.$message.error(resp.data.message || '更新失败')
}
},
async viewLogs(row) {
const resp = await axios.get(`/plugin_schedules/api/schedules/${row.id}/logs`)
if (resp.data.success) {
@@ -423,10 +352,5 @@ new Vue({
.page-hero-copy p{color:#64748b;font-size:14px}
.action-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.detail-pre{white-space:pre-wrap;word-break:break-word;background:rgba(248,250,252,.85);border:1px solid rgba(148,163,184,.12);border-radius:14px;padding:10px;color:#334155}
.cell-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#475569}
.history-metrics{display:flex;align-items:center;justify-content:center;gap:8px}
.metric-success{color:#16a34a;font-weight:600}
.metric-fail{color:#dc2626;font-weight:600}
.history-total{margin-top:4px;color:#64748b;font-size:12px}
</style>
{% endblock %}