!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
*/
renderTag: (text, color?) => {
if (!color) {
if (color) {
return h(Tag, { color }, () => text)
} else {
return h('span', text)
return h(Tag, {}, () => text)
}
},
/**

View File

@ -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')
}
}
]

View File

@ -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 })
}
}
]

View File

@ -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)

View File

@ -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')
}
},
{