Skip to content

Commit 4367781

Browse files
committed
feat: update
1 parent 6a1b1bd commit 4367781

File tree

4 files changed

+54
-37
lines changed

4 files changed

+54
-37
lines changed

src/api/system.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
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-
173
type Result = {
184
success: boolean;
195
data?: Array<any>;
@@ -97,22 +83,3 @@ export const getRoleMenu = (data?: object) => {
9783
export const getRoleMenuIds = (data?: object) => {
9884
return http.request<Result>("post", "/role-menu-ids", { data });
9985
};
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/api/tableExample.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { http } from "@/utils/http";
2+
3+
type ResultTable = {
4+
success: boolean;
5+
data?: {
6+
/** 列表数据 */
7+
list: Array<any>;
8+
/** 总条目数 */
9+
total?: number;
10+
/** 每页显示条目个数 */
11+
pageSize?: number;
12+
/** 当前页数 */
13+
currentPage?: number;
14+
};
15+
};
16+
17+
type postArrayResult = {
18+
ret: number;
19+
msg: string;
20+
success?: boolean;
21+
data?: Array<any>;
22+
};
23+
24+
type postResult = {
25+
ret: number;
26+
msg: string;
27+
success?: boolean;
28+
data?: any;
29+
};
30+
31+
32+
/** 获取角色管理列表 */
33+
export const getRoleList = (params?: object) => {
34+
// return http.request<ResultTable>("post", "/role", { data });
35+
return http.request<ResultTable>("get", "/api/roles/", { params });
36+
};
37+
38+
export const getRoleColumns = () => {
39+
// return http.request<ResultTable>("post", "/role", { data });
40+
return http.request<postArrayResult>("options", "/api/roles/", {});
41+
};
42+
43+
/** 修改角色 */
44+
export const updateRole = (id: number, data?: object) => {
45+
// return http.request<Result>("get", apiUrl("rbac/menus/"));
46+
return http.request<postResult>("patch", `api/roles/${id}/`, {
47+
data
48+
});
49+
};

src/views/table-custom/hook.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ref } from "vue";
22

3-
import { getRoleList2 as getRoleList, updateRole } from "@/api/system";
3+
import { getRoleList, updateRole } from "@/api/tableExample";
44
// import { useUserStoreHook } from "@/store/modules/user";
55
import { onStatusChange, usePublicHooks } from "@/utils/common";
66
import { useTableBase } from "@/utils/tableHook";

src/views/table-custom/index.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<script setup lang="ts">
2-
import { reactive } from "vue";
2+
// import { reactive } from "vue";
33
import { CusTable } from "@/components/CusTable";
44
import { CusTableBar } from "@/components/CusTableBar";
5-
import { PaginationProps } from "@pureadmin/table";
5+
// import { PaginationProps } from "@pureadmin/table";
66
import { useTable } from "./hook";
7-
import { getRoleColumns } from "@/api/system";
7+
import { getRoleColumns } from "@/api/tableExample";
88
99
defineOptions({
1010
name: "TableCustom"
1111
});
1212
13+
// 自定义分页信息
1314
// const pagination = reactive<PaginationProps>({
1415
// total: 0,
1516
// pageSize: 10,

0 commit comments

Comments
 (0)