mirror of
https://github.com/PlayEdu/backend
synced 2025-07-24 06:39:39 +08:00
管理人员角色删除功能以及选择权限弹窗样式优化
This commit is contained in:
parent
b2d6b4af75
commit
81e925794b
@ -34,6 +34,7 @@ export const TreeAdminroles = (props: PropInterface) => {
|
|||||||
}
|
}
|
||||||
setTreeData(new_arr);
|
setTreeData(new_arr);
|
||||||
}
|
}
|
||||||
|
onSelect([], "");
|
||||||
});
|
});
|
||||||
}, [props.refresh]);
|
}, [props.refresh]);
|
||||||
const onSelect = (selectedKeys: any, info: any) => {
|
const onSelect = (selectedKeys: any, info: any) => {
|
||||||
|
@ -450,6 +450,12 @@ textarea.ant-input {
|
|||||||
background-color: #fff2f0 !important;
|
background-color: #fff2f0 !important;
|
||||||
border-radius: 6px !important;
|
border-radius: 6px !important;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
.ant-tree-node-content-wrapper {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
.ant-tree-node-content-wrapper-normal {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.ant-tree-node-content-wrapper {
|
.ant-tree-node-content-wrapper {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
|
@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
|
|||||||
import { Typography, Input, Button, Space, Table, Modal, message } from "antd";
|
import { Typography, Input, Button, Space, Table, Modal, message } from "antd";
|
||||||
import type { ColumnsType } from "antd/es/table";
|
import type { ColumnsType } from "antd/es/table";
|
||||||
import { PlusOutlined, ExclamationCircleFilled } from "@ant-design/icons";
|
import { PlusOutlined, ExclamationCircleFilled } from "@ant-design/icons";
|
||||||
import { adminUser } from "../../../api/index";
|
import { adminUser, adminRole } from "../../../api/index";
|
||||||
import { dateFormat } from "../../../utils/index";
|
import { dateFormat } from "../../../utils/index";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { TreeAdminroles, PerButton } from "../../../compenents";
|
import { TreeAdminroles, PerButton } from "../../../compenents";
|
||||||
@ -180,6 +180,29 @@ const SystemAdministratorPage = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const delAdminRole = () => {
|
||||||
|
if (role_ids.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
confirm({
|
||||||
|
title: "操作确认",
|
||||||
|
icon: <ExclamationCircleFilled />,
|
||||||
|
content: "删除此角色会同时删除管理员对应关联权限,确认删除?",
|
||||||
|
centered: true,
|
||||||
|
okText: "确认",
|
||||||
|
cancelText: "取消",
|
||||||
|
onOk() {
|
||||||
|
adminRole.destroyAdminRole(role_ids[0]).then((res: any) => {
|
||||||
|
message.success("操作成功");
|
||||||
|
setRefresh(!refresh);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
console.log("Cancel");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="tree-main-body">
|
<div className="tree-main-body">
|
||||||
@ -200,26 +223,52 @@ const SystemAdministratorPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="float-left j-b-flex mb-24">
|
<div className="float-left j-b-flex mb-24">
|
||||||
<div className="d-flex">
|
<div className="d-flex">
|
||||||
|
<PerButton
|
||||||
|
type="primary"
|
||||||
|
text="添加管理员"
|
||||||
|
class="mr-16"
|
||||||
|
icon={<PlusOutlined />}
|
||||||
|
p="admin-user-cud"
|
||||||
|
onClick={() => setCreateVisible(true)}
|
||||||
|
disabled={null}
|
||||||
|
/>
|
||||||
{role_ids.length === 0 && (
|
{role_ids.length === 0 && (
|
||||||
<PerButton
|
<PerButton
|
||||||
text="新建角色"
|
text="新建角色"
|
||||||
icon={<PlusOutlined />}
|
icon={null}
|
||||||
class="mr-16"
|
class="mr-16"
|
||||||
type="primary"
|
type="default"
|
||||||
p="admin-role"
|
p="admin-role"
|
||||||
onClick={() => setCreateRoleVisible(true)}
|
onClick={() => setCreateRoleVisible(true)}
|
||||||
disabled={null}
|
disabled={null}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<PerButton
|
{role_ids.length > 0 && (
|
||||||
type="default"
|
<>
|
||||||
text="添加管理员"
|
<PerButton
|
||||||
class="mr-16"
|
text="角色权限"
|
||||||
icon={null}
|
icon={null}
|
||||||
p="admin-user-cud"
|
class="ml-16"
|
||||||
onClick={() => setCreateVisible(true)}
|
type="default"
|
||||||
disabled={null}
|
p="admin-role"
|
||||||
/>
|
onClick={() => {
|
||||||
|
setUpdateRoleVisible(true);
|
||||||
|
}}
|
||||||
|
disabled={null}
|
||||||
|
/>
|
||||||
|
<PerButton
|
||||||
|
text="删除角色"
|
||||||
|
icon={null}
|
||||||
|
class="ml-16"
|
||||||
|
type="default"
|
||||||
|
p="admin-role"
|
||||||
|
onClick={() => {
|
||||||
|
delAdminRole();
|
||||||
|
}}
|
||||||
|
disabled={null}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="d-flex">
|
<div className="d-flex">
|
||||||
<div className="d-flex mr-24">
|
<div className="d-flex mr-24">
|
||||||
@ -246,19 +295,6 @@ const SystemAdministratorPage = () => {
|
|||||||
>
|
>
|
||||||
查 询
|
查 询
|
||||||
</Button>
|
</Button>
|
||||||
{role_ids.length > 0 && (
|
|
||||||
<PerButton
|
|
||||||
text="角色权限"
|
|
||||||
icon={null}
|
|
||||||
class="ml-16"
|
|
||||||
type="default"
|
|
||||||
p="admin-role"
|
|
||||||
onClick={() => {
|
|
||||||
setUpdateRoleVisible(true);
|
|
||||||
}}
|
|
||||||
disabled={null}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -177,6 +177,7 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="操作权限" name="action_ids">
|
<Form.Item label="操作权限" name="action_ids">
|
||||||
<TreeSelect
|
<TreeSelect
|
||||||
|
listHeight={600}
|
||||||
style={{ width: 424 }}
|
style={{ width: 424 }}
|
||||||
treeCheckable={true}
|
treeCheckable={true}
|
||||||
placeholder="请选择权限"
|
placeholder="请选择权限"
|
||||||
@ -187,6 +188,7 @@ export const SystemAdminrolesCreate: React.FC<PropInterface> = ({
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="数据权限" name="permission_ids">
|
<Form.Item label="数据权限" name="permission_ids">
|
||||||
<TreeSelect
|
<TreeSelect
|
||||||
|
listHeight={600}
|
||||||
style={{ width: 424 }}
|
style={{ width: 424 }}
|
||||||
treeCheckable={true}
|
treeCheckable={true}
|
||||||
placeholder="请选择权限"
|
placeholder="请选择权限"
|
||||||
|
@ -187,6 +187,7 @@ export const SystemAdminrolesUpdate: React.FC<PropInterface> = ({
|
|||||||
<Form.Item label="操作权限" name="action_ids">
|
<Form.Item label="操作权限" name="action_ids">
|
||||||
<TreeSelect
|
<TreeSelect
|
||||||
style={{ width: 424 }}
|
style={{ width: 424 }}
|
||||||
|
listHeight={600}
|
||||||
treeCheckable={true}
|
treeCheckable={true}
|
||||||
placeholder="请选择权限"
|
placeholder="请选择权限"
|
||||||
multiple
|
multiple
|
||||||
@ -197,6 +198,7 @@ export const SystemAdminrolesUpdate: React.FC<PropInterface> = ({
|
|||||||
<Form.Item label="数据权限" name="permission_ids">
|
<Form.Item label="数据权限" name="permission_ids">
|
||||||
<TreeSelect
|
<TreeSelect
|
||||||
style={{ width: 424 }}
|
style={{ width: 424 }}
|
||||||
|
listHeight={600}
|
||||||
treeCheckable={true}
|
treeCheckable={true}
|
||||||
placeholder="请选择权限"
|
placeholder="请选择权限"
|
||||||
multiple
|
multiple
|
||||||
|
Loading…
x
Reference in New Issue
Block a user