Files
bbq/src/app/routes/usercenter/components/driver/driver-config/driver-config.component.ts
Taric Xin 7cbc7b1b2e edit
2022-02-23 15:12:42 +08:00

127 lines
3.6 KiB
TypeScript

import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { STColumn, STComponent } from '@delon/abc/st';
import { SFComponent, SFSchema } from '@delon/form';
import { DynamicSettingModalComponent } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal';
import { UsermanageService } from '../../../services/usercenter.service';
@Component({
selector: 'app-usercenter-components-driver-config',
templateUrl: './driver-config.component.html',
styleUrls: ['./driver-config.component.less']
})
export class UserCenterComponentsDriverConfigComponent implements OnInit {
schema: SFSchema = this.initSF();
columns: STColumn[] = this.initST();
@ViewChild('st', { static: false }) st!: STComponent;
@ViewChild('sf', { static: false }) sf!: SFComponent;
constructor(public service: UsermanageService, private modal: NzModalService) {}
/**
* 查询参数
*/
get reqParams() {
const params: any = {
...(this.sf && this.sf.value)
};
delete params.effectiveDate;
delete params.expand;
return params;
}
ngOnInit() {}
settingAction(item?: any) {
const modal = this.modal.create({
nzTitle: '配置',
nzContent: DynamicSettingModalComponent,
nzWidth: 900,
nzComponentParams: {
extendType: '3',
businessId: item.appUserId,
configvalue: 'sys.config'
},
nzFooter: null
});
modal.afterClose.subscribe(res => {
if (res) {
this.st.load(1);
}
});
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
}
exportList() {
const params = this.reqParams;
this.service.downloadFile(this.service.$api_export_driver_cap, params);
}
private initSF(): SFSchema {
return {
properties: {
expand: {
type: 'boolean',
ui: {
hidden: true
}
},
name: { title: '司机姓名', type: 'string', ui: { placeholder: '请输入', showRequired: false } },
mobile: {
title: '手机号',
type: 'string',
maxLength: 11,
ui: {
placeholder: '请输入'
}
},
isCaptain: {
type: 'string',
title: '类型',
enum: [
{ label: '全部', value: '' },
{ label: '车队长', value: 1 },
{ label: '司机', value: 0 }
],
default: '',
ui: {
widget: 'select'
}
}
}
};
}
private initST(): STColumn[] {
return [
// { title: '', type: 'checkbox', className: 'text-center' },
{ title: '司机姓名', className: 'text-center', index: 'name' },
{ title: '手机号', className: 'text-center', index: 'mobile' },
{ title: '类型', className: 'text-center', render: 'isCaptain' },
{ title: '月承运金额上限(元)', className: 'text-center', render: 'monthFreightAmount' },
{ title: '日提现金额上限(元)', className: 'text-center', render: 'dayWithdrawalAmount' },
{ title: '月提现金额上限(元)', className: 'text-center', render: 'monthWithdrawalAmount' },
{ title: '月收款金额上限(元)', className: 'text-center', render: 'monthReceivableAmount' },
{
title: '操作',
width: '170px',
className: 'text-center',
buttons: [
{
text: '配置',
click: item => this.settingAction(item),
acl: { ability: ['USERCENTER-DRIVER-CONFIG-config'] }
}
]
}
];
}
}