This commit is contained in:
Taric Xin
2022-02-25 17:19:03 +08:00
parent 9955d29d76
commit db73552c90
2 changed files with 169 additions and 43 deletions

View File

@ -9,49 +9,82 @@
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<page-header-wrapper [title]="'企业审核列表'" [content]="content">
<nz-card class="mb-md">
<!-- 搜索表单 -->
<div nz-row nzGutter="8">
<div nz-col [nzXl]="_$expand ? 24 : 16" [nzLg]="24" [nzSm]="24" [nzXs]="24">
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
</div>
<div nz-col [nzXl]="_$expand ? 24 : 8" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="text-right"
[class.expend-options]="_$expand">
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)" acl
[acl-ability]="['USERCENTER-FREIGHT-ENTERPRISE-list']">查询</button>
<button *ngIf="tabType == 1" nz-button nzType="primary" [disabled]="service.http.loading" (click)="exportList()"
acl [acl-ability]="['USERCENTER-FREIGHT-ENTERPRISE-export']">导出</button>
<button nz-button (click)="resetSF()" [disabled]="service.http.loading">重置</button>
<button nz-button nzType="link" (click)="expandToggle(!_$expand)">
{{ !_$expand ? '展开' : '收起' }}
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
</button>
</div>
</div>
</nz-card>
<nz-card>
<!-- 数据列表 -->
<st #st multiSort [data]="service.$api_get_freight_list" [columns]="tabType===1?enterColumns:adminColumns"
[req]="{ process: beforeReq }" [page]=" {}" [loading]="service.http.loading" [scroll]="{ x: '1200px' }">
<ng-template st-row="approvalStatus" let-item let-index="index">
<ng-container [ngSwitch]="item.approvalStatus">
<nz-badge *ngSwitchCase="10" nzColor="#108ee9" nzText="待审核"></nz-badge>
<nz-badge *ngSwitchCase="15" nzColor="gold" nzText="已撤销"></nz-badge>
<nz-badge *ngSwitchCase="20" nzColor="#87d068" nzText="已成功"></nz-badge>
<ng-container *ngSwitchCase="30">
<nz-badge nzColor="volcano" nzText="已驳回"></nz-badge><br>
<label style="color: #ff4d4f;">(驳回原因:{{item.approvalOpinion}}</label>
</ng-container>
<p *ngSwitchDefault></p>
</ng-container>
</ng-template>
</st>
</nz-card>
<ng-template #content>
<nz-tabset class="tabs-wrap">
<nz-tab *ngFor="let tab of tabs" [nzTitle]="tab.name" (nzSelect)="changeTab(tab)"> </nz-tab>
</nz-tabset>
</ng-template>
</page-header-wrapper>
</page-header-wrapper>
<nz-card class="mb-md">
<!-- 搜索表单 -->
<div nz-row nzGutter="8">
<div nz-col [nzXl]="_$expand ? 24 : 16" [nzLg]="24" [nzSm]="24" [nzXs]="24">
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
</div>
<div nz-col [nzXl]="_$expand ? 24 : 8" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="text-right"
[class.expend-options]="_$expand">
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)" acl
[acl-ability]="['USERCENTER-FREIGHT-ENTERPRISE-list']">查询</button>
<button *ngIf="tabType == 1" nz-button nzType="primary" [disabled]="service.http.loading" (click)="exportList()"
acl [acl-ability]="['USERCENTER-FREIGHT-ENTERPRISE-export']">导出</button>
<button nz-button (click)="resetSF()" [disabled]="service.http.loading">重置</button>
<button nz-button nzType="link" (click)="expandToggle(!_$expand)">
{{ !_$expand ? '展开' : '收起' }}
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
</button>
</div>
</div>
</nz-card>
<nz-card>
<!-- 数据列表 -->
<st #st multiSort [data]="service.$api_get_freight_list" [columns]="tabType===1?enterColumns:adminColumns"
[req]="{ process: beforeReq }" [page]=" {}" [loading]="service.http.loading" [scroll]="{ x: '1200px' }">
<ng-template st-row="approvalStatus" let-item let-index="index">
<ng-container [ngSwitch]="item.approvalStatus">
<nz-badge *ngSwitchCase="10" nzColor="#108ee9" nzText="待审核"></nz-badge>
<nz-badge *ngSwitchCase="15" nzColor="gold" nzText="已撤销"></nz-badge>
<nz-badge *ngSwitchCase="20" nzColor="#87d068" nzText="已成功"></nz-badge>
<ng-container *ngSwitchCase="30">
<nz-badge nzColor="volcano" nzText="已驳回"></nz-badge><br>
<label style="color: #ff4d4f;">(驳回原因:{{item.approvalOpinion}}</label>
</ng-container>
<p *ngSwitchDefault></p>
</ng-container>
</ng-template>
</st>
</nz-card>
<ng-template #approvedModal>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="120">
<se [col]="1" label="公司名称">
{{ detailData?.enterpriseName }}
</se>
<se [col]="1" label="网络货运人" required>
<nz-select nzPlaceHolder="请选择" [(ngModel)]="networkTransporter">
<nz-option [nzValue]="item.value" [nzLabel]="item.label" *ngFor="let item of ltdId"></nz-option>
</nz-select>
</se>
<se [col]="1" label="企业角色" required>
<nz-select nzPlaceHolder="请选择" [(ngModel)]="roleId">
<nz-option [nzValue]="item.value" [nzLabel]="item.label" *ngFor="let item of roles"></nz-option>
</nz-select>
</se>
</div>
</div>
</ng-template>
<ng-template #redectModal>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="120">
<se [col]="1" label="公司名称">
{{ detailData?.enterpriseName }}
</se>
<se [col]="1" label="备注" required>
<textarea nz-input rows="3" style="width: 325px;margin-left: 14px;" [(ngModel)]="approvalOpinion"></textarea>
</se>
</div>
</div>
</ng-template>

View File

@ -32,6 +32,17 @@ export class FreightComponentsEnterpriseAuditComponent implements OnInit {
isActived: false
}
];
@ViewChild('approvedModal', { static: false })
approvedModal!: any;
@ViewChild('redectModal', { static: false })
redectModal!: any;
ltdId: any = [];
roles: any = [];
detailData: any = null;
approvalOpinion = '';
networkTransporter = null;
roleId = null;
constructor(public service: UsermanageService, private router: Router, private modal: NzModalService) {}
beforeReq = (requestOptions: STRequestOptions) => {
@ -70,7 +81,25 @@ export class FreightComponentsEnterpriseAuditComponent implements OnInit {
/**
* 程序初始化入口
*/
ngOnInit() {}
ngOnInit() {
this.loadltdId();
this.loadRoles();
}
loadltdId() {
this.service.getNetworkFreightForwarder().subscribe(res => {
if (res) {
this.ltdId = res;
}
});
}
loadRoles() {
this.service.getRoles({ enterpriseId: 0, projectId: 0 }).subscribe(res => {
if (res) {
this.roles = res;
}
});
}
/**
* 查看详情
@ -123,6 +152,56 @@ export class FreightComponentsEnterpriseAuditComponent implements OnInit {
});
}
auditPass(item: any) {
this.detailData = item;
this.networkTransporter = null;
this.roleId = null;
this.modal.create({
nzTitle: '审核通过',
nzContent: this.approvedModal,
nzOnOk: () => {
if (!this.networkTransporter || !this.roleId) {
return false;
}
this.auditEnterprise(20);
return;
}
});
}
auditNo(item: any) {
this.detailData = item;
this.approvalOpinion = '';
this.roleId = null;
this.modal.create({
nzTitle: '审核驳回',
nzContent: this.redectModal,
nzOnOk: () => {
if (!this.approvalOpinion) {
return false;
}
this.auditEnterprise(30);
return;
}
});
}
private auditEnterprise(status: number) {
this.service
.request(this.service.$api_audit_freight, {
approvalStatus: status,
id: this.detailData.id,
approvalOpinion: this.approvalOpinion,
networkTransporter: this.networkTransporter,
roleId: this.roleId || null
})
.subscribe(res => {
if (res) {
this.service.msgSrv.success(status === 20 ? '审核通过' : '驳回成功');
}
this.st.load(1);
});
}
View(record: any) {
this.router.navigate([`/usercenter/freight/enterprise/detail/${record.id}`]);
}
@ -216,7 +295,21 @@ export class FreightComponentsEnterpriseAuditComponent implements OnInit {
fixed: 'right',
width: '180px',
className: 'text-center',
buttons: [{ text: '查看', click: _record => this.View(_record), acl: { ability: ['USERCENTER-FREIGHT-ENTERPRISE-view'] } }]
buttons: [
{ text: '查看', click: _record => this.View(_record), acl: { ability: ['USERCENTER-FREIGHT-ENTERPRISE-view'] } },
{
text: '通过',
click: _record => this.auditPass(_record),
acl: { ability: ['USERCENTER-FREIGHT-ENTERPRISE-D-audit'] },
iif: item => item.approvalStatus === 10
},
{
text: '驳回',
click: _record => this.auditNo(_record),
acl: { ability: ['USERCENTER-FREIGHT-ENTERPRISE-D-audit'] },
iif: item => item.approvalStatus === 10
}
]
}
];
}