修改相应bug
parent
c65a9d92bb
commit
c4fc9ee565
@ -0,0 +1,70 @@
|
|||||||
|
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
// 表单校验
|
||||||
|
|
||||||
|
export const rules = reactive({
|
||||||
|
name: [required],
|
||||||
|
handlerName: [required],
|
||||||
|
cronExpression: [required],
|
||||||
|
retryCount: [required],
|
||||||
|
retryInterval: [required]
|
||||||
|
})
|
||||||
|
// CrudSchema
|
||||||
|
const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
|
primaryKey: 'id',
|
||||||
|
primaryType: 'id',
|
||||||
|
primaryTitle: '任务编号',
|
||||||
|
action: true,
|
||||||
|
actionWidth: '280px',
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '任务名称',
|
||||||
|
field: 'name',
|
||||||
|
isSearch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('common.status'),
|
||||||
|
field: 'status',
|
||||||
|
dictType: DICT_TYPE.INFRA_JOB_STATUS,
|
||||||
|
dictClass: 'number',
|
||||||
|
isForm: false,
|
||||||
|
isSearch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '处理器的名字',
|
||||||
|
field: 'handlerName',
|
||||||
|
isSearch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '处理器的参数',
|
||||||
|
field: 'handlerParam',
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'CRON 表达式',
|
||||||
|
field: 'cronExpression'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '后续执行时间',
|
||||||
|
field: 'nextTimes',
|
||||||
|
isTable: false,
|
||||||
|
isForm: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '重试次数',
|
||||||
|
field: 'retryCount',
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '重试间隔',
|
||||||
|
field: 'retryInterval',
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '监控超时时间',
|
||||||
|
field: 'monitorTimeout',
|
||||||
|
isTable: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
||||||
@ -0,0 +1,76 @@
|
|||||||
|
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
||||||
|
// 国际化
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
// CrudSchema
|
||||||
|
const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
|
primaryKey: 'id',
|
||||||
|
primaryType: 'id',
|
||||||
|
primaryTitle: '日志编号',
|
||||||
|
action: true,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '任务编号',
|
||||||
|
field: 'jobId',
|
||||||
|
isSearch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '处理器的名字',
|
||||||
|
field: 'handlerName',
|
||||||
|
isSearch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '处理器的参数',
|
||||||
|
field: 'handlerParam'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '第几次执行',
|
||||||
|
field: 'executeIndex'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '开始执行时间',
|
||||||
|
field: 'beginTime',
|
||||||
|
formatter: 'formatDate',
|
||||||
|
table: {
|
||||||
|
slots: {
|
||||||
|
default: 'beginTime_default'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
search: {
|
||||||
|
show: true,
|
||||||
|
itemRender: {
|
||||||
|
name: 'XDataPicker'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '结束执行时间',
|
||||||
|
field: 'endTime',
|
||||||
|
formatter: 'formatDate',
|
||||||
|
isTable: false,
|
||||||
|
search: {
|
||||||
|
show: true,
|
||||||
|
itemRender: {
|
||||||
|
name: 'XDataPicker'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '执行时长',
|
||||||
|
field: 'duration',
|
||||||
|
table: {
|
||||||
|
slots: {
|
||||||
|
default: 'duration_default'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('common.status'),
|
||||||
|
field: 'status',
|
||||||
|
dictType: DICT_TYPE.INFRA_JOB_LOG_STATUS,
|
||||||
|
dictClass: 'number',
|
||||||
|
isSearch: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
||||||
@ -1,44 +0,0 @@
|
|||||||
export const parseTime = (time) => {
|
|
||||||
if (!time) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
const format = '{y}-{m}-{d} {h}:{i}:{s}'
|
|
||||||
let date
|
|
||||||
if (typeof time === 'object') {
|
|
||||||
date = time
|
|
||||||
} else {
|
|
||||||
if (typeof time === 'string' && /^[0-9]+$/.test(time)) {
|
|
||||||
time = parseInt(time)
|
|
||||||
} else if (typeof time === 'string') {
|
|
||||||
time = time
|
|
||||||
.replace(new RegExp(/-/gm), '/')
|
|
||||||
.replace('T', ' ')
|
|
||||||
.replace(new RegExp(/\.[\d]{3}/gm), '')
|
|
||||||
}
|
|
||||||
if (typeof time === 'number' && time.toString().length === 10) {
|
|
||||||
time = time * 1000
|
|
||||||
}
|
|
||||||
date = new Date(time)
|
|
||||||
}
|
|
||||||
const formatObj = {
|
|
||||||
y: date.getFullYear(),
|
|
||||||
m: date.getMonth() + 1,
|
|
||||||
d: date.getDate(),
|
|
||||||
h: date.getHours(),
|
|
||||||
i: date.getMinutes(),
|
|
||||||
s: date.getSeconds(),
|
|
||||||
a: date.getDay()
|
|
||||||
}
|
|
||||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
|
||||||
let value = formatObj[key]
|
|
||||||
// Note: getDay() returns 0 on Sunday
|
|
||||||
if (key === 'a') {
|
|
||||||
return ['日', '一', '二', '三', '四', '五', '六'][value]
|
|
||||||
}
|
|
||||||
if (result.length > 0 && value < 10) {
|
|
||||||
value = '0' + value
|
|
||||||
}
|
|
||||||
return value || 0
|
|
||||||
})
|
|
||||||
return time_str
|
|
||||||
}
|
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
|
// 表单校验
|
||||||
|
export const rules = reactive({
|
||||||
|
title: [required],
|
||||||
|
type: [required]
|
||||||
|
})
|
||||||
|
|
||||||
|
// CrudSchema
|
||||||
|
const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
|
primaryKey: 'id',
|
||||||
|
primaryType: 'seq',
|
||||||
|
action: true,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '公告标题',
|
||||||
|
field: 'title',
|
||||||
|
isSearch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '公告类型',
|
||||||
|
field: 'type',
|
||||||
|
dictType: DICT_TYPE.SYSTEM_NOTICE_TYPE,
|
||||||
|
dictClass: 'number'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('common.status'),
|
||||||
|
field: 'status',
|
||||||
|
dictType: DICT_TYPE.COMMON_STATUS,
|
||||||
|
dictClass: 'number',
|
||||||
|
isSearch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '公告内容',
|
||||||
|
field: 'content',
|
||||||
|
table: {
|
||||||
|
type: 'html'
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
component: 'Editor',
|
||||||
|
colProps: {
|
||||||
|
span: 24
|
||||||
|
},
|
||||||
|
componentProps: {
|
||||||
|
valueHtml: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isTable: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('common.createTime'),
|
||||||
|
field: 'createTime',
|
||||||
|
formatter: 'formatDate',
|
||||||
|
isForm: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|
||||||
Loading…
Reference in New Issue