edit
This commit is contained in:
@ -5,4 +5,10 @@
|
||||
</button>
|
||||
<button nz-button (click)="menuImport(1)" [nzLoading]="service.http.loading">
|
||||
导入运营后台菜单
|
||||
</button>
|
||||
<button nz-button (click)="delMenu(0)" [nzLoading]="service.http.loading">
|
||||
清空货主菜单
|
||||
</button>
|
||||
<button nz-button (click)="delMenu(1)" [nzLoading]="service.http.loading">
|
||||
清空运营后台菜单
|
||||
</button>
|
||||
@ -46,8 +46,6 @@ export class MenuManagerComponentsIndexComponent implements OnInit {
|
||||
|
||||
loadMenus(appId: string) {
|
||||
this.service.request(this.service.$api_get_one, { appId }, 'POST', false).subscribe(res => {
|
||||
console.log(res);
|
||||
|
||||
this.menus = res;
|
||||
});
|
||||
}
|
||||
@ -63,8 +61,6 @@ export class MenuManagerComponentsIndexComponent implements OnInit {
|
||||
}
|
||||
|
||||
this.service.http.request('GET', `assets/mocks/platform/${this.selectedPlatform.enName}.json`).subscribe((res: any) => {
|
||||
console.log(res);
|
||||
|
||||
this.addMenu(res.menu);
|
||||
});
|
||||
}
|
||||
@ -96,24 +92,23 @@ export class MenuManagerComponentsIndexComponent implements OnInit {
|
||||
|
||||
addMenuRecursion() {}
|
||||
|
||||
delMenu(appId: string, menus: Array<Menu>) {
|
||||
if (!menus || menus.length === 0) {
|
||||
return;
|
||||
}
|
||||
let notice = `确认删除菜单[${menus[0].text}]?`;
|
||||
if (menus.length > 1) {
|
||||
notice = `确认删除勾选的${menus.length}行菜单记录?`;
|
||||
}
|
||||
const ids = menus.map(r => r.id);
|
||||
delMenu(type: number) {
|
||||
this.modal.confirm({
|
||||
nzTitle: '<i>删除确认</i>',
|
||||
nzContent: `<b>${notice}</b><br>是否删除?`,
|
||||
nzOnOk: () =>
|
||||
this.service.delMany(ids).subscribe(res => {
|
||||
if (res === true) {
|
||||
this.service.msgSrv.success('删除成功!');
|
||||
}
|
||||
})
|
||||
nzContent: `是否确认删除?`,
|
||||
nzOnOk: () => {
|
||||
this.deleteMenuByAppID(type === 0 ? 'A48F72F0A304427F921794BAD86B3522' : this.envSrv.env.appId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
deleteMenuByAppID(appId: string) {
|
||||
this.service.request(this.service.$api_get_one, { appId }, 'POST', false).subscribe(res => {
|
||||
console.log(res);
|
||||
|
||||
if (res) {
|
||||
this.menus = res;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user