This commit is contained in:
Taric Xin
2021-12-20 15:15:13 +08:00
parent c3f31cc224
commit bce661246c
15 changed files with 272 additions and 124 deletions

View File

@ -28,11 +28,13 @@
申请时间:{{userDetail?.createTime}}
</div>
<div nz-col [nzXl]="8" [nzLg]="8" [nzSm]="24" [nzXs]="24" class="d-flex"
style="justify-content: flex-end;">
<button [nzLoading]="service.http.loading" nz-button nzType="primary" nzGhost (click)="userAction(1)">
style="justify-content: flex-end;padding-right: 24px;">
<button *ngIf="userDetail?.stateLocked" [nzLoading]="service.http.loading" nz-button nzType="primary"
nzGhost (click)="userAction(1)">
启用
</button>
<button [nzLoading]="service.http.loading" nz-button nzDanger (click)="userAction(0)">
<button *ngIf="!userDetail?.stateLocked" [nzLoading]="service.http.loading" nz-button nzDanger nzGhost
(click)="userAction(0)">
冻结
</button>
</div>
@ -54,29 +56,49 @@
nzType="close-circle" nzTheme="fill" class="mr-xs"></i>驳回
</label>
<div style="float: right;">
<button nz-button nzType="default" nzDanger (click)="auditPass()" *ngIf="userIdentityDetail.certificationStatus===0">审核通过</button>
<button nz-button nzType="default" nzDanger (click)="auditNo()" *ngIf="userIdentityDetail.certificationStatus===0">驳回审核</button>
<button nz-button nzType="default" nzDanger (click)="ratify()">修改</button>
<ng-container *ngIf="isEditUser; else elseTemplate">
<button [nzLoading]="service.http.loading" nz-button (click)="reset()">
取消
</button>
<button [nzLoading]="service.http.loading" nz-button nzDanger (click)="saveUser()">
保存
</button>
</ng-container>
<ng-template #elseTemplate>
<button nz-button nzType="default" nzDanger (click)="auditPass()"
*ngIf="userIdentityDetail.certificationStatus===0" [nzLoading]="service.http.loading">审核通过</button>
<button nz-button nzType="default" nzDanger (click)="auditNo()"
*ngIf="userIdentityDetail.certificationStatus===0" [nzLoading]="service.http.loading">驳回审核</button>
<button nz-button nzType="default" nzDanger (click)="ratify()">修改</button>
</ng-template>
</div>
</sv-title>
<sv label="姓名">
{{ userIdentityDetail?.name }}
<input nz-input type="text" [(ngModel)]="userIdentityDetail.name" [readonly]="!isEditUser"
[nzBorderless]="!isEditUser" [placeholder]="isEditUser?'':'-'">
</sv>
<sv label="身份证号码">
{{ userIdentityDetail?.certificateNumber }}
<input nz-input type="text" [(ngModel)]="userIdentityDetail.certificateNumber" [readonly]="!isEditUser"
[nzBorderless]="!isEditUser" [placeholder]="isEditUser?'':'-'">
</sv>
<sv label="身份证照">
<app-imagelist
[imgList]="[userIdentityDetail?.certificatePhotoFrontWatermark,userIdentityDetail?.certificatePhotoBackWatermark]">
</app-imagelist>
<div class="d-flex">
<ng-container
*ngTemplateOutlet="uploadTemplate;context:{data:userIdentityDetail,status:isEditUser,key:'certificatePhotoFrontWatermark',key2:'certificatePhotoFront',hover:'certificateBackFront'}">
</ng-container>
<ng-container
*ngTemplateOutlet="uploadTemplate;context:{data:userIdentityDetail,status:isEditUser,key:'certificatePhotoBackWatermark',key2:'certificatePhotoBack',hover:'certificateBack'}">
</ng-container>
</div>
</sv>
</sv-container>
<nz-divider></nz-divider>
<sv-container col="3" class="mt16">
<sv-title>关联企业</sv-title>
<!-- <st #st [bordered]="true" [columns]="columns" [data]="detailData.goodsList" [ngStyle]="{ margin: '1rem 0' }"
multiSort size="small" [page]="{ show: false }">
</st> -->
<st #st [columns]="columns" [data]="service.$api_get_driver_projects" size="small"
[req]="{ method: 'POST', allInBody: true, params: {appUserId:route.snapshot.params.id} }"
[res]="{ reName: { list: 'data' } }" [page]="{ show: false }" style="width: 100%;">
</st>
</sv-container>
</nz-card>
@ -99,4 +121,27 @@
</se>
</div>
</div>
</ng-template>
<ng-template #uploadTemplate let-data="data" let-status="status" let-key="key" let-key2="key2" let-hover="hover">
<nz-upload class="avatar-uploader" [nzAction]="uploadURl" nzName="multipartFile" nzListType="picture-card"
[nzShowUploadList]="false" nzFileType="image/png,image/jpeg,image/jpg,image/gif"
[nzDisabled]="!status || disabledUpload" (nzChange)="changeUpload($event,data,key,key2)">
<ng-container *ngIf="!data[key] && status">
<i class="upload-icon" nz-icon [nzType]="service.http.loading ? 'loading' : 'plus'"></i>
<div class="ant-upload-text">上传</div>
</ng-container>
<div *ngIf="data[key]" (mouseover)="data[hover]=true" (mouseleave)="data[hover]=false"
(click)="$event.cancelBubble=true" class="image-hover">
<img [src]="data[key]" style="width: 200px;height: 160px;" (click)="showImg(data[key])" />
<div class="mask" *ngIf="data[hover] && status"></div>
<div class="mask-over" *ngIf="data[hover] && status">
<i nz-icon nzType="close-circle" nzTheme="fill" class="delete-icon" (click)="deleteImg(data,key,key2)"></i>
<div style="display: flex;align-items: center;">
<i nz-icon nzType="eye" nzTheme="fill" class="show-icon" (click)="showImg(data[key])"></i>
</div>
</div>
</div>
</nz-upload>
</ng-template>

