edit
This commit is contained in:
@ -97,29 +97,32 @@ export class MenuManagerComponentsIndexComponent implements OnInit {
|
||||
nzTitle: '<i>删除确认</i>',
|
||||
nzContent: `是否确认删除?`,
|
||||
nzOnOk: () => {
|
||||
this.deleteMenuByAppID(type === 0 ? 'A48F72F0A304427F921794BAD86B3522' : this.envSrv.env.appId);
|
||||
this.getMenuByAppID(type === 0 ? 'A48F72F0A304427F921794BAD86B3522' : this.envSrv.env.appId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
deleteMenuByAppID(appId: string) {
|
||||
getMenuByAppID(appId: string) {
|
||||
this.service.request(this.service.$api_get_one, { appId }, 'POST', false).subscribe(res => {
|
||||
console.log(res);
|
||||
if (res) {
|
||||
const menus = res.data;
|
||||
console.log(this.getIds(res.data));
|
||||
|
||||
if (res.data?.length > 0) {
|
||||
this.deleteMenuByAppID(res.data);
|
||||
} else {
|
||||
this.service.msgSrv.success('菜单已清空');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getIds(arr: Array<any>): Array<string> {
|
||||
let ids: any[] = [];
|
||||
deleteMenuByAppID(arr: Array<any>) {
|
||||
let ids: any[] = arr?.map(item => item.id) || [];
|
||||
arr.forEach(item => {
|
||||
if (item.children?.length > 0) {
|
||||
ids = [...ids, this.getIds(item.children)];
|
||||
this.deleteMenuByAppID(item.children);
|
||||
}
|
||||
});
|
||||
return ids;
|
||||
this.service.request(this.service.$api_del_many, ids).subscribe(res => {});
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ export class MenuManagerService extends BaseService {
|
||||
$api_get_one = `/api/mdc/cuc/functionInfo/getAllFunctionInfoByAppId?_allow_badcode=true`;
|
||||
|
||||
// 删除多个菜单
|
||||
$api_del_many = `/scm/cuc/cuc/functionInfo/deletebatchFunctionInfo`;
|
||||
$api_del_many = `/api/mdc/cuc/functionInfo/deletebatchFunctionInfo`;
|
||||
|
||||
constructor(public injector: Injector) {
|
||||
super(injector);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"data": {
|
||||
"menu": [
|
||||
{
|
||||
"text": "样例",
|
||||
"text": "主导航",
|
||||
"hideInBreadcrumb": true,
|
||||
"children": [
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"menu": [
|
||||
{
|
||||
"text": "样例",
|
||||
"text": "主导航",
|
||||
"hideInBreadcrumb": true,
|
||||
"children": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user