修复插件定时任务星期与时间格式显示问题
变更项:1) async_job 触发文案把每周数字改为中文星期(周一到周日),消除星期显示歧义。2) async_job 时间序列化改为 yyyy-MM-dd HH:mm:ss,去掉 ISO 格式中的 T。3) 插件定时任务页面统一使用 formatDateTime 渲染下次执行、上次执行与日志触发时间,前端兜底去除 T。4) 补充中文注释说明显示层与调度层格式化意图。
This commit is contained in:
@@ -27,8 +27,16 @@
|
||||
<el-tag :type="scope.row.enabled ? 'success' : 'info'">{% raw %}{{ scope.row.enabled ? '是' : '否' }}{% endraw %}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="next_run_at" label="下次执行" min-width="165"></el-table-column>
|
||||
<el-table-column prop="last_run_at" label="上次执行" min-width="165"></el-table-column>
|
||||
<el-table-column label="下次执行" min-width="165">
|
||||
<template slot-scope="scope">
|
||||
{% raw %}{{ formatDateTime(scope.row.next_run_at) }}{% endraw %}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="上次执行" min-width="165">
|
||||
<template slot-scope="scope">
|
||||
{% raw %}{{ formatDateTime(scope.row.last_run_at) }}{% endraw %}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="最近结果" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="statusTag(scope.row.last_status)">{% raw %}{{ scope.row.last_status || 'never' }}{% endraw %}</el-tag>
|
||||
@@ -129,7 +137,11 @@
|
||||
|
||||
<el-dialog title="调度日志" :visible.sync="logsDialogVisible" width="860px">
|
||||
<el-table :data="logs" style="width:100%">
|
||||
<el-table-column prop="triggered_at" label="触发时间" width="180"></el-table-column>
|
||||
<el-table-column label="触发时间" width="180">
|
||||
<template slot-scope="scope">
|
||||
{% raw %}{{ formatDateTime(scope.row.triggered_at) }}{% endraw %}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="状态" width="100"></el-table-column>
|
||||
<el-table-column prop="summary" label="摘要" min-width="220"></el-table-column>
|
||||
<el-table-column label="详情">
|
||||
@@ -185,6 +197,26 @@ new Vue({
|
||||
if (status === 'running') return 'warning'
|
||||
return 'info'
|
||||
},
|
||||
formatDateTime(value) {
|
||||
// 统一清洗时间展示:去掉 ISO 'T',并兼容字符串与日期对象。
|
||||
if (!value) return ''
|
||||
if (typeof value === 'string') {
|
||||
return value.replace('T', ' ').slice(0, 19)
|
||||
}
|
||||
try {
|
||||
const date = new Date(value)
|
||||
if (Number.isNaN(date.getTime())) return String(value)
|
||||
const yyyy = date.getFullYear()
|
||||
const mm = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const dd = String(date.getDate()).padStart(2, '0')
|
||||
const hh = String(date.getHours()).padStart(2, '0')
|
||||
const mi = String(date.getMinutes()).padStart(2, '0')
|
||||
const ss = String(date.getSeconds()).padStart(2, '0')
|
||||
return `${yyyy}-${mm}-${dd} ${hh}:${mi}:${ss}`
|
||||
} catch (e) {
|
||||
return String(value)
|
||||
}
|
||||
},
|
||||
async loadSchedules() {
|
||||
this.loading = true
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user