!13 一些BUG修复和样式更新

Merge pull request !13 from dap1020/master
pull/15/MERGE
xingyu 2023-05-17 12:48:48 +00:00 committed by Gitee
commit 719a84a38c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 22 additions and 13 deletions

View File

@ -54,10 +54,10 @@ export const useRender = {
* @returns * @returns
*/ */
renderTag: (text, color?) => { renderTag: (text, color?) => {
if (!color) { if (color) {
return h(Tag, { color }, () => text) return h(Tag, { color }, () => text)
} else { } else {
return h('span', text) return h(Tag, {}, () => text)
} }
}, },
/** /**

View File

@ -48,15 +48,17 @@ export const columns: BasicColumn[] = [
dataIndex: 'duration', dataIndex: 'duration',
width: 180, width: 180,
customRender: ({ text }) => { customRender: ({ text }) => {
return useRender.renderText(text, 'ms') return useRender.renderText(text.toString(), 'ms')
} }
}, },
{ {
title: '操作结果', title: '操作结果',
dataIndex: 'status', dataIndex: 'status',
width: 180, width: 180,
ellipsis: true,
customRender: ({ record }) => { customRender: ({ record }) => {
return useRender.renderTag(record.resultCode === 0 ? '成功' : '失败(' + record.resultMsg + ')') const success = record.resultCode === 0
return useRender.renderTag(success ? '成功' : '失败(' + record.resultMsg + ')', success ? '#87d068' : '#f50')
} }
} }
] ]

View File

@ -1,6 +1,8 @@
import { DescItem } from '@/components/Description' import { DescItem } from '@/components/Description'
import { BasicColumn, FormSchema, useRender } from '@/components/Table' import { BasicColumn, FormSchema, useRender } from '@/components/Table'
import { DICT_TYPE, getDictOptions } from '@/utils/dict' import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import { JsonPreview } from '@/components/CodeEditor'
import { h } from 'vue'
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
{ {
@ -11,7 +13,7 @@ export const columns: BasicColumn[] = [
{ {
title: '任务编号', title: '任务编号',
dataIndex: 'jobId', dataIndex: 'jobId',
width: 180 width: 100
}, },
{ {
title: '处理器的名字', title: '处理器的名字',
@ -33,7 +35,9 @@ export const columns: BasicColumn[] = [
dataIndex: 'beginTime', dataIndex: 'beginTime',
width: 180, width: 180,
customRender: ({ record }) => { 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', dataIndex: 'status',
width: 180, width: 180,
customRender: ({ record }) => { 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: '执行时间', label: '执行时间',
field: 'beginTime', field: 'beginTime',
render: (data) => { render: (_, data) => {
return useRender.renderDate(data.beginTime) + ' ~ ' + useRender.renderDate(data.endTime) 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: '执行结果', label: '执行结果',
field: 'result', field: 'result',
render: (curVal) => { render: (curVal) => {
return useRender.renderText(curVal, ' result') const data = JSON.parse(curVal)
return h(JsonPreview, { data })
} }
} }
] ]

View File

@ -33,14 +33,14 @@ export const columns: BasicColumn[] = [
{ {
title: '结果', title: '结果',
dataIndex: 'result', dataIndex: 'result',
width: 180, width: 100,
customRender: ({ text }) => { customRender: ({ text }) => {
return useRender.renderDict(text, DICT_TYPE.SYSTEM_LOGIN_RESULT) return useRender.renderDict(text, DICT_TYPE.SYSTEM_LOGIN_RESULT)
} }
}, },
{ {
title: '登录日期', title: '登录日期',
dataIndex: 'loginTime', dataIndex: 'createTime',
width: 180, width: 180,
customRender: ({ text }) => { customRender: ({ text }) => {
return useRender.renderDate(text) return useRender.renderDate(text)

View File

@ -40,7 +40,7 @@ export const columns: BasicColumn[] = [
dataIndex: 'resultCode', dataIndex: 'resultCode',
width: 180, width: 180,
customRender: ({ text }) => { customRender: ({ text }) => {
return useRender.renderTag(text === 0 ? '成功' : '失败') return useRender.renderTag(text === 0 ? '成功' : '失败', text === 0 ? '#87d068' : '#f50')
} }
}, },
{ {