diff --git a/apps/web-antd/src/api/system/menu/index.ts b/apps/web-antd/src/api/system/menu/index.ts new file mode 100644 index 00000000..da4ffcdd --- /dev/null +++ b/apps/web-antd/src/api/system/menu/index.ts @@ -0,0 +1,49 @@ +import { requestClient } from '#/api/request'; + +export interface MenuVO { + id: number; + name: string; + permission: string; + type: number; + sort: number; + parentId: number; + path: string; + icon: string; + component: string; + componentName?: string; + status: number; + visible: boolean; + keepAlive: boolean; + alwaysShow?: boolean; + createTime: Date; +} + +// 查询菜单(精简)列表 +export function getSimpleMenusList() { + return requestClient.get('/system/menu/simple-list'); +} + +// 查询菜单列表 +export function getMenuList(params: any) { + return requestClient.get('/system/menu/list', params); +} + +// 获取菜单详情 +export function getMenu(id: number) { + return requestClient.get(`/system/menu/get?id=${id}`); +} + +// 新增菜单 +export function createMenu(data: MenuVO) { + return requestClient.post('/system/menu/create', data); +} + +// 修改菜单 +export function updateMenu(data: MenuVO) { + return requestClient.put('/system/menu/update', data); +} + +// 删除菜单 +export function deleteMenu(id: number) { + return requestClient.delete(`/system/menu/delete?id=${id}`); +} diff --git a/apps/web-antd/src/views/system/menu/MenuModal.vue b/apps/web-antd/src/views/system/menu/MenuModal.vue new file mode 100644 index 00000000..506961fd --- /dev/null +++ b/apps/web-antd/src/views/system/menu/MenuModal.vue @@ -0,0 +1,54 @@ + + diff --git a/apps/web-antd/src/views/system/menu/index.vue b/apps/web-antd/src/views/system/menu/index.vue new file mode 100644 index 00000000..6340b722 --- /dev/null +++ b/apps/web-antd/src/views/system/menu/index.vue @@ -0,0 +1,122 @@ + + + diff --git a/apps/web-antd/src/views/system/menu/menu.data.ts b/apps/web-antd/src/views/system/menu/menu.data.ts new file mode 100644 index 00000000..50db6655 --- /dev/null +++ b/apps/web-antd/src/views/system/menu/menu.data.ts @@ -0,0 +1,73 @@ +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { $t } from '@vben/locales'; + +import { type VbenFormSchema } from '#/adapter/form'; + +export const formSchema: VbenFormSchema[] = [ + { + component: 'Input', + fieldName: 'name', + label: '菜单名称', + }, + { + component: 'Input', + fieldName: 'code', + label: '岗位编码', + }, + // TODO: dict + { + component: 'Select', + componentProps: { + allowClear: true, + options: [ + { + label: 'Color1', + value: '1', + }, + { + label: 'Color2', + value: '2', + }, + ], + placeholder: '请选择', + }, + fieldName: 'status', + label: '状态', + }, +]; + +export const columns: VxeGridProps['columns'] = [ + // { title: '序号', type: 'seq', width: 50 }, + // { field: 'id', title: '岗位编号' }, + { field: 'name', title: '菜单名称', minWidth: 200, treeNode: true }, + { field: 'icon', title: '图标' }, + { field: 'permission', title: '权限标识' }, + { field: 'component', title: '组件路径' }, + { field: 'componentName', title: '组件名称' }, + { + field: 'status', + title: '状态', + cellRender: { name: 'CellDict', props: { type: 'common_status' } }, + }, + { field: 'createTime', formatter: 'formatDateTime', title: '创建时间' }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: $t('page.action.action'), + width: 160, + }, +]; + +export const modalSchema: VbenFormSchema[] = [ + { + component: 'Input', + fieldName: 'id', + label: 'id', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, +];