From faae5ca73b6697a1de032c5c719efeefe013c0ad Mon Sep 17 00:00:00 2001 From: wangshiming Date: Wed, 16 Feb 2022 10:00:40 +0800 Subject: [PATCH] fix bug --- .../driver/captain/add/add.component.html | 30 ++ .../driver/captain/add/add.component.less | 36 ++ .../driver/captain/add/add.component.spec.ts | 24 ++ .../driver/captain/add/add.component.ts | 384 ++++++++++++++++++ .../driver/captain/captain.component.html | 48 ++- .../driver/captain/captain.component.ts | 16 +- .../usercenter/services/usercenter.service.ts | 13 +- .../routes/usercenter/usercenter.module.ts | 4 +- 8 files changed, 535 insertions(+), 20 deletions(-) create mode 100644 src/app/routes/usercenter/components/driver/captain/add/add.component.html create mode 100644 src/app/routes/usercenter/components/driver/captain/add/add.component.less create mode 100644 src/app/routes/usercenter/components/driver/captain/add/add.component.spec.ts create mode 100644 src/app/routes/usercenter/components/driver/captain/add/add.component.ts diff --git a/src/app/routes/usercenter/components/driver/captain/add/add.component.html b/src/app/routes/usercenter/components/driver/captain/add/add.component.html new file mode 100644 index 00000000..77904f23 --- /dev/null +++ b/src/app/routes/usercenter/components/driver/captain/add/add.component.html @@ -0,0 +1,30 @@ + +
+ + +
+
+
正面照
+
示例
+
+
+
+
+ +
+
+
背面照
+
示例
+
+
+
+
+
+
+ diff --git a/src/app/routes/usercenter/components/driver/captain/add/add.component.less b/src/app/routes/usercenter/components/driver/captain/add/add.component.less new file mode 100644 index 00000000..bfa10586 --- /dev/null +++ b/src/app/routes/usercenter/components/driver/captain/add/add.component.less @@ -0,0 +1,36 @@ +.pr { + position: relative; + } + + .pa { + position: absolute; + top: 35px; + left: 150px; + img{border: solid 1px #ebf0fb;} + } + + .tips { + display: flex; + margin-bottom: 0; + color: #333; + + dt { + width: 150px; + } + + dd { + width: 190px; + margin-bottom: 0; + text-align: center; + } + } + :host{ + ::ng-deep { + .ant-input-borderless{ + padding: 0; + padding-top: 4px; + color: black; + resize:none; + } + } + } \ No newline at end of file diff --git a/src/app/routes/usercenter/components/driver/captain/add/add.component.spec.ts b/src/app/routes/usercenter/components/driver/captain/add/add.component.spec.ts new file mode 100644 index 00000000..763d7784 --- /dev/null +++ b/src/app/routes/usercenter/components/driver/captain/add/add.component.spec.ts @@ -0,0 +1,24 @@ +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; +import { CtcCaptatinAddComponent } from './add.component'; + +describe('CtcCaptatinAddComponent', () => { + let component: CtcCaptatinAddComponent; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ CtcCaptatinAddComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CtcCaptatinAddComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/routes/usercenter/components/driver/captain/add/add.component.ts b/src/app/routes/usercenter/components/driver/captain/add/add.component.ts new file mode 100644 index 00000000..be248207 --- /dev/null +++ b/src/app/routes/usercenter/components/driver/captain/add/add.component.ts @@ -0,0 +1,384 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { apiConf } from '@conf/api.conf'; +import { SFComponent, SFSchema, SFUISchema, SFUploadWidgetSchema } from '@delon/form'; +import { _HttpClient } from '@delon/theme'; +import { EAEnvironmentService } from '@shared'; +import { NzModalRef } from 'ng-zorro-antd/modal'; +import { Observable, Observer } from 'rxjs'; +import { UsermanageService } from 'src/app/routes/usercenter/services/usercenter.service'; + + +@Component({ + selector: 'app-ctc-add', + templateUrl: './add.component.html', + styleUrls: ['./add.component.less'] +}) +export class CtcCaptatinAddComponent implements OnInit { + @ViewChild('sf', { static: false }) + sf!: SFComponent; + record: any = {}; + i: any; + schema!: SFSchema; + ui!: SFUISchema; + readFlag = false; + detailData: any = { + bankCardNo: '', + bankName: '', + mobile: '', + remark: '', + identityInfoDTO: { + certificatePhotoBackWatermark: '', + certificatePhotoFrontWatermark: '', + certificatePhotoFront: '', + certificatePhotoBack: '', + certificateNumber: '', + name: '', + } + } + + constructor( + private modal: NzModalRef, + private envSrv: EAEnvironmentService, + public service: UsermanageService + ) { } + + ngOnInit(): void { + this.initData() + this.initSF(); + } + initData() { + if (this.i && this.i.id) { + this.service.request(this.service.$api_captainrDetail, { id: this.i.id }).subscribe(res => { + if (res) { + this.detailData = res + this.detailData.identityInfoDTO.certificatePhotoFrontWatermark = [ + { + uid: -1, + name: 'LOGO', + status: 'done', + url: this.detailData.identityInfoDTO.certificatePhotoFrontWatermark, + response: this.detailData.identityInfoDTO.certificatePhotoFrontWatermark, + }, + ]; + this.detailData.identityInfoDTO.certificatePhotoBackWatermark = [ + { + uid: -1, + name: 'LOGO', + status: 'done', + url: this.detailData.identityInfoDTO.certificatePhotoBackWatermark, + response: this.detailData.identityInfoDTO.certificatePhotoBackWatermark, + }, + ]; + this.initSF(); + } + }) + } + + } + initSF() { + this.schema = { + properties: { + mobile: { + title: '手机号', + type: 'string', + format: 'mobile', + maxLength: 11, + ui: { + widget: this.i.id ? 'text' : '', + placeholder: '请输入手机号', + blur: () => { + this.service.request(this.service.$api_getByMobile, { mobile: this.sf.value.mobile }).subscribe(res => { + if (res.certificateNumber) { + this.readFlag = true + this.detailData = { + ...res, + mobile: this.sf.value.mobile, + bankName: this.sf.value.bankName, + bankCardNo: this.sf.value.bankCardNo, + remark: this.sf.value.remark, + identityInfoDTO: { + certificatePhotoFrontWatermark: [ + { + uid: -1, + name: 'LOGO', + status: 'done', + url: res.certificatePhotoFrontWatermark, + response: res.certificatePhotoFrontWatermark, + }], + certificatePhotoBackWatermark: [ + { + uid: -1, + name: 'LOGO', + status: 'done', + url: res.certificatePhotoBackWatermark, + response: res.certificatePhotoBackWatermark, + }], + name: res.name, + certificateNumber: res.certificateNumber, + certificatePhotoFront: res.certificatePhotoFront, + certificatePhotoBack: res.certificatePhotoBack, + } + } + this.initSF() + } else { + this.readFlag = false + this.detailData = {} + } + }) + } + }, + default: this.detailData.mobile + }, + name: { + title: '姓名', + type: 'string', + ui: { + widget: this.i.id ? 'text' : '', + placeholder: '请输入姓名', + }, + readOnly: this.readFlag, + default: this.detailData.identityInfoDTO.name + }, + bankCardNo: { + title: '银行卡号', + type: 'string', + ui: { + widget: this.i.id ? 'text' : '', + placeholder: '请输入银行卡号', + change: (val: any) =>{ + const value = val.replace(/\D/g,'') + this.sf.setValue('/bankCardNo', value) + }, + errors: { + required: '请输入银行账号', + }, + }, + default: this.detailData.bankCardNo + }, + bankName: { + title: '开户行', + type: 'string', + ui: { + widget: this.i.id ? 'text' : '', + placeholder: '请输入开户行', + }, + default: this.detailData.bankName + }, + showName: { + title: '身份证照片', + type: 'string', + readOnly: true, + ui: { + widget: 'textarea', + showRequired: true, + borderless:true, + }, + default: '请上传身份证原件的高清照片,若上传复印件,则需加盖公司印章及法人签字;上传后系统会自动识别并填写', + }, + tipsA: { + title: '', + type: 'string', + ui: { + widget: 'custom', + offsetControl: 6, + }, + }, + certificatePhotoFrontWatermark: { + type: 'string', + title: '', + readOnly: this.i.id || this.readFlag, + ui: { + offsetControl: 6, + action: apiConf.fileUpload, + fileType: 'image/png,image/jpeg,image/jpg,image/gif', + limit: 1, + limitFileCount: 1, + resReName: 'data.fullFileWatermarkPath', + urlReName: 'data.fullFileWatermarkPath', + widget: 'upload', + descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过2M', + data: { + appId: this.envSrv.env.appId, + }, + name: 'multipartFile', + multiple: false, + listType: 'picture-card', + change: (args: any) => { + if (args.type === 'success') { + this.detailData.certificatePhotoFront = args.file.response.data.fullFilePath + this.checkIdCard(args.file.response.data.fullFilePath, 'front'); + } else { + this.detailData.certificatePhotoFront = '' + } + }, + beforeUpload: (file: any, _fileList: any) => { + return new Observable((observer: Observer) => { + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isLt2M) { + this.service.msgSrv.warning('图片大小超过2M!'); + observer.complete(); + return; + } + observer.next(isLt2M); + observer.complete(); + }); + }, + previewFile: (file: any) => { } + }, + default: this.detailData.identityInfoDTO.certificatePhotoFrontWatermark + }, + tipsB: { + title: '', + type: 'string', + ui: { + widget: 'custom', + offsetControl: 6, + }, + }, + certificatePhotoBackWatermark: { + type: 'string', + title: '', + readOnly: this.i.id || this.readFlag, + ui: { + offsetControl: 6, + action: apiConf.fileUpload, + fileType: 'image/png,image/jpeg,image/jpg,image/gif', + limit: 1, + limitFileCount: 1, + resReName: 'data.fullFileWatermarkPath', + urlReName: 'data.fullFileWatermarkPath', + widget: 'upload', + descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过2M', + data: { + appId: this.envSrv.env.appId, + }, + name: 'multipartFile', + multiple: false, + listType: 'picture-card', + change: (args: any) => { + if (args.type === 'success') { + this.detailData.certificatePhotoBack = args.file.response.data.fullFilePath + } else { + this.detailData.certificatePhotoBack = '' + } + }, + beforeUpload: (file: any, _fileList: any) => { + return new Observable((observer: Observer) => { + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isLt2M) { + this.service.msgSrv.warning('图片大小超过2M!'); + observer.complete(); + return; + } + observer.next(isLt2M); + observer.complete(); + }); + }, + previewFile: (file: any) => { } + }, + default: this.detailData.identityInfoDTO.certificatePhotoBackWatermark + }, + certificateNumber: { + title: '身份证号', + type: 'string', + readOnly: this.readFlag, + ui: { + widget: this.i.id ? 'text' : '', + placeholder: '请输入身份证号', + }, + default: this.detailData.identityInfoDTO.certificateNumber + }, + remark: { + title: '备注', + type: 'string', + maxLength: 100, + ui: { + widget: this.i.id ? 'text' : 'textarea', + placeholder: '请输入备注', + autosize: { minRows: 2, maxRows: 6 }, + }, + default: this.detailData.remark + }, + }, + required: ['name', 'mobile', 'bankCardNo', 'certificateNumber', 'certificatePhotoBackWatermark', 'certificatePhotoFrontWatermark'], + }; + this.ui = { + '*': { + spanLabelFixed: 120, + grid: { span: 24 }, + }, + }; + // setTimeout(() => { + // if (this.readFlag) { + // this.detailData.identityInfoDTO.certificatePhotoFrontWatermark = [ + // { + // uid: -1, + // name: 'LOGO', + // status: 'done', + // url: this.detailData.certificatePhotoFrontWatermark, + // response: this.detailData.certificatePhotoFrontWatermark, + // }, + // ]; + // this.detailData.identityInfoDTO.certificatePhotoBackWatermark = [ + // { + // uid: -1, + // name: 'LOGO', + // status: 'done', + // url: this.detailData.certificatePhotoBackWatermark, + // response: this.detailData.certificatePhotoBackWatermark, + // }, + // ]; + // this.sf.setValue('/mobile', this.detailData.mobile) + // this.sf.setValue('/name', this.detailData.name) + // this.sf.setValue('/certificateNumber', this.detailData.certificateNumber) + // this.sf.setValue('/certificatePhotoFrontWatermark', this.detailData.identityInfoDTO.certificatePhotoFrontWatermark) + // this.sf.setValue('/certificatePhotoBackWatermark', this.detailData.identityInfoDTO.certificatePhotoBackWatermark) + // } + // }, 500) + + } + + checkIdCard(imgurl: any, side: any) { + // 识别身份证 参数side:0-正面、1-背面;type:0-申请人身份证,1-法定代表人身份证 + const params = { + idCardUrl: imgurl, + side, + }; + this.service.request(this.service.$api_checkIdCard, params).subscribe((res) => { + if (res) { + this.sf.setValue('/name', res.name); + this.sf.setValue('/certificateNumber', res.number); + } + }); + } + close(): void { + this.modal.destroy(); + } + sure() { + const params: any = { + bankCardNo: this.sf.value.bankCardNo, + bankName: this.sf.value.bankName, + mobile: this.sf.value.mobile, + remark: this.sf.value.remark, + identityInfoDTO: { + certificatePhotoBackWatermark: this.sf.value.certificatePhotoBackWatermark, + certificatePhotoFrontWatermark: this.sf.value.certificatePhotoFrontWatermark, + certificatePhotoFront: this.detailData.certificatePhotoFront, + certificatePhotoBack: this.detailData.certificatePhotoBack, + certificateNumber: this.sf.value.certificateNumber, + name: this.sf.value.name, + } + } + if (this.i.id) { + params.id = this.i.id + } + delete params.showName + this.service.request(this.service.$api_saveCaptainr, params).subscribe(res => { + if (res) { + this.service.msgSrv.success('保存成功') + this.modal.close(true) + } + }) + + } +} diff --git a/src/app/routes/usercenter/components/driver/captain/captain.component.html b/src/app/routes/usercenter/components/driver/captain/captain.component.html index 273281de..6c22cbdc 100644 --- a/src/app/routes/usercenter/components/driver/captain/captain.component.html +++ b/src/app/routes/usercenter/components/driver/captain/captain.component.html @@ -1,10 +1,10 @@ @@ -16,8 +16,24 @@
- - + + +
+ + [loading]="service.http.loading" + > - - {{ item.promotersTelephone ||'添加' }} + + {{ item.promotersTelephone || '添加' }} -
@@ -52,4 +74,4 @@
-
\ No newline at end of file + diff --git a/src/app/routes/usercenter/components/driver/captain/captain.component.ts b/src/app/routes/usercenter/components/driver/captain/captain.component.ts index 239ffc5a..123aaa9d 100644 --- a/src/app/routes/usercenter/components/driver/captain/captain.component.ts +++ b/src/app/routes/usercenter/components/driver/captain/captain.component.ts @@ -2,9 +2,11 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { STColumn, STColumnBadge, STComponent, STData } from '@delon/abc/st'; import { SFComponent, SFSchema, SFUISchema } from '@delon/form'; +import { ModalHelper } from '@delon/theme'; import { DynamicSettingModalComponent } from '@shared'; import { NzModalService } from 'ng-zorro-antd/modal'; import { UsermanageService } from '../../../services/usercenter.service'; +import { CtcCaptatinAddComponent } from './add/add.component'; @Component({ selector: 'app-usercenter-components-driver-captain', templateUrl: './captain.component.html', @@ -23,7 +25,7 @@ export class UserCenterComponentsDriverCaptainComponent implements OnInit { promoterModal!: any; promotersTelephone = ''; - constructor(public service: UsermanageService, private modal: NzModalService, private router: Router, private ar: ActivatedRoute) {} + constructor(public service: UsermanageService, private modal: NzModalService, private router: Router, private ar: ActivatedRoute, private modalHelper: ModalHelper,) {} /** * 查询参数 @@ -218,15 +220,23 @@ export class UserCenterComponentsDriverCaptainComponent implements OnInit { click: item => { this.router.navigate(['/usercenter/driver/captain/detail', item.appUserId]); }, - acl: { ability: ['USERCENTER-DRIVER-CAPTAIN-view'] }, + acl: { ability: ['USERCENTER-DRIVER-CAPTAIN-view'] } }, { text: '基础设置', click: item => this.settingAction(item), - acl: { ability: ['USERCENTER-DRIVER-CAPTAIN-basicSetting'] }, + acl: { ability: ['USERCENTER-DRIVER-CAPTAIN-basicSetting'] } } ] } ]; } + /** + * 新增单个实例 + */ + add() { + this.modalHelper.create(CtcCaptatinAddComponent, { i: { id: '' } }, { size: 900 }).subscribe(res => { + this.st.reload(); + }); + } } diff --git a/src/app/routes/usercenter/services/usercenter.service.ts b/src/app/routes/usercenter/services/usercenter.service.ts index 71fe2111..f005382d 100644 --- a/src/app/routes/usercenter/services/usercenter.service.ts +++ b/src/app/routes/usercenter/services/usercenter.service.ts @@ -1,10 +1,10 @@ /* * @Author: your name * @Date: 2021-11-29 15:22:34 - * @LastEditTime: 2022-01-05 10:30:26 - * @LastEditors: Please set LastEditors + * @LastEditTime : 2022-02-16 09:55:50 + * @LastEditors : Shiming * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - * @FilePath: \tms-obc-web\src\app\routes\usercenter\services\usercenter.service.ts + * @FilePath : \\tms-obc-web\\src\\app\\routes\\usercenter\\services\\usercenter.service.ts */ import { Injectable, Injector } from '@angular/core'; import { cacheConf } from '@conf/cache.conf'; @@ -121,6 +121,13 @@ export class UsermanageService extends ShipperBaseService { $api_getRegionByCode = '/api/mdc/pbc/region/getRegionByCode'; // 新增熟车 $api_enterpriseVehicleSave = `/api/mdc/cuc/enterpriseVehicle/save`; + + // 结算单-新增车队长 + $api_saveCaptainr = '/api/mdc/cuc/enterpriseSettleDriver/saveCaptainr'; + // 结算单-车队长详情 + $api_captainrDetail = '/api/mdc/cuc/enterpriseSettleDriver/captainrDetail'; + // 根据手机号码查询结算单司机 + $api_getByMobile = '/api/mdc/cuc/identityInfo/getByMobile'; constructor(public injector: Injector, private nzModalService: NzModalService, public eaCacheSrv: EACacheService) { super(injector, eaCacheSrv); } diff --git a/src/app/routes/usercenter/usercenter.module.ts b/src/app/routes/usercenter/usercenter.module.ts index dd8d6579..b79e4650 100644 --- a/src/app/routes/usercenter/usercenter.module.ts +++ b/src/app/routes/usercenter/usercenter.module.ts @@ -23,6 +23,7 @@ import { UsercenterRoutingModule } from './usercenter-routing.module'; import { AuditAdminComponent } from './components/freight/enterprise-audit/audit-admin/audit-admin.component'; import { CaptainDetailComponent } from './components/driver/captain/captain-detail/captain-detail.component'; import { CarSettleAddDriverComponent } from './components/driver/add-driver/add-driver.component'; +import { CtcCaptatinAddComponent } from './components/driver/captain/add/add.component'; const COMPONENTS = [ FreightComponentsListComponent, @@ -38,7 +39,8 @@ const COMPONENTS = [ UserCenterComponentsDriverCaptainComponent, CaptainDetailComponent, AuditAdminComponent, - CarSettleAddDriverComponent + CarSettleAddDriverComponent, + CtcCaptatinAddComponent ]; @NgModule({