feat: 部门管理
This commit is contained in:
99
apps/web-antd/src/views/system/dept/data.ts
Normal file
99
apps/web-antd/src/views/system/dept/data.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
import { DictEnum } from '@vben/constants';
|
||||
import { getPopupContainer } from '@vben/utils';
|
||||
|
||||
import { type FormSchemaGetter, z } from '#/adapter';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
|
||||
export const drawerSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
fieldName: 'deptId',
|
||||
},
|
||||
{
|
||||
component: 'TreeSelect',
|
||||
componentProps: {
|
||||
getPopupContainer,
|
||||
placeholder: '请选择',
|
||||
},
|
||||
dependencies: {
|
||||
show: (model) => model.parentId !== 0,
|
||||
triggerFields: ['parentId'],
|
||||
},
|
||||
fieldName: 'parentId',
|
||||
label: '上级部门',
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入',
|
||||
},
|
||||
fieldName: 'deptName',
|
||||
label: '部门名称',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '请输入',
|
||||
},
|
||||
fieldName: 'orderNum',
|
||||
label: '显示排序',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入',
|
||||
},
|
||||
fieldName: 'deptCategory',
|
||||
label: '类别编码',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
// 选中了就只能修改 不能重置为无负责人
|
||||
allowClear: false,
|
||||
getPopupContainer,
|
||||
placeholder: '请选择',
|
||||
},
|
||||
fieldName: 'leader',
|
||||
label: '负责人',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入',
|
||||
},
|
||||
fieldName: 'phone',
|
||||
label: '联系电话',
|
||||
rules: z
|
||||
.string()
|
||||
.regex(/^\d{1,3}-\d{8,11}$/, { message: '请输入正确的手机号' })
|
||||
.optional(),
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入',
|
||||
},
|
||||
fieldName: 'email',
|
||||
label: '邮箱',
|
||||
rules: z.string().email({ message: '请输入正确的邮箱' }).optional(),
|
||||
},
|
||||
{
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
buttonStyle: 'solid',
|
||||
options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE),
|
||||
optionType: 'button',
|
||||
},
|
||||
defaultValue: '0',
|
||||
fieldName: 'status',
|
||||
label: '状态',
|
||||
},
|
||||
];
|
Reference in New Issue
Block a user