diff --git a/src/components/Table/src/hooks/useRender.ts b/src/components/Table/src/hooks/useRender.ts index e55976c3..37539163 100644 --- a/src/components/Table/src/hooks/useRender.ts +++ b/src/components/Table/src/hooks/useRender.ts @@ -54,10 +54,10 @@ export const useRender = { * @returns 标签 */ renderTag: (text, color?) => { - if (!color) { + if (color) { return h(Tag, { color }, () => text) } else { - return h('span', text) + return h(Tag, {}, () => text) } }, /** diff --git a/src/views/infra/apiAccessLog/apiAccessLog.data.ts b/src/views/infra/apiAccessLog/apiAccessLog.data.ts index 3d165942..12bb65a2 100644 --- a/src/views/infra/apiAccessLog/apiAccessLog.data.ts +++ b/src/views/infra/apiAccessLog/apiAccessLog.data.ts @@ -48,15 +48,17 @@ export const columns: BasicColumn[] = [ dataIndex: 'duration', width: 180, customRender: ({ text }) => { - return useRender.renderText(text, 'ms') + return useRender.renderText(text.toString(), 'ms') } }, { title: '操作结果', dataIndex: 'status', width: 180, + ellipsis: true, customRender: ({ record }) => { - return useRender.renderTag(record.resultCode === 0 ? '成功' : '失败(' + record.resultMsg + ')') + const success = record.resultCode === 0 + return useRender.renderTag(success ? '成功' : '失败(' + record.resultMsg + ')', success ? '#87d068' : '#f50') } } ] diff --git a/src/views/infra/job/logger/jobLog.data.ts b/src/views/infra/job/logger/jobLog.data.ts index 1ffeabc4..ec3253a1 100644 --- a/src/views/infra/job/logger/jobLog.data.ts +++ b/src/views/infra/job/logger/jobLog.data.ts @@ -1,6 +1,8 @@ import { DescItem } from '@/components/Description' import { BasicColumn, FormSchema, useRender } from '@/components/Table' import { DICT_TYPE, getDictOptions } from '@/utils/dict' +import { JsonPreview } from '@/components/CodeEditor' +import { h } from 'vue' export const columns: BasicColumn[] = [ { @@ -11,7 +13,7 @@ export const columns: BasicColumn[] = [ { title: '任务编号', dataIndex: 'jobId', - width: 180 + width: 100 }, { title: '处理器的名字', @@ -33,7 +35,9 @@ export const columns: BasicColumn[] = [ dataIndex: 'beginTime', width: 180, customRender: ({ record }) => { - return useRender.renderDate(record.beginTime) + ' ~ ' + useRender.renderDate(record.endTime) + const startTime = useRender.renderDate(record.beginTime) + const endTime = useRender.renderDate(record.endTime) + return useRender.renderTags([startTime, endTime]) } }, { @@ -49,7 +53,7 @@ export const columns: BasicColumn[] = [ dataIndex: 'status', width: 180, customRender: ({ record }) => { - return useRender.renderDict(record.beginTime, DICT_TYPE.INFRA_JOB_LOG_STATUS) + return useRender.renderDict(record.status, DICT_TYPE.INFRA_JOB_LOG_STATUS) } } ] @@ -114,8 +118,10 @@ export const descSchema: DescItem[] = [ { label: '执行时间', field: 'beginTime', - render: (data) => { - return useRender.renderDate(data.beginTime) + ' ~ ' + useRender.renderDate(data.endTime) + render: (_, data) => { + const startTime = '开始: ' + useRender.renderDate(data.beginTime) + const endTime = '结束: ' + useRender.renderDate(data.endTime) + return h('span', {}, [startTime, h('br'), endTime]) } }, { @@ -136,7 +142,8 @@ export const descSchema: DescItem[] = [ label: '执行结果', field: 'result', render: (curVal) => { - return useRender.renderText(curVal, ' result') + const data = JSON.parse(curVal) + return h(JsonPreview, { data }) } } ] diff --git a/src/views/system/loginlog/loginLog.data.ts b/src/views/system/loginlog/loginLog.data.ts index d126ab10..25175fb9 100644 --- a/src/views/system/loginlog/loginLog.data.ts +++ b/src/views/system/loginlog/loginLog.data.ts @@ -33,14 +33,14 @@ export const columns: BasicColumn[] = [ { title: '结果', dataIndex: 'result', - width: 180, + width: 100, customRender: ({ text }) => { return useRender.renderDict(text, DICT_TYPE.SYSTEM_LOGIN_RESULT) } }, { title: '登录日期', - dataIndex: 'loginTime', + dataIndex: 'createTime', width: 180, customRender: ({ text }) => { return useRender.renderDate(text) diff --git a/src/views/system/operatelog/operateLog.data.ts b/src/views/system/operatelog/operateLog.data.ts index a37a252f..8e0473c4 100644 --- a/src/views/system/operatelog/operateLog.data.ts +++ b/src/views/system/operatelog/operateLog.data.ts @@ -40,7 +40,7 @@ export const columns: BasicColumn[] = [ dataIndex: 'resultCode', width: 180, customRender: ({ text }) => { - return useRender.renderTag(text === 0 ? '成功' : '失败') + return useRender.renderTag(text === 0 ? '成功' : '失败', text === 0 ? '#87d068' : '#f50') } }, {