View File

@ -1,10 +1,12 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { apiConf } from '@conf/api.conf';
import { STColumn, STComponent } from '@delon/abc/st';
import { SFComponent, SFDateWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
import { ModalHelper, _HttpClient } from '@delon/theme';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalService } from 'ng-zorro-antd/modal';
import { ImageViewComponent } from 'src/app/shared/components/imagelist';
import { UsermanageService } from '../../../../services/usercenter.service';
@Component({
@ -18,29 +20,27 @@ export class FreightComponentsUserDetailComponent implements OnInit {
userDetail: any = {};
userIdentityDetail: any = {};
tempalateUserIdentityDetail = { ...this.userIdentityDetail };
@ViewChild('st', { static: false }) st!: STComponent;
columns: STColumn[] = [
{ title: '企业名称', index: 'perPrice', width: 300, className: 'text-center' },
{ title: '项目名称', index: 'goodsQuantity', width: 300, className: 'text-center' },
{ title: '角色', index: 'totalPrice', width: 300, className: 'text-center' }
{ title: '企业名称', className: 'text-center', index: 'enterpriseName' },
{ title: '项目名称', className: 'text-center', index: 'projectName' },
{ title: '角色', className: 'text-center', index: 'roleName' }
];
approvalOpinion = '';
reasonTags = ['身份证照片太丑', '姓名与身份证号不匹配'];
constructor(private nzModalService: NzModalService, public service: UsermanageService, private route: ActivatedRoute) {}
isEditUser = false;
uploadURl = apiConf.waterFileUpload;
disabledUpload = false;
constructor(private nzModalService: NzModalService, public service: UsermanageService, public route: ActivatedRoute) {}
ngOnInit() {
this.initData();
// this.launchSign();
}
async initData() {
console.log(this.route.snapshot, 'this.route.snapshot');
const params = {
id: this.route.snapshot.params.id
// tenantId: this.route.snapshot.queryParams.tenantId,
};
// 获取司机头部信息
this.service
.request(this.service.$api_get_user_detail, {
@ -59,6 +59,7 @@ export class FreightComponentsUserDetailComponent implements OnInit {
.subscribe(res => {
if (res) {
this.userIdentityDetail = res;
this.tempalateUserIdentityDetail = { ...this.userIdentityDetail };
}
});
}
@ -71,8 +72,19 @@ export class FreightComponentsUserDetailComponent implements OnInit {
? '停用后,该用户将被限制使用,不限于访问受限、无法发布货源等,请谨慎操作'
: '启用后,该用户将恢复正常使用功能,请再次确认',
nzOnOk: () => {
// this.service.request(this.service.$api_lock_user)
this.st.reload();
this.service
.request(this.service.$api_lock_or_free_user, {
appUserId: [this.userDetail.appUserId],
freezeOrResume: !!!status,
pageName: '货主员工',
telephone: this.userDetail.phone
})
.subscribe(res => {
if (res) {
this.service.msgSrv.success('操作成功');
}
this.initData();
});
}
});
}
@ -118,7 +130,62 @@ export class FreightComponentsUserDetailComponent implements OnInit {
});
}
ratify() {}
/**
* 开启修改
* @param type 修改类型
*/
ratify() {
this.isEditUser = true;
}
/**
* 需求修改
* @param type 修改类型
*/
reset() {
this.userIdentityDetail = { ...this.tempalateUserIdentityDetail };
this.isEditUser = false;
}
saveUser() {
const params = { ...this.userIdentityDetail };
this.service.request(this.service.$api_update_driver_identity, params).subscribe(res => {
if (res) {
this.service.msgSrv.success('修改成功');
this.isEditUser = false;
this.initData();
}
});
}
changeUpload({ file, fileList, type }: any, data: any, key: string, key2: string) {
if (type === 'success') {
data[key] = file.response.data?.fullFileWatermarkPath;
data[key2] = file.response.data?.fullFilePath;
}
}
showImg(url: any) {
const params = {
imgList: [url],
index: 0
};
this.nzModalService.create({ nzContent: ImageViewComponent, nzComponentParams: { params } });
}
deleteImg(data: any, key: string, key2: string) {
this.nzModalService.warning({
nzTitle: '是否确认删除该图片',
nzOnOk: () => {
this.disabledUpload = true;
data[key] = '';
data[key2] = '';
setTimeout(() => {
this.disabledUpload = false;
}, 100);
}
});
}
goBack() {
window.history.go(-1);