/* * @Description : * @Version : 1.0 * @Author : Shiming * @Date : 2021-12-30 14:45:39 * @LastEditors : Shiming * @LastEditTime : 2022-04-22 16:31:57 * @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\vehicle\\modify-captain\\modify-captain.component.ts * Copyright (C) 2022 huzhenhong. All rights reserved. */ import { Component, OnInit, ViewChild } from '@angular/core'; import { STColumn, STComponent } from '@delon/abc/st'; import { SFComponent, SFSchema, SFUISchema } from '@delon/form'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef } from 'ng-zorro-antd/modal'; import { OrderManagementService } from '../../../services/order-management.service'; @Component({ selector: 'app-order-management-vehicle-modify-captain', templateUrl: './modify-captain.component.html', styleUrls: ['./modify-captain.component.less'] }) export class VehicleModifyCaptainComponent implements OnInit { @ViewChild('sf', { static: false }) sf!: SFComponent; @ViewChild('st', { static: false }) st!: STComponent; schema: SFSchema = {}; ui: SFUISchema = {}; Columns: STColumn[] = []; aggreechecked = false; dataList: any = []; data: any; bankData: any; constructor(private modal: NzModalRef, private msgSrv: NzMessageService, public service: OrderManagementService) {} ngOnInit(): void { console.log(this.data); this.initSF(); this.initST(); } initSF() { this.schema = { properties: { mobile: { type: 'string', title: '车队长手机号', maxLength: 11, default: '' } }, required: ['mobile'] }; this.ui = { '*': { spanLabelFixed: 130, grid: { span: 16 } } }; } initST() { this.Columns = [ { title: '司机头像', render: 'avatar', width: '120px' }, { title: '司机姓名', index: 'name', width: '120px' }, { title: '实名认证状态', className: 'text-center', index: 'certificationStatus', type: 'badge', width: '120px', badge: { '-1': { text: '未提交', color: 'warning' }, '0': { text: '待审核', color: 'warning' }, '1': { text: '通过', color: 'success' }, '2': { text: '驳回', color: 'error' } } }, { title: '收款账户', width: '200px', render: 'bankList' }, { title: '操作', width: '120px', className: 'text-center', buttons: [ { text: '设置', click: item => { this.set(item); } } ] } ]; } set(value: any): void { console.log(this.st?._data); console.log(this.data); console.log(value); console.log(this.bankData); const params = { billIds: this.data?.ids, carCaptainId: value.appUserId, bankData: this.bankData }; this.service.request(this.service.$api_get_updateCarCaptainBatch, params).subscribe((res: any) => { if (res) { this.modal.destroy(); this.service.msgSrv.success('修改成功'); } }); } initDate() { let phone = this.sf?.value.mobile.replace(/^\s*|\s*$/g,"") if(!phone) { this.service.msgSrv.error('请输入手机号!'); return } const params = { fetchBank: 1, ...this.sf?.value }; this.service.request(this.service.$api_get_getCarCaptainByMobile, params).subscribe((res: any) => { if (res) { this.dataList = [res]; } }); } close(): void { this.modal.destroy(); } }