This commit is contained in:
wangshiming
2022-02-16 10:00:40 +08:00
parent 9eb716ecd2
commit faae5ca73b
8 changed files with 535 additions and 20 deletions

View File

@ -0,0 +1,30 @@
<div class="modal-header">
<div class="modal-title">添加车队长</div>
</div>
<div>
<sf #sf [compact]="true" [ui]="ui" [schema]="schema" [button]="'none'">
<ng-template sf-template="tipsA" let-me let-ui="ui" let-schema="schema">
<div class="pr">
<dl class="tips">
<dt>正面照</dt>
<dd>示例</dd>
</dl>
<div class="pa"><img height="104" src="/assets/images/eg01.png" /></div>
</div>
</ng-template>
<ng-template sf-template="tipsB" let-me let-ui="ui" let-schema="schema">
<div class="pr">
<dl class="tips">
<dt>背面照</dt>
<dd>示例</dd>
</dl>
<div class="pa"><img height="104" src="/assets/images/eg02.png" /></div>
</div>
</ng-template>
</sf>
</div>
<div class="modal-footer">
<button nz-button type="button" (click)="close()" *ngIf="i.id === ''">取消</button>
<button nz-button type="button" (click)="close()" *ngIf="i.id">关闭</button>
<button nz-button type="button" nzType="primary" (click)="sure()" [disabled]="!sf?.valid" *ngIf="i.id === ''">确定</button>
</div>

View File

@ -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;
}
}
}

View File

@ -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<CtcCaptatinAddComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CtcCaptatinAddComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CtcCaptatinAddComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -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<boolean>) => {
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<boolean>) => {
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) {
// 识别身份证 参数side0-正面、1-背面type0-申请人身份证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)
}
})
}
}

View File

@ -1,10 +1,10 @@
<!--
* @Author: your name
* @Date: 2021-11-29 15:22:34
* @LastEditTime: 2021-11-30 20:39:39
* @LastEditors: Please set LastEditors
* @LastEditTime : 2022-02-16 09:58:52
* @LastEditors : Shiming
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\usercenter\components\freight\list\list.component.html
* @FilePath : \\tms-obc-web\\src\\app\\routes\\usercenter\\components\\driver\\captain\\captain.component.html
-->
<!-- 页头 -->
<page-header-wrapper></page-header-wrapper>
@ -16,8 +16,24 @@
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
</div>
<div nz-col [nzXl]="_$expand ? 24 : 6" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="text-right">
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)" acl [acl-ability]="['USERCENTER-DRIVER-CAPTAIN-list']">查询</button>
<button nz-button nzType="primary" [disabled]="service.http.loading" (click)="exportList()" acl [acl-ability]="['USERCENTER-DRIVER-CAPTAIN-export']">导出</button>
<button
nz-button
nzType="primary"
[nzLoading]="service.http.loading"
(click)="st?.load(1)"
acl
[acl-ability]="['USERCENTER-DRIVER-CAPTAIN-list']"
>查询</button
>
<button
nz-button
nzType="primary"
[disabled]="service.http.loading"
(click)="exportList()"
acl
[acl-ability]="['USERCENTER-DRIVER-CAPTAIN-export']"
>导出</button
>
<button nz-button (click)="resetSF()" [disabled]="service.http.loading">重置</button>
<button nz-button nzType="link" (click)="expandToggle()">
{{ !_$expand ? '展开' : '收起' }}
@ -28,22 +44,28 @@
</nz-card>
<nz-card>
<!-- 数据列表 -->
<!-- [data]="service.$api_get_supplier_page" -->
<st #st [columns]="columns" [data]='service.$api_get_user_expand'
<!-- 工具栏 -->
<div class="toolbar" style="float: right;
padding-bottom: 15px;">
<button nz-button nzType="primary" (click)="add()">添加车队长</button>
</div>
<st
#st
[columns]="columns"
[data]="service.$api_get_user_expand"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' }, process: dataProcess }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loading]="service.http.loading">
[loading]="service.http.loading"
>
<ng-template st-row="promotersTelephone" let-item let-index="index">
<a (click)="addPromoter(item)" acl [acl-ability]="['USERCENTER-DRIVER-CAPTAIN-promoter']">
{{ item.promotersTelephone ||'添加' }}
<a (click)="addPromoter(item)" acl [acl-ability]="['USERCENTER-DRIVER-CAPTAIN-promoter']">
{{ item.promotersTelephone || '添加' }}
</a>
</ng-template>
</st>
</nz-card>
<ng-template #promoterModal>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="80">
@ -52,4 +74,4 @@
</se>
</div>
</div>
</ng-template>
</ng-template>

View File

@ -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();
});
}
}

View File

@ -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);
}

View File

@ -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({