fix: 菜单隐藏功能优化

This commit is contained in:
zhoujunhong 2024-10-15 13:42:00 +08:00
parent acf94b052b
commit 0e155e719a
2 changed files with 16 additions and 2 deletions

View file

@ -130,6 +130,13 @@ function getCheckedLabels(json: Node): string[] {
const search = async () => {
const res = await getSettingInfo();
const json: Node = JSON.parse(res.data.xpackHideMenu);
if (json.isCheck === false) {
json.children.forEach((child: any) => {
if (child.isCheck === true) {
child.isCheck = false;
}
});
}
const checkedLabels = getCheckedLabels(json);
let rstMenuList: RouteRecordRaw[] = [];
menuStore.menuList.forEach((item) => {

View file

@ -264,8 +264,6 @@ const search = async () => {
form.complexityVerification = res.data.complexityVerification;
form.defaultNetwork = res.data.defaultNetwork;
form.defaultNetworkVal = res.data.defaultNetwork === 'all' ? i18n.t('commons.table.all') : res.data.defaultNetwork;
form.proHideMenus = res.data.xpackHideMenu;
form.hideMenuList = res.data.xpackHideMenu;
form.developerMode = res.data.developerMode;
form.proxyUrl = res.data.proxyUrl;
@ -277,6 +275,15 @@ const search = async () => {
form.proxyPasswdKeep = res.data.proxyPasswdKeep;
const json: Node = JSON.parse(res.data.xpackHideMenu);
if (json.isCheck === false) {
json.children.forEach((child: any) => {
if (child.isCheck === true) {
child.isCheck = false;
}
});
}
form.proHideMenus = JSON.stringify(json);
form.hideMenuList = JSON.stringify(json);
const checkedTitles = getCheckedTitles(json);
form.proHideMenus = checkedTitles.toString();