edit
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
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-freight-account',
|
||||
@ -11,124 +12,28 @@ import { SystemService } from 'src/app/routes/sys-setting/services/system.servic
|
||||
styleUrls: ['./freight-account.component.less']
|
||||
})
|
||||
export class FreightAccountComponent implements OnInit {
|
||||
@ViewChild('accountModal', { static: true })
|
||||
accountModal: any;
|
||||
@ViewChild('st', { static: true })
|
||||
st!: STComponent;
|
||||
@ViewChild('sf', { static: false })
|
||||
sf!: SFComponent;
|
||||
searchSchema: SFSchema = this.initSF();
|
||||
columns: STColumn[] = this.initST();
|
||||
|
||||
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
|
||||
},
|
||||
receiveName2: {
|
||||
type: 'string',
|
||||
title: '无车承运人',
|
||||
enum: [{ label: '全部', value: '全部' }],
|
||||
ui: {
|
||||
widget: 'select',
|
||||
placeholder: '请选择',
|
||||
change: (i: any) => {
|
||||
this.sf.value.receiveName2 = i;
|
||||
this.sf?.setValue('/receiveName2', i);
|
||||
},
|
||||
visibleIf: {
|
||||
expand: (value: boolean) => value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
columns: STColumn[] = [
|
||||
{ title: '企业名称', index: 'description' },
|
||||
{ title: '统一社会信用代码', index: 'description' },
|
||||
{ title: '联系人', index: 'description' },
|
||||
{ title: '联系人电话', index: 'description' },
|
||||
{ title: '累计消费金额', index: 'description' },
|
||||
{ title: '账户余额', render: 'description1' },
|
||||
{ title: '创建时间', index: 'updatedAt', type: 'date' },
|
||||
{
|
||||
title: '操作',
|
||||
buttons: [
|
||||
{
|
||||
text: '查看明细',
|
||||
click: item => this.routeTo(item)
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
selectedRows: any[] = [];
|
||||
|
||||
reqParams = { pageIndex: 1, pageSize: 10 };
|
||||
reqParams = {};
|
||||
_$expand = false;
|
||||
|
||||
accountList = [{ description: 222 }, { description: 222 }, { description: 222 }];
|
||||
constructor(public service: SystemService, private nzModalService: NzModalService, private router: Router) {}
|
||||
constructor(public service: FreightAccountService, private nzModalService: NzModalService, private router: Router) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
stChange(e: STChange): void {
|
||||
switch (e.type) {
|
||||
case 'checkbox':
|
||||
this.selectedRows = e.checkbox!;
|
||||
break;
|
||||
case 'filter':
|
||||
this.st.load();
|
||||
break;
|
||||
beforeReq = (requestOptions: STRequestOptions) => {
|
||||
if (this.sf) {
|
||||
this.reqParams = { ...this.sf.value };
|
||||
}
|
||||
}
|
||||
|
||||
showAccount(item: any) {
|
||||
const modal = this.nzModalService.create({
|
||||
nzTitle: '账户明细',
|
||||
nzContent: this.accountModal,
|
||||
nzFooter: []
|
||||
});
|
||||
modal.afterClose.subscribe(res => {
|
||||
this.st.load();
|
||||
});
|
||||
}
|
||||
|
||||
routeTo(item?: any) {
|
||||
this.router.navigate(['/financial-management/freight-account-detail/1']);
|
||||
}
|
||||
return requestOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
* 重置表单
|
||||
@ -145,4 +50,114 @@ export class FreightAccountComponent 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
|
||||
}
|
||||
}
|
||||
},
|
||||
receiveName2: {
|
||||
type: 'string',
|
||||
title: '银行类型',
|
||||
enum: [{ label: '全部', value: '全部' }],
|
||||
ui: {
|
||||
widget: 'select',
|
||||
placeholder: '请选择',
|
||||
change: (i: any) => {
|
||||
this.sf.value.receiveName2 = i;
|
||||
this.sf?.setValue('/receiveName2', i);
|
||||
},
|
||||
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' },
|
||||
{ title: '账户总余额', render: 'description1' },
|
||||
{ title: '创建时间', index: 'updatedAt', type: 'date', width: 150 },
|
||||
{ title: '状态', render: 'description1' },
|
||||
{
|
||||
title: '操作',
|
||||
buttons: [
|
||||
{
|
||||
text: '查看明细',
|
||||
click: item => this.router.navigate(['/financial-management/freight-account/detail/1'])
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user