fix: 解决角色管理的分页控件bug

This commit is contained in:
Hzm 2025-09-26 12:03:57 +08:00
parent 03d8520364
commit c5615d6e44
2 changed files with 22 additions and 2 deletions

View File

@ -28,7 +28,9 @@ const {
resetForm,
menuTree,
getMenuTree,
handleDelete
handleDelete,
handleSizeChange,
handleCurrentChange
} = useRole();
const opType = ref<"add" | "update">("add");
@ -50,6 +52,11 @@ async function openDialog(type: "add" | "update", row?: RoleDTO) {
opRow.value = row;
modalVisible.value = true;
}
function handleSelectionChange(selection) {
//
console.log("selection changed:", selection);
}
</script>
<template>
<div class="main">

View File

@ -13,6 +13,7 @@ import { usePublicHooks } from "../../hooks";
import { type PaginationProps } from "@pureadmin/table";
import { onMounted, reactive, ref, toRaw } from "vue";
import { toTree } from "@/utils/tree";
import { CommonUtils } from "@/utils/common";
export function useRole() {
const form = reactive<RoleQuery>({
@ -168,6 +169,8 @@ export function useRole() {
async function onSearch() {
try {
loading.value = true;
// 填充分页参数
CommonUtils.fillPaginationParams(form, pagination);
const { rows, total } = await getRoleListApi(toRaw(form));
console.log("role list", rows);
dataList.value = rows;
@ -180,6 +183,14 @@ export function useRole() {
}
}
function handleSizeChange() {
onSearch();
}
function handleCurrentChange() {
onSearch();
}
const resetForm = formEl => {
if (!formEl) return;
formEl.resetFields();
@ -214,6 +225,8 @@ export function useRole() {
resetForm,
menuTree,
getMenuTree,
handleDelete
handleDelete,
handleSizeChange,
handleCurrentChange
};
}