This commit is contained in:
Taric Xin
2022-02-10 16:04:12 +08:00
parent 22228e623a
commit db3013c809
5 changed files with 59 additions and 42 deletions

View File

@ -19,7 +19,7 @@
</div>
<div nz-col [nzXl]="_$expand ? 24 : 8" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="text-right">
<button nz-button nzType="primary" (click)="creat()">新增企业</button>
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">查询</button>
<button nz-button nzType="primary" [disabled]="!loadingList && service.http.loading" [nzLoading]="loadingList" (click)="st?.load(1)">查询</button>
<button nz-button nzType="primary" [disabled]="service.http.loading" (click)="exportList()">导出</button>
<button nz-button (click)="resetSF()" [disabled]="service.http.loading">重置</button>
<button nz-button nzType="link" (click)="expandToggle()">
@ -34,10 +34,10 @@
<!-- [data]="service.$api_get_supplier_page" -->
<st #st [columns]="columns" [data]='service.$api_get_freight_list'
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, process: beforeReq }"
[res]="{ reName: { list: 'data.records', total: 'data.total' }, process: dataProcess }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loading]="service.http.loading">
[loading]="loadingList" >
<ng-template st-row="enterpriseName" let-item let-index="index">
<div nz-tooltip [nzTooltipTitle]="item.enterpriseName">
<div

View File

@ -1,6 +1,6 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { STColumn, STColumnBadge, STComponent, STData } from '@delon/abc/st';
import { STChange, STColumn, STColumnBadge, STComponent, STData, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
import { DynamicSettingModalComponent, ShipperBaseService } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal';
@ -22,29 +22,15 @@ export class FreightComponentsListComponent implements OnInit {
@ViewChild('promoterModal', { static: false })
promoterModal!: any;
promotersTelephone = '';
loadingList = true;
constructor(
public service: UsermanageService,
private modal: NzModalService,
private router: Router,
private ar: ActivatedRoute,
public shipperservice: ShipperBaseService) {}
/**
* 查询参数
*/
get reqParams() {
const params: any = {
...(this.sf && this.sf.value),
listSource: 1
};
if (this.sf?.value.effectiveDate) {
params.effectiveDateStart = this.sf?.value.effectiveDate[0];
params.effectiveDateEnd = this.sf?.value.effectiveDate[1];
}
delete params.effectiveDate;
delete params.expand;
return params;
}
private router: Router,
private ar: ActivatedRoute,
public shipperservice: ShipperBaseService
) {}
ngOnInit() {
this.initSF();
@ -53,12 +39,22 @@ export class FreightComponentsListComponent implements OnInit {
this.st?.load(1);
});
}
dataProcess(data: STData[]): STData[] {
return data.map((i, index) => {
i.showSortFlag = false;
return i;
});
}
beforeReq = (requestOptions: STRequestOptions) => {
Object.assign(requestOptions.body, { listSource: 1 });
if (this.sf) {
Object.assign(requestOptions.body, {
...this.sf.value
});
}
this.loadingList = true;
return requestOptions;
};
dataProcess = (data: STData[]): STData[] => {
this.loadingList = false;
return data;
};
settingAction(item?: any) {
this.modal.create({
@ -113,7 +109,7 @@ export class FreightComponentsListComponent implements OnInit {
showRequired: false
}
},
networkTransporter: {
type: 'string',
title: '网络货运人',
@ -121,8 +117,8 @@ export class FreightComponentsListComponent implements OnInit {
widget: 'select',
placeholder: '请选择',
allowClear: true,
asyncData: () => this.shipperservice.getNetworkFreightForwarder(),
},
asyncData: () => this.shipperservice.getNetworkFreightForwarder()
}
},
promotersTelephone: {
title: '业务员',
@ -252,7 +248,12 @@ export class FreightComponentsListComponent implements OnInit {
}
exportList() {
const params = this.reqParams;
const params = { listSource: 1 };
if (this.sf) {
Object.assign(params, {
...this.sf.value
});
}
this.service.downloadFile(this.service.$api_export_enterprise, params);
}