This commit is contained in:
Taric Xin
2022-04-18 09:53:08 +08:00
parent 7e3783b479
commit 82169c54e1
3 changed files with 90 additions and 73 deletions

View File

@ -11,7 +11,11 @@
<!-- 页头 --> <!-- 页头 -->
<page-header-wrapper [title]="'数据报表'"></page-header-wrapper> <page-header-wrapper [title]="'数据报表'"></page-header-wrapper>
<nz-card> <nz-card>
<sf #sf mode="search" [schema]="searchSchema" button="none"></sf> <div nz-row nzGutter="8">
<div nz-col [nzXl]="24" [nzLg]="24" [nzSm]="24" [nzXs]="24">
<sf #sf [schema]="searchSchema" button="none"
[ui]="{ '*': { spanLabelFixed: 110, grid: { xxl:5,xl:8, lg: 8, md: 12, sm: 12, xs: 24 } } }" [compact]="true">
<ng-template sf-template="no4" let-me let-ui="ui" let-schema="schema">
<div class="chooseBox"> <div class="chooseBox">
<div class="timeBox"> <div class="timeBox">
<nz-radio-group [(ngModel)]="mode" nzButtonStyle="solid" (ngModelChange)="changeData()"> <nz-radio-group [(ngModel)]="mode" nzButtonStyle="solid" (ngModelChange)="changeData()">
@ -21,25 +25,25 @@
<label nz-radio-button nzValue="define">自定义</label> <label nz-radio-button nzValue="define">自定义</label>
</nz-radio-group> </nz-radio-group>
<div class="dateBox"> <div class="dateBox">
<nz-date-picker [(ngModel)]="date" [nzMode]="mode" [nzFormat]="dateFormat" *ngIf="mode !== 'define'" [nzDisabledDate]="disabledDate" (ngModelChange)="onChange($event)"></nz-date-picker> <nz-date-picker [(ngModel)]="date" [nzMode]="mode" [nzFormat]="dateFormat" *ngIf="mode !== 'define'"
<nz-range-picker [(ngModel)]="defineDate" [nzFormat]="dateFormat" *ngIf="mode === 'define'" [nzDisabledDate]="disabledDate" (ngModelChange)="onChange($event)"></nz-range-picker> [nzDisabledDate]="disabledDate" (ngModelChange)="onChange($event)"></nz-date-picker>
<nz-range-picker [(ngModel)]="defineDate" [nzFormat]="dateFormat" *ngIf="mode === 'define'"
[nzDisabledDate]="disabledDate" (ngModelChange)="onChange($event)"></nz-range-picker>
</div>
</div>
</div>
</ng-template>
</sf>
</div>
</div> </div>
</div> <st #st [bordered]="true" [scroll]="{ x: '2000px' }" [data]="service.$api_listCusComplianceReportPage"
</div>
<st
#st
[bordered]="true"
[scroll]="{ x: '2000px' }"
[data]="service.$api_listCusComplianceReportPage"
[columns]="columns" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }" [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[scroll]="{ x: '1200px' }" [res]="{ reName: { list: 'data.records', total: 'data.total' } }" [scroll]="{ x: '1200px' }" [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [loading]="false">
[loading]="false"
>
<ng-template st-row="freightPrice" let-item let-index="index"> <ng-template st-row="freightPrice" let-item let-index="index">
{{ item.freightPrice | currency }} {{ item.freightPrice | currency }}
</ng-template> </ng-template>
</st> </st>
</nz-card> </nz-card>

View File

@ -1,11 +1,14 @@
.chooseBox{ .chooseBox {
display: flex; display: flex;
float : right;
} }
.timeBox{
.timeBox {
display: flex; display: flex;
margin: 0 0 0 10px; margin : 0 0 0 10px;
} }
.dateBox{
.dateBox {
display: inline-block; display: inline-block;
margin: 0 0 0 10px; margin : 0 0 0 10px;
} }

View File

