This commit is contained in:
Taric Xin
2021-12-22 20:17:29 +08:00
parent 2181b8e5cb
commit 5c8002a093
18 changed files with 695 additions and 630 deletions

View File

@ -1,9 +1,8 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { STComponent, STColumn, STChange } from '@delon/abc/st';
import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema, SFDateWidgetSchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal';
import { SystemService } from 'src/app/routes/sys-setting/services/system.service';
import { FreightAccountService } from '../../services/freight-account.service';
@Component({
selector: 'app-driver-account',
@ -16,83 +15,21 @@ export class DriverAccountComponent implements OnInit {
@ViewChild('sf', { static: false })
sf!: SFComponent;
url = `/rule?_allow_anonymous=true`;
searchSchema: SFSchema = {
properties: {
expand: {
type: 'boolean',
ui: {
hidden: true
}
},
receiveName: {
type: 'string',
title: '司机姓名',
ui: { placeholder: '请输入' }
},
phone: {
type: 'string',
title: '证件号码',
ui: { placeholder: '请输入' }
},
page: {
type: 'string',
title: '手机号',
ui: {
placeholder: '请输入'
}
},
createTime: {
title: '创建时间',
type: 'string',
ui: {
widget: 'date',
mode: 'range',
format: 'yyyy-MM-dd',
visibleIf: {
expand: (value: boolean) => value
}
} as SFDateWidgetSchema
}
}
};
columns: STColumn[] = [
{ title: '司机姓名', index: 'description' },
{ title: '证件号码', index: 'description' },
{ title: '手机号', index: 'description' },
{ title: '账户余额', index: 'description' },
{ title: '油卡余额', index: 'description' },
{ title: '创建时间', index: 'updatedAt', type: 'date' },
{
title: '操作',
buttons: [
{
text: '查看明细',
click: item => this.routeTo(item)
}
]
}
];
reqParams = { pageIndex: 1, pageSize: 10 };
searchSchema: SFSchema = this.initSF();
columns: STColumn[] = this.initST();
reqParams = {};
_$expand = false;
constructor(public service: SystemService, private router: Router) {}
constructor(public service: FreightAccountService, private router: Router) {}
ngOnInit(): void {}
stChange(e: STChange): void {
switch (e.type) {
case 'filter':
this.st.load();
break;
beforeReq = (requestOptions: STRequestOptions) => {
if (this.sf) {
this.reqParams = { ...this.sf.value };
}
}
routeTo(item?: any) {
this.router.navigate(['/financial-management/driver-account-detail/1']);
}
return requestOptions;
};
/**
* 重置表单
@ -109,4 +46,109 @@ export class DriverAccountComponent implements OnInit {
this._$expand = !this._$expand;
this.sf?.setValue('/expand', this._$expand);
}
exportList() {
this.service.downloadFile(this.service.$mock_url, { ...this.sf.value, pageIndex: this.st.pi, pageSize: this.st.ps });
}
private initSF(): SFSchema {
return {
properties: {
expand: {
type: 'boolean',
ui: {
hidden: true
}
},
receiveName: {
type: 'string',
title: '司机姓名',
ui: { placeholder: '请输入' }
},
phone: {
type: 'string',
title: '证件号码',
ui: { placeholder: '请输入' }
},
page: {
type: 'string',
title: '手机号',
ui: {
placeholder: '请输入'
}
},
page2: {
type: 'string',
title: '网络货运人',
enum: [{ label: '全部', value: '全部' }],
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
page22: {
type: 'string',
title: '银行类型',
enum: [{ label: '全部', value: '全部' }],
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
expand: (value: boolean) => value
}
}
},
page3: {
type: 'string',
title: '虚拟账户',
ui: {
placeholder: '请输入',
visibleIf: {
expand: (value: boolean) => value
}
}
},
createTime: {
title: '创建时间',
type: 'string',
ui: {
widget: 'date',
mode: 'range',
format: 'yyyy-MM-dd',
visibleIf: {
expand: (value: boolean) => value
}
} as SFDateWidgetSchema
}
}
};
}
private initST(): STColumn[] {
return [
{ title: '司机姓名', index: 'description' },
{ title: '证件号码', index: 'description' },
{ title: '手机号', index: 'description' },
{ title: '网络货运人', index: 'description' },
{ title: '银行类型', index: 'description' },
{ title: '虚拟账户', index: 'description' },
{ title: '可用余额', index: 'description' },
{ title: '冻结余额', index: 'description' },
{ title: '本月累计提现金额', index: 'description', width: 150 },
{ title: '账户总余额', index: 'description' },
{ title: '创建时间', index: 'updatedAt', type: 'date', width: 150 },
{
title: '操作',
buttons: [
{
text: '查看明细',
click: item => this.router.navigate(['/financial-management/driver-account/detail/1'])
}
]
}
];
}
}