🐛 修复今日校园任务日志展示

修正任务日志字段映射,改为读取接口实际返回的 is_success 与 createTime,避免页面将执行结果和执行时间显示为 -。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
sugarBecomer
2026-04-07 13:26:22 +08:00
parent 05eaa4741a
commit cb5440c8d9
2 changed files with 20 additions and 8 deletions
+8 -3
View File
@@ -88,9 +88,14 @@ export interface CpLeave {
export interface CpTaskLog {
id: number
taskId: number
result: string
created_at: string
cp_task_id?: number
system_user_id?: number
cp_user_id?: number
is_success?: boolean
real_name?: string
createTime?: string
created_at?: string
updateTime?: string
}
export interface CpSchool {
+12 -5
View File
@@ -18,18 +18,25 @@ const taskId = computed(() => Number(route.params.id))
const columns: ColumnDef<CpTaskLog, any>[] = [
{ accessorKey: 'id', header: 'ID' },
{
accessorKey: 'result',
accessorKey: 'is_success',
header: '执行结果',
cell: ({ row }) => {
const result = row.getValue<string>('result')
return h('span', { class: 'whitespace-pre-wrap break-all' }, result || '-')
const isSuccess = row.original.is_success
if (typeof isSuccess !== 'boolean') {
return h('span', '-')
}
return h(
'span',
{ class: isSuccess ? 'text-green-600' : 'text-red-600' },
isSuccess ? '成功' : '失败',
)
},
},
{
accessorKey: 'created_at',
accessorKey: 'createTime',
header: '执行时间',
cell: ({ row }) => {
const val = row.getValue<string>('created_at')
const val = row.original.createTime || row.original.created_at
return val ? val.replace('T', ' ').slice(0, 19) : '-'
},
},