@ -12,7 +12,7 @@ import { SFComponent } from '@delon/form';
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { STColumn, STComponent, STRequestOptions } from '@delon/abc/st'; import { STColumn, STComponent, STRequestOptions } from '@delon/abc/st';
import { SFSchema } from '@delon/form'; import { SFSchema } from '@delon/form';
import { ModalHelper, _HttpClient ,DatePipe} from '@delon/theme'; import { ModalHelper, _HttpClient, DatePipe } from '@delon/theme';
import { DataService } from '../../../services/data.service'; import { DataService } from '../../../services/data.service';
import { differenceInCalendarDays } from 'date-fns'; import { differenceInCalendarDays } from 'date-fns';
@ -21,19 +21,18 @@ import { differenceInCalendarDays } from 'date-fns';
templateUrl: './customer.component.html', templateUrl: './customer.component.html',
styleUrls: ['./customer.component.less'], styleUrls: ['./customer.component.less'],
providers: [DatePipe] providers: [DatePipe]
}) })
export class DatatableComplianceCustomerComponent implements OnInit { export class DatatableComplianceCustomerComponent implements OnInit {
@ViewChild('sf', {static: false}) sf!: SFComponent @ViewChild('sf', { static: false }) sf!: SFComponent;
mode = 'year'; mode = 'year';
type = 1; type = 1;
date: any = null; date: any = null;
defineDate = []; defineDate = [];
time: any = ['2022'] time: any = ['2022'];
dateFormat = 'yyyy'; dateFormat = 'yyyy';
dateNext: any = null; dateNext: any = null;
modeNext = 'year'; modeNext = 'year';
timeNext: any = ['2022-01-01 00:00:00'] timeNext: any = ['2022-01-01 00:00:00'];
today = new Date(); today = new Date();
searchSchema: SFSchema = { searchSchema: SFSchema = {
properties: { properties: {
@ -49,11 +48,20 @@ export class DatatableComplianceCustomerComponent implements OnInit {
type: 'string', type: 'string',
title: '合伙人名称' title: '合伙人名称'
}, },
no4: {
type: 'string',
title: '',
ui: {
class: 'text-right',
widget: 'custom',
grid: { xxl: 9, xl: 24, lg: 24, md: 24, sm: 24, xs: 24 }
}
}
} }
}; };
@ViewChild('st') private readonly st!: STComponent; @ViewChild('st') private readonly st!: STComponent;
columns: STColumn[] = [ columns: STColumn[] = [
{ title: '公司名称', index: 'enterpriseName' ,}, { title: '公司名称', index: 'enterpriseName' },
{ title: '注册时间', index: 'registerTime' }, { title: '注册时间', index: 'registerTime' },
{ title: '客户类型', width: '100px', index: 'customerType' }, { title: '客户类型', width: '100px', index: 'customerType' },
{ title: '业务员', index: 'salesmanName' }, { title: '业务员', index: 'salesmanName' },
@ -68,50 +76,52 @@ export class DatatableComplianceCustomerComponent implements OnInit {
{ title: '运费代收单数', index: 'freightRepPayCounts' }, { title: '运费代收单数', index: 'freightRepPayCounts' },
{ title: '手机直付', index: 'updatedAt' }, { title: '手机直付', index: 'updatedAt' },
{ title: '汇款单数', index: 'updatedAt' }, { title: '汇款单数', index: 'updatedAt' },
{ title: '及时付款', index: 'timelyPayPer' }, { title: '及时付款', index: 'timelyPayPer' }
]; ];
constructor(private http: _HttpClient, private modal: ModalHelper,public service: DataService,private datePipe: DatePipe) { } constructor(private http: _HttpClient, private modal: ModalHelper, public service: DataService, private datePipe: DatePipe) {}
/** /**
* 查询参数 * 查询参数
*/ */
get reqParams() { get reqParams() {
if (this.mode === 'year') { if (this.mode === 'year') {
this.type = 1 this.type = 1;
} else if (this.mode === 'month') { } else if (this.mode === 'month') {
this.type = 2 this.type = 2;
} else if (this.mode === 'date') { } else if (this.mode === 'date') {
this.type = 3 this.type = 3;
} else { } else {
this.type = 4 this.type = 4;
} }
const params: any = Object.assign({}, this.sf?.value || {}); const params: any = Object.assign({}, this.sf?.value || {});
params.type = this.type params.type = this.type;
params.queryTime = this.time params.queryTime = this.time;
delete params._$expand; delete params._$expand;
return { ...params }; return { ...params };
} }
ngOnInit(): void { } ngOnInit(): void {}
onChange(result: any) { onChange(result: any) {
if (this.mode === 'year') { if (this.mode === 'year') {
this.time = [this.datePipe.transform(this.date, 'yyyy') + '-01-01 00:00:00'] this.time = [this.datePipe.transform(this.date, 'yyyy') + '-01-01 00:00:00'];
} else if (this.mode === 'month') { } else if (this.mode === 'month') {
this.time = [this.datePipe.transform(this.date, 'yyyy-MM') + '-01 00:00:00'] this.time = [this.datePipe.transform(this.date, 'yyyy-MM') + '-01 00:00:00'];
} else if (this.mode === 'date') { } else if (this.mode === 'date') {
this.time = [this.datePipe.transform(this.date, 'yyyy-MM-dd') + ' 00:00:00'] this.time = [this.datePipe.transform(this.date, 'yyyy-MM-dd') + ' 00:00:00'];
} else { } else {
this.time = [this.datePipe.transform(this.defineDate[0], 'yyyy-MM-dd') + '00:00:00', this.datePipe.transform(this.defineDate[1], 'yyyy-MM-dd') + ' 00:00:00'] this.time = [
this.datePipe.transform(this.defineDate[0], 'yyyy-MM-dd') + '00:00:00',
this.datePipe.transform(this.defineDate[1], 'yyyy-MM-dd') + ' 00:00:00'
];
} }
this.st.reload({ ...this.reqParams }); this.st.reload({ ...this.reqParams });
} }
changeData() { changeData() {
if (this.mode === 'year') { if (this.mode === 'year') {
this.dateFormat = 'yyyy' this.dateFormat = 'yyyy';
} else if (this.mode === 'month') { } else if (this.mode === 'month') {
this.dateFormat = 'yyyy-MM' this.dateFormat = 'yyyy-MM';
} else { } else {
this.dateFormat = 'yyyy-MM-dd' this.dateFormat = 'yyyy-MM-dd';
} }
} }
disabledDate = (current: Date): boolean => disabledDate = (current: Date): boolean =>