新增LDAP的组织架构一键同步

This commit is contained in:
xxx 2023-09-21 10:12:18 +08:00
parent 5d5dc4dde6
commit 36ab0200a0
2 changed files with 33 additions and 2 deletions

View File

@ -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`, {});
}

View File

@ -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">