|
|
@@ -1,6 +1,6 @@
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
|
-import { Card, Table, Button, Modal, Form, Input, Space, Tag, message } from 'antd';
|
|
|
+import { Card, Table, Button, Modal, Form, Input, Space, Tag, message, Spin } from 'antd';
|
|
|
import { EditOutlined, DeleteOutlined, PlusOutlined, KeyOutlined } from '@ant-design/icons';
|
|
|
import { roleClient, rolePermissionClient } from '@/client/api';
|
|
|
import PermissionConfigModal from '@/client/admin/components/PermissionConfigModal';
|
|
|
@@ -295,51 +295,51 @@ const Roles: React.FC = () => {
|
|
|
];
|
|
|
|
|
|
return (
|
|
|
- <div className="p-6">
|
|
|
- <Spin spinning={rolesLoading}>
|
|
|
- <Card
|
|
|
- title="角色管理"
|
|
|
- extra={
|
|
|
- <Space>
|
|
|
- <Button
|
|
|
- type="primary"
|
|
|
- icon={<PlusOutlined />}
|
|
|
- onClick={handleAdd}
|
|
|
- loading={createRoleMutation.isPending}
|
|
|
- >
|
|
|
- 新建角色
|
|
|
- </Button>
|
|
|
- </Space>
|
|
|
- }
|
|
|
- >
|
|
|
- <div className="mb-4 flex gap-4">
|
|
|
- <Input.Search
|
|
|
- placeholder="搜索角色名称或描述"
|
|
|
- allowClear
|
|
|
- value={searchKeyword}
|
|
|
- onChange={(e) => setSearchKeyword(e.target.value)}
|
|
|
- onSearch={handleSearch}
|
|
|
- style={{ width: 300 }}
|
|
|
+ <div className="p-6">
|
|
|
+ <Spin spinning={rolesLoading}>
|
|
|
+ <Card
|
|
|
+ title="角色管理"
|
|
|
+ extra={
|
|
|
+ <Space>
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ icon={<PlusOutlined />}
|
|
|
+ onClick={handleAdd}
|
|
|
+ loading={createRoleMutation.isPending}
|
|
|
+ >
|
|
|
+ 新建角色
|
|
|
+ </Button>
|
|
|
+ </Space>
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <div className="mb-4 flex gap-4">
|
|
|
+ <Input.Search
|
|
|
+ placeholder="搜索角色名称或描述"
|
|
|
+ allowClear
|
|
|
+ value={searchKeyword}
|
|
|
+ onChange={(e) => setSearchKeyword(e.target.value)}
|
|
|
+ onSearch={handleSearch}
|
|
|
+ style={{ width: 300 }}
|
|
|
+ />
|
|
|
+ <Button onClick={handleReset}>重置</Button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <Table
|
|
|
+ columns={columns}
|
|
|
+ dataSource={roles}
|
|
|
+ rowKey="id"
|
|
|
+ scroll={{ x: 1000 }}
|
|
|
+ pagination={{
|
|
|
+ ...pagination,
|
|
|
+ showSizeChanger: true,
|
|
|
+ showQuickJumper: true,
|
|
|
+ showTotal: (total: number) => `共 ${total} 条记录`,
|
|
|
+ pageSizeOptions: [10, 20, 50, 100],
|
|
|
+ }}
|
|
|
+ onChange={handleTableChange}
|
|
|
/>
|
|
|
- <Button onClick={handleReset}>重置</Button>
|
|
|
- </div>
|
|
|
-
|
|
|
- <Table
|
|
|
- columns={columns}
|
|
|
- dataSource={roles}
|
|
|
- rowKey="id"
|
|
|
- scroll={{ x: 1000 }}
|
|
|
- pagination={{
|
|
|
- ...pagination,
|
|
|
- showSizeChanger: true,
|
|
|
- showQuickJumper: true,
|
|
|
- showTotal: (total: number) => `共 ${total} 条记录`,
|
|
|
- pageSizeOptions: [10, 20, 50, 100],
|
|
|
- }}
|
|
|
- onChange={handleTableChange}
|
|
|
- />
|
|
|
- </Card>
|
|
|
- </Spin>
|
|
|
+ </Card>
|
|
|
+ </Spin>
|
|
|
|
|
|
{/* 角色编辑模态框 */}
|
|
|
<Modal
|