Skip to content

Commit 6a1b1bd

Browse files
committed
feat: 通用表格组件以及示例
1 parent f010e11 commit 6a1b1bd

File tree

15 files changed

+1417
-1
lines changed

15 files changed

+1417
-1
lines changed

mock/asyncRoutes.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,35 @@ import { system, monitor, permission, frame, tabs } from "@/router/enums";
88
* common:普通角色
99
*/
1010

11+
const cusTable = {
12+
pk: 13,
13+
code: "tableCustom",
14+
path: "/table-custom/index",
15+
meta: {
16+
code: "tableCustom",
17+
icon: "ep:expand",
18+
rank: 2,
19+
title: "列表Demo",
20+
showLink: true,
21+
keepAlive: true
22+
},
23+
children: [
24+
{
25+
path: "/table-custom/index",
26+
component: "",
27+
name: "TableCustom",
28+
meta: {
29+
code: "tableCustom",
30+
icon: "ep:expand",
31+
rank: 2,
32+
title: "列表Demo",
33+
showLink: true,
34+
keepAlive: true
35+
}
36+
}
37+
]
38+
}
39+
1140
const systemManagementRouter = {
1241
path: "/system",
1342
meta: {
@@ -328,6 +357,7 @@ export default defineFakeRoute([
328357
return {
329358
success: true,
330359
data: [
360+
cusTable,
331361
systemManagementRouter,
332362
systemMonitorRouter,
333363
permissionRouter,

src/api/system.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
import { http } from "@/utils/http";
22

3+
type postArrayResult = {
4+
ret: number;
5+
msg: string;
6+
success?: boolean;
7+
data?: Array<any>;
8+
};
9+
10+
type postResult = {
11+
ret: number;
12+
msg: string;
13+
success?: boolean;
14+
data?: any;
15+
};
16+
317
type Result = {
418
success: boolean;
519
data?: Array<any>;
@@ -83,3 +97,22 @@ export const getRoleMenu = (data?: object) => {
8397
export const getRoleMenuIds = (data?: object) => {
8498
return http.request<Result>("post", "/role-menu-ids", { data });
8599
};
100+
101+
/** 获取角色管理列表 */
102+
export const getRoleList2 = (params?: object) => {
103+
// return http.request<ResultTable>("post", "/role", { data });
104+
return http.request<ResultTable>("get", "/api/roles/", { params });
105+
};
106+
107+
export const getRoleColumns = () => {
108+
// return http.request<ResultTable>("post", "/role", { data });
109+
return http.request<postArrayResult>("options", "/api/roles/", {});
110+
};
111+
112+
/** 修改角色 */
113+
export const updateRole = (id: number, data?: object) => {
114+
// return http.request<Result>("get", apiUrl("rbac/menus/"));
115+
return http.request<postResult>("patch", `api/roles/${id}/`, {
116+
data
117+
});
118+
};

src/assets/table-bar/search.svg

Lines changed: 3 additions & 0 deletions
Loading

src/components/CusTable/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import cusTable from "./src/index";
2+
import { withInstall } from "@pureadmin/utils";
3+
4+
/** 配合 `@pureadmin/table` 实现快速便捷的表格操作 https://github.com/pure-admin/pure-admin-table */
5+
export const CusTable = withInstall(cusTable);

0 commit comments

Comments
 (0)