This commit is contained in:
Taric Xin
2022-04-28 16:31:47 +08:00
parent de37e6f06a
commit 772b5206b7
2 changed files with 46 additions and 8 deletions

View File

@ -1,7 +1,11 @@
<page-header-wrapper [title]="'车型车长配置'" [content]="content"> <page-header-wrapper [title]="'车型车长配置'" [content]="content">
<ng-template #content> <ng-template #content>
<nz-tabset class="tabs-wrap"> <nz-tabset class="tabs-wrap">
<nz-tab *ngFor="let tab of tabs" [nzTitle]="tab.name" (nzSelect)="changeTab(tab)"> </nz-tab> <ng-container *ngFor="let tab of tabs">
<nz-tab [nzTitle]="tab.name" (nzSelect)="changeTab(tab)" *ngIf="tab.isShow">
</nz-tab>
</ng-container>
</nz-tabset> </nz-tabset>
</ng-template> </ng-template>
</page-header-wrapper> </page-header-wrapper>
@ -22,10 +26,10 @@
<nz-card> <nz-card>
<div class="d-flex justify-content-end mb-sm"> <div class="d-flex justify-content-end mb-sm">
<div> <div>
<button nz-button nzType="primary" (click)="configAction()">新增</button> <button nz-button nzType="primary" (click)="configAction()" acl
[acl-ability]="['SYSTEM-CART-CONFIG-add']">新增</button>
</div> </div>
</div> </div>
<st #st [data]="tabType === 3?service.$api_get_config_item_page:service.$api_get_dict_page" [columns]="columns" <st #st [data]="tabType === 3?service.$api_get_config_item_page:service.$api_get_dict_page" [columns]="columns"
[req]="{process: beforeReq }" [res]="{ process: afterRes }" [loading]="loading" [req]="{process: beforeReq }" [res]="{ process: afterRes }" [loading]="loading" [scroll]="{ y: '370px' }"></st>
[scroll]="{ y: '370px' }"></st>
</nz-card> </nz-card>

View File

@ -1,5 +1,6 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core'; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st'; import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st';
import { ACLService } from '@delon/acl';
import { SFComponent, SFSchema } from '@delon/form'; import { SFComponent, SFSchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal'; import { NzModalService } from 'ng-zorro-antd/modal';
import { SystemService } from '../../services/system.service'; import { SystemService } from '../../services/system.service';
@ -20,17 +21,20 @@ export class CartConfigComponent implements OnInit {
{ {
name: '车型配置', name: '车型配置',
type: 1, type: 1,
isActived: false isActived: false,
isShow: true
}, },
{ {
name: '车长配置', name: '车长配置',
type: 2, type: 2,
isActived: false isActived: false,
isShow: true
}, },
{ {
name: '禁限物品名单', name: '禁限物品名单',
type: 3, type: 3,
isActived: false isActived: false,
isShow: true
} }
]; ];
tabType = 1; tabType = 1;
@ -102,10 +106,12 @@ export class CartConfigComponent implements OnInit {
buttons: [ buttons: [
{ {
text: '编辑', text: '编辑',
acl: { ability: ['SYSTEM-CART-CONFIG-edit'] },
click: item => this.configAction(item) click: item => this.configAction(item)
}, },
{ {
text: '删除', text: '删除',
acl: { ability: ['SYSTEM-CART-CONFIG-delete'] },
click: item => this.deleteAction(item) click: item => this.deleteAction(item)
} }
] ]
@ -113,7 +119,35 @@ export class CartConfigComponent implements OnInit {
]; ];
loading = true; loading = true;
constructor(public service: SystemService, private nzModalService: NzModalService, private cdr: ChangeDetectorRef) {} constructor(
public service: SystemService,
private nzModalService: NzModalService,
private cdr: ChangeDetectorRef,
private acl: ACLService
) {
const acls = acl.data.abilities || [];
this.tabs = [
{
name: '车型配置',
type: 1,
isActived: false,
isShow: acl.data.full || !!acls.find(acl => acl === 'SYSTEM-CART-CONFIG-modeList')
},
{
name: '车长配置',
type: 2,
isActived: false,
isShow: acl.data.full || !!acls.find(acl => acl === 'SYSTEM-CART-CONFIG-cartLength')
},
{
name: '禁限物品名单',
type: 3,
isActived: false,
isShow: acl.data.full || !!acls.find(acl => acl === 'SYSTEM-CART-CONFIG-goodsList')
}
];
this.tabType = this.tabs.find(tab => tab.isShow)?.type || 1;
}
ngOnInit(): void {} ngOnInit(): void {}