2022-07-18 19:06:37 +08:00
|
|
|
import { reactive } from 'vue'
|
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
|
import { required } from '@/utils/formRules'
|
|
|
|
import { DICT_TYPE } from '@/utils/dict'
|
2022-11-22 13:15:07 +08:00
|
|
|
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
|
2022-07-18 19:06:37 +08:00
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
|
|
|
// 表单校验
|
|
|
|
export const rules = reactive({
|
|
|
|
name: [required],
|
|
|
|
packageId: [required],
|
|
|
|
contactName: [required],
|
|
|
|
contactMobile: [required],
|
|
|
|
accountCount: [required],
|
|
|
|
expireTime: [required],
|
|
|
|
domain: [required],
|
|
|
|
status: [required]
|
|
|
|
})
|
|
|
|
|
|
|
|
// CrudSchema.
|
2022-11-22 13:15:07 +08:00
|
|
|
const crudSchemas = reactive<VxeCrudSchema>({
|
|
|
|
primaryKey: 'id',
|
|
|
|
primaryType: 'seq',
|
|
|
|
action: true,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
title: '租户名称',
|
|
|
|
field: 'name',
|
|
|
|
isSearch: true
|
2022-07-18 19:06:37 +08:00
|
|
|
},
|
2022-11-22 13:15:07 +08:00
|
|
|
{
|
|
|
|
title: '租户套餐',
|
|
|
|
field: 'packageId'
|
2022-10-11 17:10:57 +08:00
|
|
|
},
|
2022-11-22 13:15:07 +08:00
|
|
|
{
|
|
|
|
title: '联系人',
|
|
|
|
field: 'contactName',
|
|
|
|
isSearch: true
|
2022-10-11 17:10:57 +08:00
|
|
|
},
|
2022-11-22 13:15:07 +08:00
|
|
|
{
|
|
|
|
title: '联系手机',
|
|
|
|
field: 'contactMobile',
|
|
|
|
isSearch: true
|
2022-10-11 17:10:57 +08:00
|
|
|
},
|
2022-11-22 13:15:07 +08:00
|
|
|
{
|
|
|
|
title: '用户名称',
|
|
|
|
field: 'username',
|
|
|
|
isTable: false,
|
|
|
|
isDetail: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '用户密码',
|
|
|
|
field: 'password',
|
|
|
|
isTable: false,
|
|
|
|
isDetail: false,
|
|
|
|
form: {
|
|
|
|
component: 'InputPassword'
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
},
|
2022-11-22 13:15:07 +08:00
|
|
|
{
|
|
|
|
title: '账号额度',
|
|
|
|
field: 'accountCount',
|
|
|
|
form: {
|
|
|
|
component: 'InputNumber'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '过期时间',
|
|
|
|
field: 'expireTime',
|
|
|
|
formatter: 'formatDate',
|
|
|
|
form: {
|
|
|
|
component: 'DatePicker',
|
|
|
|
componentProps: {
|
2022-11-22 13:43:00 +08:00
|
|
|
type: 'datetime'
|
2022-11-22 13:15:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '绑定域名',
|
|
|
|
field: 'domain'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '租户状态',
|
|
|
|
field: 'status',
|
|
|
|
dictType: DICT_TYPE.COMMON_STATUS,
|
|
|
|
dictClass: 'number',
|
|
|
|
isSearch: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: t('table.createTime'),
|
|
|
|
field: 'createTime',
|
|
|
|
formatter: 'formatDate',
|
|
|
|
isForm: false
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
2022-11-22 13:15:07 +08:00
|
|
|
]
|
|
|
|
})
|
|
|
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|