+
+ 确定要删除角色
+ {record.roleName}
+ 吗?
+
+
删除后该角色下的用户将失去对应的权限,请谨慎操作。
+
+ ),
+ okText: '确认',
+ cancelText: '取消',
+ okButtonProps: { danger: true } as ModalProps['okButtonProps'],
+ onOk: () => onOk(record),
+ });
+}
/**
* 角色权限
@@ -6,9 +78,126 @@ import { defineComponent } from 'vue';
export default defineComponent({
name: 'SystemRoles',
setup() {
+ const {
+ filterForm,
+ loading,
+ dataSource,
+ columns,
+ pagination,
+ formVisible,
+ editingRecord,
+ formSubmitting,
+ userListVisible,
+ currentRole,
+ handleSearch,
+ handleReset,
+ handlePageChange,
+ handleAdd,
+ handleEdit,
+ handleCloseForm,
+ handleSave,
+ handleDelete,
+ handleViewUsers,
+ handleCloseUserList,
+ getRoleUsers,
+ renderStatus,
+ } = useRoleModel();
+
+ const { containerRef, height } = useContainerSize({ headerOffset: 55 });
+
+ const triggerDelete = (record: any) => confirmDelete({ record, onOk: handleDelete });
+
+ const tableColumns = [
+ ...columns,
+ {
+ title: '操作',
+ key: 'action',
+ width: 140,
+ fixed: 'right' as const,
+ align: 'center' as const,
+ },
+ ];
+
return () => (
-
角色权限 - 开发中
+ {/* ===== 筛选区 ===== */}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/* ===== 表格区 ===== */}
+
+
+
+ {{
+ bodyCell: (args: any) =>
+ renderBodyCell({
+ ...args,
+ onViewUsers: handleViewUsers,
+ onEdit: handleEdit,
+ onDelete: triggerDelete,
+ }),
+ }}
+
+
+
+ {/* 分页 */}
+
+
+
+ {/* ===== 角色表单弹窗 ===== */}
+
+
+ {/* ===== 角色用户列表弹窗 ===== */}
+
);
},
diff --git a/src/pages/system/roles/model/useRoleModel.ts b/src/pages/system/roles/model/useRoleModel.ts
new file mode 100644
index 0000000..d5ff605
--- /dev/null
+++ b/src/pages/system/roles/model/useRoleModel.ts
@@ -0,0 +1,323 @@
+import { computed, reactive, toRef, Ref, h } from 'vue';
+import { message, Tag } from 'ant-design-vue';
+import { useState, useDebounce, useThrottleFn } from '@/hooks';
+
+// ============================================================
+// 假数据
+// ============================================================
+
+const MOCK_DATA = [
+ {
+ key: '1',
+ roleId: 'R20250601001',
+ roleName: '超级管理员',
+ userCount: 1,
+ createTime: '2025-06-01 09:00:00',
+ },
+ {
+ key: '2',
+ roleId: 'R20250815001',
+ roleName: '运营管理员',
+ userCount: 3,
+ createTime: '2025-08-15 14:30:00',
+ },
+ {
+ key: '3',
+ roleId: 'R20251010001',
+ roleName: '财务',
+ userCount: 2,
+ createTime: '2025-10-10 10:15:00',
+ },
+ {
+ key: '4',
+ roleId: 'R20260120001',
+ roleName: '客服',
+ userCount: 4,
+ createTime: '2026-01-20 16:00:00',
+ },
+];
+
+/** 角色下用户列表 mock */
+const MOCK_USERS: Record