This commit is contained in:
Taric Xin
2022-04-28 16:21:57 +08:00
parent 1fab74e445
commit 258e930fed
3 changed files with 33 additions and 15 deletions

View File

@ -23,14 +23,15 @@
<nz-card class="content-box"> <nz-card class="content-box">
<nz-tabset [nzTabBarExtraContent]="extraTemplate"> <nz-tabset [nzTabBarExtraContent]="extraTemplate">
<nz-tab nzTitle="货主菜单" (nzClick)="changeMemu(0)"></nz-tab> <nz-tab nzTitle="货主菜单" (nzClick)="changeMemu(0)" *ngIf="isShowFre"></nz-tab>
<nz-tab nzTitle="运营后台菜单" (nzClick)="changeMemu(1)"></nz-tab> <nz-tab nzTitle="运营后台菜单" (nzClick)="changeMemu(1)" *ngIf="isShowBackEND"></nz-tab>
</nz-tabset> </nz-tabset>
<ng-template #extraTemplate> <ng-template #extraTemplate>
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<div> <div>
<button nz-button nzType="primary" (click)="menuAction('新增菜单')">新增</button> <button nz-button nzType="primary" (click)="menuAction('新增菜单')" acl
<button nz-button nzType="primary" (click)="menuSort()">菜单排序</button> [acl-ability]="['MENU-INDEX-add']">新增</button>
<button nz-button nzType="primary" (click)="menuSort()" acl [acl-ability]="['MENU-INDEX-sort']">菜单排序</button>
<!-- <button nz-button nzType="primary" (click)="menuImport(0)" [disabled]="false" <!-- <button nz-button nzType="primary" (click)="menuImport(0)" [disabled]="false"
*ngIf="selectedPlatform.enName==='tms-smc-web'"> *ngIf="selectedPlatform.enName==='tms-smc-web'">
导入货主菜单 导入货主菜单
@ -52,7 +53,7 @@
</ng-template> </ng-template>
</st> --> </st> -->
<nz-table #expandTable [nzData]="listOfMapData" nzTableLayout="fixed" nzBordered nzSize="small" <nz-table #expandTable [nzData]="listOfMapData" nzTableLayout="fixed" nzBordered nzSize="small"
[nzLoading]="service.http.loading"> [nzLoading]="service.http.loading" *ngIf="isShowFre || isShowBackEND">
<thead> <thead>
<tr> <tr>
<!-- <th nzWidth="70px" nzAlign="center">#</th> --> <!-- <th nzWidth="70px" nzAlign="center">#</th> -->
@ -85,12 +86,12 @@
<td nzAlign="center" nzWidth="250px"> <td nzAlign="center" nzWidth="250px">
<a (click)="menuAction('查看菜单',item,item.parentId,true)">查看</a> <a (click)="menuAction('查看菜单',item,item.parentId,true)">查看</a>
<nz-divider nzType="vertical"></nz-divider> <nz-divider nzType="vertical"></nz-divider>
<a (click)="menuAction('编辑菜单',item,item.parentId)">编辑</a> <a (click)="menuAction('编辑菜单',item,item.parentId)" acl [acl-ability]="['MENU-INDEX-edit']">编辑</a>
<nz-divider nzType="vertical"></nz-divider> <nz-divider nzType="vertical"></nz-divider>
<a (click)="deleteAction(item)">删除</a> <a (click)="deleteAction(item)" acl [acl-ability]="['MENU-INDEX-delete']">删除</a>
<ng-container *ngIf="item.level!==3"> <ng-container *ngIf="item.level!==3">
<nz-divider nzType="vertical"></nz-divider> <nz-divider nzType="vertical"></nz-divider>
<a (click)="menuAction('新增菜单',null,item.id)">新增子项</a> <a (click)="menuAction('新增菜单',null,item.id)" acl [acl-ability]="['MENU-INDEX-add']">新增子项</a>
</ng-container> </ng-container>
</td> </td>
</tr> </tr>

View File

@ -1,5 +1,6 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STColumn, STRequestOptions, STChange } from '@delon/abc/st'; import { STComponent, STColumn, STRequestOptions, STChange } from '@delon/abc/st';
import { ACLService } from '@delon/acl';
import { SFComponent, SFSchema } from '@delon/form'; import { SFComponent, SFSchema } from '@delon/form';
import { Menu, ModalHelper } from '@delon/theme'; import { Menu, ModalHelper } from '@delon/theme';
import { EAEnvironmentService } from '@shared'; import { EAEnvironmentService } from '@shared';
@ -37,14 +38,26 @@ export class MenuManagerComponentsIndexComponent implements OnInit {
mapOfExpandedData: { [key: string]: any[] } = {}; mapOfExpandedData: { [key: string]: any[] } = {};
listOfMapData: any[] = []; listOfMapData: any[] = [];
constructor(private envSrv: EAEnvironmentService, public service: MenuManagerService, private modal: NzModalService, private modalHelper: ModalHelper,) {
isShowBackEND = false;
isShowFre = false;
constructor(
private envSrv: EAEnvironmentService,
public service: MenuManagerService,
private modal: NzModalService,
private modalHelper: ModalHelper,
private acl: ACLService
) {
const acls = acl.data.abilities || [];
this.isShowBackEND = acl.data.full || !!acls.find(acl => acl === 'MENU-INDEX-obclist');
this.isShowFre = acl.data.full || !!acls.find(acl => acl === 'MENU-INDEX-smclist');
this.initData(); this.initData();
} }
ngOnInit(): void {} ngOnInit(): void {}
initData(): void { initData(): void {
this.selectedPlatform = this.platforms[0]; this.selectedPlatform = this.isShowFre ? this.platforms[0] : this.platforms[1];
this.loadMemu(this.selectedPlatform.appId); this.loadMemu(this.selectedPlatform.appId);
} }
@ -126,13 +139,13 @@ export class MenuManagerComponentsIndexComponent implements OnInit {
} }
}); });
} }
menuSort(){ menuSort() {
const dialogData = { const dialogData = {
appId: this.selectedPlatform.appId appId: this.selectedPlatform.appId
}; };
this.modalHelper.create(MenuManagerMenusortComponent, { i: dialogData }, { size: 900 }).subscribe((res:any) => { this.modalHelper.create(MenuManagerMenusortComponent, { i: dialogData }, { size: 900 }).subscribe((res: any) => {
if(res) { if (res) {
console.log('a') console.log('a');
this.loadMemu(this.selectedPlatform.appId); this.loadMemu(this.selectedPlatform.appId);
} }
}); });

View File

@ -5,7 +5,11 @@ import { MenuManagerComponentsIndexComponent } from './components/index/index.co
const routes: Routes = [ const routes: Routes = [
{ path: '', redirectTo: 'index', pathMatch: 'full' }, { path: '', redirectTo: 'index', pathMatch: 'full' },
{ path: 'index', component: MenuManagerComponentsIndexComponent, data: { guard: { ability: ['MENU-INDEX-obclist'] } } }, {
path: 'index',
component: MenuManagerComponentsIndexComponent,
data: { guard: { ability: ['MENU-INDEX-obclist', 'MENU-INDEX-smclist'] } }
},
{ path: 'auth', component: ApiAuthComponent, data: { guard: { ability: ['MENU-AUTH-obclist', 'MENU-AUTH-smclist'] } } } { path: 'auth', component: ApiAuthComponent, data: { guard: { ability: ['MENU-AUTH-obclist', 'MENU-AUTH-smclist'] } } }
]; ];