98 lines
2.4 KiB
TypeScript
98 lines
2.4 KiB
TypeScript
import type { VxeGridProps } from '#/adapter/vxe-table';
|
|
|
|
import { getMenuList } from '../api';
|
|
|
|
interface RowType {
|
|
id: string;
|
|
nick_name: string;
|
|
email: string;
|
|
avatar: string;
|
|
roles: { name: string }[];
|
|
open_id: string;
|
|
code: string;
|
|
platform_id: string;
|
|
phone: string;
|
|
desc: string;
|
|
created_at: string;
|
|
}
|
|
|
|
export const gridOptions: VxeGridProps<RowType> = {
|
|
checkboxConfig: {
|
|
highlight: true,
|
|
labelField: '',
|
|
},
|
|
columnConfig: {
|
|
useKey: true,
|
|
},
|
|
rowConfig: {
|
|
useKey: true,
|
|
},
|
|
columns: [
|
|
{ type: 'checkbox', width: 60 },
|
|
{ width: 60, treeNode: true },
|
|
{ field: 'id', align: 'left', title: 'ID', width: 100 },
|
|
{ field: 'title', align: 'left', title: '菜单名称' },
|
|
{ field: 'icon', title: '图标', slots: { default: 'icon' } },
|
|
{ field: 'path', title: '路由' },
|
|
{ field: 'name', title: '路由Name' },
|
|
{ field: 'component', title: '组件地址' },
|
|
{ field: 'redirect', title: '重定向' },
|
|
{ field: 'keep_alive', title: '页面缓存' },
|
|
{ field: 'hide_in_menu', title: '菜单展示' },
|
|
{ field: 'badge', title: '徽标' },
|
|
{ field: 'badge_type', title: '徽标类型' },
|
|
{ field: 'badge_variants', title: '徽标颜色' },
|
|
{ field: 'iframe_src', title: '引用的页面地址' },
|
|
{ field: 'sort', title: '排序' },
|
|
{ field: 'query', title: '默认参数' },
|
|
{ field: 'created_at', title: '创建时间' },
|
|
{
|
|
type: 'html',
|
|
align: 'right',
|
|
title: '操作',
|
|
slots: { default: 'action' },
|
|
width: 200,
|
|
},
|
|
],
|
|
treeConfig: {
|
|
parentField: 'pid',
|
|
rowField: 'id',
|
|
transform: true,
|
|
expandAll: true,
|
|
},
|
|
keepSource: true,
|
|
pagerConfig: {},
|
|
proxyConfig: {
|
|
ajax: {
|
|
// 请求后端接口方法
|
|
query: async ({ page }, formValues) => {
|
|
return await getMenuList({
|
|
page: page.currentPage,
|
|
pageSize: page.pageSize,
|
|
...formValues,
|
|
});
|
|
},
|
|
},
|
|
},
|
|
height: 'auto',
|
|
border: false,
|
|
toolbarConfig: {
|
|
// 是否显示搜索表单控制按钮
|
|
// @ts-ignore 正式环境时有完整的类型声明
|
|
search: true,
|
|
refresh: true, // 刷新
|
|
print: false, // 打印
|
|
export: false, // 导出
|
|
// custom: true, // 自定义列
|
|
zoom: true, // 最大化最小化
|
|
slots: {
|
|
buttons: 'toolbar-buttons',
|
|
},
|
|
custom: {
|
|
// 自定义列-图标
|
|
icon: 'vxe-icon-menu',
|
|
},
|
|
},
|
|
showOverflow: false,
|
|
};
|