import { Component, OnInit, ViewChild } from '@angular/core'; import { Router } from '@angular/router'; import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st'; import { SFComponent, SFSchema, SFDateWidgetSchema } from '@delon/form'; import { NzModalService } from 'ng-zorro-antd/modal'; import { FreightAccountService } from '../../../services/freight-account.service'; @Component({ selector: 'app-driver-account-detail', templateUrl: './driver-account-detail.component.html', styleUrls: ['./driver-account-detail.component.less'] }) export class DriverAccountDetailComponent implements OnInit { @ViewChild('st', { static: true }) st!: STComponent; @ViewChild('sf', { static: false }) sf!: SFComponent; columns: STColumn[] = this.initST(); searchSchema: SFSchema = this.initSF(); _$expand = false; constructor(public service: FreightAccountService) {} ngOnInit(): void {} beforeReq = (requestOptions: STRequestOptions) => { if (this.sf) { Object.assign(requestOptions.body, { ...this.sf.value }); } return requestOptions; }; exportList() { this.service.downloadFile(this.service.$mock_url, { ...this.sf.value, pageIndex: this.st.pi, pageSize: this.st.ps }); } goBack() { history.go(-1); } /** * 重置表单 */ resetSF() { this.sf.reset(); this._$expand = false; } /** * 伸缩查询条件 */ expandToggle() { this._$expand = !this._$expand; this.sf?.setValue('/expand', this._$expand); } private initSF(): SFSchema { return { properties: { expand: { type: 'boolean', ui: { hidden: true } }, createTime: { title: '交易时间', type: 'string', ui: { widget: 'date', mode: 'range', format: 'yyyy-MM-dd' } as SFDateWidgetSchema }, orderSn2: { type: 'string', title: '流水号', ui: { placeholder: '请输入' } }, orderSn3: { type: 'string', title: '关联单号', ui: { placeholder: '请输入' } }, receiveName: { type: 'string', title: '交易类型', enum: [ { label: '全部', value: '' }, { label: '订单支付', value: '订单支付' }, { label: '余额充值', value: '余额充值' }, { label: '余额提现', value: '余额提现' }, { label: '资金分配', value: '资金分配' }, { label: '资金回收', value: '资金回收' } ], ui: { widget: 'select', placeholder: '请选择', visibleIf: { expand: (value: boolean) => value } }, default: '' }, receiveName2: { type: 'string', title: '收支类型', enum: [ { label: '全部', value: '' }, { label: '收入', value: '收入' }, { label: '支出', value: '支出' } ], ui: { widget: 'select', placeholder: '请选择', visibleIf: { expand: (value: boolean) => value } }, default: '' } } }; } private initST(): STColumn[] { return [ { title: '交易时间', index: 'updatedAt', type: 'date' }, { title: '流水号', index: 'callNo' }, { title: '交易类型', index: 'callNo' }, { title: '关联单号', index: 'callNo' }, { title: '收支类型', index: 'callNo' }, { title: '交易金额', index: 'callNo' }, { title: '账户余额', index: 'callNo' } ]; } }