mirror of
https://github.com/PlayEdu/frontend.git
synced 2025-06-08 13:46:23 +08:00
部门切换优化
This commit is contained in:
parent
29e4ab7553
commit
ff5961c277
@ -43,6 +43,7 @@ export const Header: React.FC = () => {
|
|||||||
arr[0].children.push({
|
arr[0].children.push({
|
||||||
key: item.id,
|
key: item.id,
|
||||||
label: item.name,
|
label: item.name,
|
||||||
|
disabled: item.name === currentDepartment,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
setDepartmentsMenu(arr);
|
setDepartmentsMenu(arr);
|
||||||
@ -121,6 +122,23 @@ export const Header: React.FC = () => {
|
|||||||
onOk() {
|
onOk() {
|
||||||
setCurrentDepartment(name);
|
setCurrentDepartment(name);
|
||||||
dispatch(saveCurrentDepId(Number(key)));
|
dispatch(saveCurrentDepId(Number(key)));
|
||||||
|
const box = [...departments];
|
||||||
|
const arr: any = [
|
||||||
|
{
|
||||||
|
key: "1",
|
||||||
|
type: "group",
|
||||||
|
label: "部门",
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
box.map((item: any) => {
|
||||||
|
arr[0].children.push({
|
||||||
|
key: item.id,
|
||||||
|
label: item.name,
|
||||||
|
disabled: item.name === name,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
setDepartmentsMenu(arr);
|
||||||
},
|
},
|
||||||
onCancel() {
|
onCancel() {
|
||||||
console.log("Cancel");
|
console.log("Cancel");
|
||||||
@ -171,7 +189,10 @@ export const Header: React.FC = () => {
|
|||||||
)}
|
)}
|
||||||
{departments.length > 1 && (
|
{departments.length > 1 && (
|
||||||
<Dropdown menu={{ items: depItems, onClick: onDepClick }}>
|
<Dropdown menu={{ items: depItems, onClick: onDepClick }}>
|
||||||
<div className={styles["department-name"]}>
|
<div
|
||||||
|
className={styles["department-name"]}
|
||||||
|
style={{ cursor: "pointer" }}
|
||||||
|
>
|
||||||
{currentDepartment}
|
{currentDepartment}
|
||||||
</div>
|
</div>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user