diff --git a/src/api/feishu.ts b/src/api/feishu.ts index e11c9ea..fd8ca8b 100644 --- a/src/api/feishu.ts +++ b/src/api/feishu.ts @@ -51,3 +51,12 @@ export const getFeishuUserInfo = () => { message: string; }>("get", "/api/v1/auth/feishu/user/info"); }; + +/** 同步飞书用户 */ +export const syncFeishuUsers = () => { + return http.request<{ + code: number; + data: Record; + message: string; + }>("post", "/api/v1/feishu/sync/users"); +}; diff --git a/src/views/system/permission/utils/hook.tsx b/src/views/system/permission/utils/hook.tsx index 17c2c60..d72d419 100644 --- a/src/views/system/permission/utils/hook.tsx +++ b/src/views/system/permission/utils/hook.tsx @@ -4,7 +4,7 @@ import { addDialog } from "@/components/ReDialog"; import type { PaginationProps } from "@pureadmin/table"; import type { FormItemProps } from "./types"; import editForm from "../form/index.vue"; -import { getPermissionTree } from "@/api/system"; +import { getPermissionList } from "@/api/system"; import { type Ref, h, ref, computed, reactive, onMounted } from "vue"; import { getKeyList, deviceDetection } from "@pureadmin/utils"; import { ElMessageBox } from "element-plus"; @@ -161,11 +161,13 @@ export function usePermission(tableRef: Ref) { } function handleSizeChange(val: number) { - console.log(`${val} items per page`); + pagination.pageSize = val; + onSearch(); } function handleCurrentChange(val: number) { - console.log(`current page: ${val}`); + pagination.currentPage = val; + onSearch(); } function handleSelectionChange(val) { @@ -190,10 +192,16 @@ export function usePermission(tableRef: Ref) { async function onSearch() { loading.value = true; try { - const { code, data } = await getPermissionTree(); + const { code, data } = await getPermissionList({ + pageNum: pagination.currentPage, + pageSize: pagination.pageSize, + keyword: form.permissionName || form.permissionCode || undefined + }); if (code === 200) { - dataList.value = data || []; - pagination.total = data?.length || 0; + dataList.value = data?.records || []; + pagination.total = data?.total || 0; + pagination.pageSize = data?.size || 10; + pagination.currentPage = data?.current || 1; } } catch (error) { console.error(error); diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 46a43f6..e43fd21 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -11,7 +11,7 @@ import More from "~icons/ep/more-filled"; import Delete from "~icons/ep/delete"; import EditPen from "~icons/ep/edit-pen"; import Refresh from "~icons/ep/refresh"; -import AddFill from "~icons/ri/add-circle-line"; +import Sync from "~icons/ri/refresh-line"; defineOptions({ name: "SystemUser" @@ -41,7 +41,9 @@ const { handleSizeChange, onSelectionCancel, handleCurrentChange, - handleSelectionChange + handleSelectionChange, + syncLoading, + handleSyncFeishuUsers } = useUser(tableRef); @@ -103,10 +105,11 @@ const {