diff --git a/apps/web-antd/src/views/dept/data.ts b/apps/web-antd/src/views/dept/data.ts index a4495ac..a003f57 100644 --- a/apps/web-antd/src/views/dept/data.ts +++ b/apps/web-antd/src/views/dept/data.ts @@ -65,49 +65,43 @@ export function useSchema(): VbenFormSchema[] { }, { component: 'Textarea', - componentProps: { - maxLength: 50, - rows: 3, - showCount: true, - }, fieldName: 'remark', label: '备注', - rules: z.string().optional(), }, ]; } -// export function useGridFormSchema(): VbenFormSchema[] { -// return [ -// { -// component: 'Input', -// fieldName: 'name', -// label: '部门名称', -// }, -// { -// component: 'Select', -// componentProps: { -// allowClear: true, -// options: [ -// { label: $t('common.enabled'), value: true }, -// { label: $t('common.disabled'), value: false }, -// ], -// }, -// fieldName: 'enable', -// label: '状态', -// }, -// // { -// // component: 'Input', -// // fieldName: 'remark', -// // label: '备注', -// // }, -// // { -// // component: 'RangePicker', -// // fieldName: 'createTime', -// // label: '创建时间', -// // }, -// ]; -// } +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'name', + label: '部门名称', + }, + // { + // component: 'Select', + // componentProps: { + // allowClear: true, + // options: [ + // { label: $t('common.enabled'), value: true }, + // { label: $t('common.disabled'), value: false }, + // ], + // }, + // fieldName: 'enable', + // label: '状态', + // }, + // { + // component: 'Input', + // fieldName: 'remark', + // label: '备注', + // }, + // { + // component: 'RangePicker', + // fieldName: 'createTime', + // label: '创建时间', + // }, + ]; +} /** * 获取表格列配置 @@ -158,6 +152,10 @@ export function useColumns( code: 'append', text: '新增下级', }, + { + code: 'auth', + text: '权限', + }, 'edit', // 默认的编辑按钮 { code: 'delete', // 默认的删除按钮 @@ -176,3 +174,23 @@ export function useColumns( }, ]; } + +export function useAuthColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + type: 'checkbox', + width: 100, + }, + { + field: 'name', + title: '名称', + width: 200, + }, + { + field: 'remark', + minWidth: 100, + title: '备注', + }, + ]; +} diff --git a/apps/web-antd/src/views/dept/list.vue b/apps/web-antd/src/views/dept/list.vue index ca3d1d7..4b973dd 100644 --- a/apps/web-antd/src/views/dept/list.vue +++ b/apps/web-antd/src/views/dept/list.vue @@ -15,7 +15,8 @@ import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { getAllDeptTree, removeDept } from '#/api'; import { $t } from '#/locales'; -import { useColumns } from './data'; +import { useColumns, useGridFormSchema } from './data'; +import AuthForm from './modules/auth-form.vue'; import Form from './modules/form.vue'; const [FormModal, formModalApi] = useVbenModal({ @@ -23,6 +24,11 @@ const [FormModal, formModalApi] = useVbenModal({ destroyOnClose: true, }); +const [AuthFormModal, authFormModalApi] = useVbenModal({ + connectedComponent: AuthForm, + destroyOnClose: true, +}); + /** * 编辑部门 * @param row @@ -78,6 +84,10 @@ function onActionClick({ code, row }: OnActionClickParams) { onAppend(row); break; } + case 'auth': { + authFormModalApi.open(); + break; + } case 'delete': { onDelete(row); break; @@ -90,10 +100,10 @@ function onActionClick({ code, row }: OnActionClickParams) { } const [Grid, gridApi] = useVbenVxeGrid({ - // formOptions: { - // fieldMappingTime: [['createTime', ['startTime', 'endTime']]], - // schema: useGridFormSchema(), - // }, + formOptions: { + // fieldMappingTime: [['createTime', ['startTime', 'endTime']]], + schema: useGridFormSchema(), + }, gridEvents: {}, gridOptions: { columns: useColumns(onActionClick), @@ -136,6 +146,7 @@ function refreshGrid() {