2022-11-17 22:55:09 +08:00
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
|
import { required } from '@/utils/formRules'
|
|
|
|
import { DICT_TYPE } from '@/utils/dict'
|
|
|
|
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
|
|
|
|
const { t } = useI18n() // 国际化
|
2022-10-11 16:02:28 +08:00
|
|
|
|
2022-08-02 10:19:02 +08:00
|
|
|
// 表单校验
|
|
|
|
export const rules = reactive({
|
|
|
|
name: [required],
|
|
|
|
sort: [required],
|
|
|
|
email: [required],
|
|
|
|
phone: [
|
|
|
|
{
|
2022-12-14 17:51:23 +08:00
|
|
|
len: 11,
|
2022-08-02 10:19:02 +08:00
|
|
|
trigger: 'blur',
|
|
|
|
message: '请输入正确的手机号码'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
2022-07-18 19:06:37 +08:00
|
|
|
|
2022-11-17 22:55:09 +08:00
|
|
|
// CrudSchema
|
|
|
|
const crudSchemas = reactive<VxeCrudSchema>({
|
|
|
|
primaryKey: 'id',
|
|
|
|
primaryType: null,
|
|
|
|
action: true,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
title: '上级部门',
|
|
|
|
field: 'parentId',
|
|
|
|
isTable: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '部门名称',
|
|
|
|
field: 'name',
|
|
|
|
isSearch: true,
|
|
|
|
table: {
|
|
|
|
treeNode: true,
|
|
|
|
align: 'left'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '负责人',
|
2022-11-17 23:05:39 +08:00
|
|
|
field: 'leaderUserId',
|
|
|
|
table: {
|
|
|
|
slots: {
|
|
|
|
default: 'leaderUserId_default'
|
|
|
|
}
|
|
|
|
}
|
2022-11-17 22:55:09 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '联系电话',
|
|
|
|
field: 'phone'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '邮箱',
|
2022-11-29 22:26:50 +08:00
|
|
|
field: 'email',
|
|
|
|
isTable: false
|
2022-11-17 22:55:09 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '显示排序',
|
|
|
|
field: 'sort'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: t('common.status'),
|
|
|
|
field: 'status',
|
|
|
|
dictType: DICT_TYPE.COMMON_STATUS,
|
2022-11-17 23:09:29 +08:00
|
|
|
dictClass: 'number',
|
2022-11-17 22:55:09 +08:00
|
|
|
isSearch: true
|
2022-11-29 22:26:50 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: t('common.createTime'),
|
|
|
|
field: 'createTime',
|
|
|
|
formatter: 'formatDate',
|
|
|
|
isForm: false
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
2022-11-17 22:55:09 +08:00
|
|
|
]
|
|
|
|
})
|
|
|
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|