mirror of
https://github.com/PlayEdu/backend
synced 2025-07-19 09:59:38 +08:00
新增LDAP的组织架构一键同步
This commit is contained in:
parent
5d5dc4dde6
commit
36ab0200a0
@ -54,3 +54,7 @@ export function dropDiffClass(id: number, parent_id: number, ids: number[]) {
|
||||
export function checkDestroy(id: number) {
|
||||
return client.get(`/backend/v1/department/${id}/destroy`, {});
|
||||
}
|
||||
|
||||
export function ldapSync() {
|
||||
return client.post(`/backend/v1/department/ldap-sync`, {});
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ const DepartmentPage = () => {
|
||||
const [updateVisible, setUpdateVisible] = useState(false);
|
||||
const [did, setDid] = useState<number>(0);
|
||||
const [modal, contextHolder] = Modal.useModal();
|
||||
|
||||
// 是否启用LDAP
|
||||
const ldapEnabled = useSelector(
|
||||
(state: any) => state.systemConfig.value["ldap-enabled"]
|
||||
);
|
||||
@ -389,9 +391,22 @@ const DepartmentPage = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const ldapSync = () => {
|
||||
if (loading) {
|
||||
message.warning("正在同步,请稍后...");
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
department.ldapSync().then(() => {
|
||||
message.success("操作成功");
|
||||
setLoading(false);
|
||||
resetData();
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{!ldapEnabled && (
|
||||
{
|
||||
<div className="playedu-main-top mb-24">
|
||||
{contextHolder}
|
||||
<div className="d-flex">
|
||||
@ -404,9 +419,21 @@ const DepartmentPage = () => {
|
||||
onClick={() => setCreateVisible(true)}
|
||||
disabled={null}
|
||||
/>
|
||||
|
||||
{ldapEnabled ? (
|
||||
<PerButton
|
||||
type="primary"
|
||||
text="一键同步LDAP部门架构"
|
||||
class="mr-16"
|
||||
icon={null}
|
||||
p="department-cud"
|
||||
onClick={() => ldapSync()}
|
||||
disabled={null}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
}
|
||||
<div className="playedu-main-body">
|
||||
{loading && (
|
||||
<div className="float-left text-center mt-30">
|
||||
|
Loading…
x
Reference in New Issue
Block a user