diff --git a/src/compenents/tree-adminroles/index.tsx b/src/compenents/tree-adminroles/index.tsx index 237790b..67d0b90 100644 --- a/src/compenents/tree-adminroles/index.tsx +++ b/src/compenents/tree-adminroles/index.tsx @@ -34,6 +34,7 @@ export const TreeAdminroles = (props: PropInterface) => { } setTreeData(new_arr); } + onSelect([], ""); }); }, [props.refresh]); const onSelect = (selectedKeys: any, info: any) => { diff --git a/src/index.less b/src/index.less index 6d96318..ea65551 100644 --- a/src/index.less +++ b/src/index.less @@ -450,6 +450,12 @@ textarea.ant-input { background-color: #fff2f0 !important; border-radius: 6px !important; 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 { width: 100% !important; diff --git a/src/pages/system/administrator/index.tsx b/src/pages/system/administrator/index.tsx index d89b012..d84573a 100644 --- a/src/pages/system/administrator/index.tsx +++ b/src/pages/system/administrator/index.tsx @@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react"; import { Typography, Input, Button, Space, Table, Modal, message } from "antd"; import type { ColumnsType } from "antd/es/table"; import { PlusOutlined, ExclamationCircleFilled } from "@ant-design/icons"; -import { adminUser } from "../../../api/index"; +import { adminUser, adminRole } from "../../../api/index"; import { dateFormat } from "../../../utils/index"; import { useNavigate } from "react-router-dom"; import { TreeAdminroles, PerButton } from "../../../compenents"; @@ -180,6 +180,29 @@ const SystemAdministratorPage = () => { }); }; + const delAdminRole = () => { + if (role_ids.length === 0) { + return; + } + confirm({ + title: "操作确认", + icon: , + content: "删除此角色会同时删除管理员对应关联权限,确认删除?", + centered: true, + okText: "确认", + cancelText: "取消", + onOk() { + adminRole.destroyAdminRole(role_ids[0]).then((res: any) => { + message.success("操作成功"); + setRefresh(!refresh); + }); + }, + onCancel() { + console.log("Cancel"); + }, + }); + }; + return ( <>
@@ -200,26 +223,52 @@ const SystemAdministratorPage = () => {
+ } + p="admin-user-cud" + onClick={() => setCreateVisible(true)} + disabled={null} + /> {role_ids.length === 0 && ( } + icon={null} class="mr-16" - type="primary" + type="default" p="admin-role" onClick={() => setCreateRoleVisible(true)} disabled={null} /> )} - setCreateVisible(true)} - disabled={null} - /> + {role_ids.length > 0 && ( + <> + { + setUpdateRoleVisible(true); + }} + disabled={null} + /> + { + delAdminRole(); + }} + disabled={null} + /> + + )}
@@ -246,19 +295,6 @@ const SystemAdministratorPage = () => { > 查 询 - {role_ids.length > 0 && ( - { - setUpdateRoleVisible(true); - }} - disabled={null} - /> - )}
diff --git a/src/pages/system/adminroles/compenents/create.tsx b/src/pages/system/adminroles/compenents/create.tsx index 9e5bbf9..3ac0d62 100644 --- a/src/pages/system/adminroles/compenents/create.tsx +++ b/src/pages/system/adminroles/compenents/create.tsx @@ -177,6 +177,7 @@ export const SystemAdminrolesCreate: React.FC = ({ = ({ = ({ = ({