2022-07-18 19:06:37 +08:00
|
|
|
import { reactive } from 'vue'
|
|
|
|
import { required } from '@/utils/formRules'
|
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
|
import { DICT_TYPE } from '@/utils/dict'
|
|
|
|
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
|
|
|
|
// 国际化
|
|
|
|
const { t } = useI18n()
|
|
|
|
// 表单校验
|
|
|
|
export const rules = reactive({
|
2022-07-20 13:04:37 +08:00
|
|
|
nickname: [required],
|
2022-07-18 19:06:37 +08:00
|
|
|
status: [required]
|
|
|
|
})
|
|
|
|
// crudSchemas
|
|
|
|
const crudSchemas = reactive<CrudSchema[]>([
|
|
|
|
{
|
|
|
|
label: t('common.index'),
|
|
|
|
field: 'id',
|
|
|
|
type: 'index',
|
|
|
|
form: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
detail: {
|
|
|
|
show: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '用户账号',
|
|
|
|
field: 'username',
|
2022-07-20 13:04:37 +08:00
|
|
|
form: {
|
|
|
|
show: false
|
|
|
|
},
|
2022-07-18 19:06:37 +08:00
|
|
|
search: {
|
|
|
|
show: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '用户昵称',
|
|
|
|
field: 'nickname'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '用户邮箱',
|
|
|
|
field: 'email'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '手机号码',
|
|
|
|
field: 'mobile',
|
|
|
|
search: {
|
|
|
|
show: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '用户性别',
|
|
|
|
field: 'sex',
|
|
|
|
dictType: DICT_TYPE.SYSTEM_USER_SEX
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '部门',
|
|
|
|
field: 'deptId',
|
|
|
|
table: {
|
|
|
|
show: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '岗位',
|
|
|
|
field: 'postIds',
|
|
|
|
table: {
|
|
|
|
show: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: t('common.status'),
|
|
|
|
field: 'status',
|
|
|
|
dictType: DICT_TYPE.COMMON_STATUS,
|
|
|
|
search: {
|
|
|
|
show: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '最后登录时间',
|
|
|
|
field: 'loginDate',
|
|
|
|
form: {
|
|
|
|
show: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '最后登录IP',
|
|
|
|
field: 'loginIp',
|
|
|
|
table: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
form: {
|
|
|
|
show: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: t('form.remark'),
|
|
|
|
field: 'remark',
|
|
|
|
table: {
|
|
|
|
show: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: t('common.createTime'),
|
2022-07-21 15:07:04 +08:00
|
|
|
field: 'createTime',
|
2022-07-18 19:06:37 +08:00
|
|
|
table: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
form: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
detail: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
search: {
|
|
|
|
show: true,
|
|
|
|
component: 'DatePicker',
|
|
|
|
componentProps: {
|
2022-07-25 22:54:12 +08:00
|
|
|
type: 'datetimerange',
|
2022-07-25 21:47:22 +08:00
|
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'action',
|
2022-07-19 22:33:54 +08:00
|
|
|
width: '340px',
|
2022-07-18 19:06:37 +08:00
|
|
|
label: t('table.action'),
|
|
|
|
form: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
detail: {
|
|
|
|
show: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
])
|
|
|
|
export const { allSchemas } = useCrudSchemas(crudSchemas)
|