refactor: job vxe

This commit is contained in:
xingyu4j
2022-11-22 17:07:30 +08:00
parent 562282b2ad
commit 92bcaa04d1
6 changed files with 402 additions and 446 deletions

View File

@ -2,9 +2,8 @@ import { reactive } from 'vue'
import { DICT_TYPE } from '@/utils/dict'
import { required } from '@/utils/formRules'
import { useI18n } from '@/hooks/web/useI18n'
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
// 国际化
const { t } = useI18n()
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
const { t } = useI18n() // 国际化
// 表单校验
export const rules = reactive({
name: [required],
@ -14,87 +13,55 @@ export const rules = reactive({
retryInterval: [required]
})
// CrudSchema
const crudSchemas = reactive<CrudSchema[]>([
{
label: t('common.index'),
field: 'id',
type: 'index',
form: {
show: false
const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id',
primaryType: 'seq',
action: true,
actionWidth: '500px',
columns: [
{
title: '任务名称',
field: 'name',
search: {
show: true
}
},
detail: {
show: false
}
},
{
label: '任务名称',
field: 'name',
search: {
show: true
}
},
{
label: t('common.status'),
field: 'status',
dictType: DICT_TYPE.INFRA_JOB_STATUS,
dictClass: 'number',
form: {
show: false
{
title: t('common.status'),
field: 'status',
dictType: DICT_TYPE.INFRA_JOB_STATUS,
dictClass: 'number',
isForm: false
},
detail: {
show: false
}
},
{
label: '处理器的名字',
field: 'handlerName',
search: {
show: true
}
},
{
label: '处理器的参数',
field: 'handlerParam',
table: {
show: false
}
},
{
label: 'CRON 表达式',
field: 'cronExpression'
},
{
label: '重试次数',
field: 'retryCount',
table: {
show: false
}
},
{
label: '重试间隔',
field: 'retryInterval',
table: {
show: false
}
},
{
label: '监控超时时间',
field: 'monitorTimeout',
table: {
show: false
}
},
{
field: 'action',
width: '500px',
label: t('table.action'),
form: {
show: false
{
title: '处理器的名字',
field: 'handlerName',
isSearch: true
},
detail: {
show: false
{
title: '处理器的参数',
field: 'handlerParam',
isTable: false
},
{
title: 'CRON 表达式',
field: 'cronExpression'
},
{
title: '重试次数',
field: 'retryCount',
isTable: false
},
{
title: '重试间隔',
field: 'retryInterval',
isTable: false
},
{
title: '监控超时时间',
field: 'monitorTimeout',
isTable: false
}
}
])
export const { allSchemas } = useCrudSchemas(crudSchemas)
]
})
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)