edit
This commit is contained in:
@ -4,257 +4,181 @@ import { STColumn, STComponent } from '@delon/abc/st';
|
||||
import { SFComponent, SFDateWidgetSchema, SFSchema, SFTagWidgetSchema, SFTextWidgetSchema, 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 { UsermanageService } from '../../../services/usercenter.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-usercenter-components-driver-detail',
|
||||
templateUrl: './detail.component.html',
|
||||
styleUrls: ['./detail.component.less'],
|
||||
styleUrls: ['./detail.component.less']
|
||||
})
|
||||
export class UserCenterComponentsDriverDetailComponent implements OnInit {
|
||||
i: any;
|
||||
url = `/rule?_allow_anonymous=true`;
|
||||
@ViewChild('st', { static: false }) st!: STComponent;
|
||||
detailData: any;
|
||||
isShow = false;
|
||||
isVisible = false;
|
||||
isVisibleNo = false;
|
||||
modalTitle = '有效期';
|
||||
modalName = '';
|
||||
ui!: SFUISchema;
|
||||
schema!: SFSchema;
|
||||
ui2!: SFUISchema;
|
||||
schema2!: SFSchema;
|
||||
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
||||
schema1!: SFSchema;
|
||||
@ViewChild('sf2', { static: false }) sf2!: SFComponent;
|
||||
validData: any = ['suppliersType'];
|
||||
suppliersData: any = {};
|
||||
userDetail: any;
|
||||
userIdentityDetail: any;
|
||||
driverDetail: any;
|
||||
licenseDetail: any;
|
||||
carList: any = [];
|
||||
|
||||
constructor(
|
||||
private http: _HttpClient,
|
||||
private modal: ModalHelper,
|
||||
public service: UsermanageService,
|
||||
private route: ActivatedRoute,
|
||||
private modalHelper: ModalHelper,
|
||||
private msgSrv: NzMessageService,
|
||||
) {}
|
||||
@ViewChild('redectModal', { static: false })
|
||||
redectModal!: any;
|
||||
@ViewChild('rejectedDriverModal', { static: false })
|
||||
rejectedDriverModal!: any;
|
||||
approvalOpinion = '';
|
||||
constructor(private nzModalService: NzModalService, public service: UsermanageService, private route: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
console.log(this.route.snapshot);
|
||||
// this.initData();
|
||||
this.initSF();
|
||||
this.initSFNo();
|
||||
// this.launchSign();
|
||||
this.initData();
|
||||
}
|
||||
/**
|
||||
* 初始化查询表单
|
||||
*/
|
||||
initSF() {
|
||||
this.schema = {
|
||||
properties: {
|
||||
_$expand: { type: 'boolean', ui: { hidden: true } },
|
||||
effectiveDate: {
|
||||
title: '有效期',
|
||||
type: 'string',
|
||||
ui: {
|
||||
widget: 'date',
|
||||
format: 'yyyy-MM-dd 00:00:00',
|
||||
// hidden: this.modalName === 'effectiveDate' ? false : true,
|
||||
} as SFDateWidgetSchema,
|
||||
},
|
||||
},
|
||||
required: ['effectiveDate'],
|
||||
};
|
||||
this.ui = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
|
||||
initData() {
|
||||
// 获取司机头部信息
|
||||
this.service
|
||||
.request(this.service.$api_get_user_detail, {
|
||||
appUserId: this.route.snapshot.params.id
|
||||
})
|
||||
.subscribe(res => {
|
||||
if (res) {
|
||||
this.userDetail = res;
|
||||
}
|
||||
});
|
||||
// 获取用户个人信息
|
||||
this.service
|
||||
.request(this.service.$api_get_user_identity, {
|
||||
id: this.route.snapshot.params.id
|
||||
})
|
||||
.subscribe(res => {
|
||||
if (res) {
|
||||
this.userIdentityDetail = res;
|
||||
}
|
||||
});
|
||||
// 获取驾驶证信息
|
||||
this.service
|
||||
.request(this.service.$api_get_driver_license, { appUserId: this.route.snapshot.params.id }, 'POST', false)
|
||||
.subscribe(res => {
|
||||
if (res) {
|
||||
this.driverDetail = res;
|
||||
}
|
||||
});
|
||||
// 获取从业资格证信息
|
||||
this.service
|
||||
.request(this.service.$api_get_driver_practice_seniority, { appUserId: this.route.snapshot.params.id }, 'POST', false)
|
||||
.subscribe(res => {
|
||||
if (res) {
|
||||
this.licenseDetail = res;
|
||||
}
|
||||
});
|
||||
// 获取载具信息
|
||||
this.service
|
||||
.request(this.service.$api_get_driver_car_license, { appUserId: this.route.snapshot.params.id }, 'POST', false)
|
||||
.subscribe(res => {
|
||||
if (res) {
|
||||
this.carList = res;
|
||||
}
|
||||
});
|
||||
}
|
||||
initSFNo() {
|
||||
this.schema2 = {
|
||||
properties: {
|
||||
'姓名': { type: 'number', ui: { widget: 'text', defaultText: '深圳市星链供应链云科技有限公' } as SFTextWidgetSchema },
|
||||
roleDescription: {
|
||||
title: '备注',
|
||||
type: 'string',
|
||||
maxLength: 30,
|
||||
ui: {
|
||||
placeholder: '请输入地址',
|
||||
widget: 'textarea',
|
||||
|
||||
userAction(status: number) {
|
||||
this.nzModalService.warning({
|
||||
nzTitle: status === 1 ? '确定启用该司机吗?' : '确定冻结该司机吗?',
|
||||
nzContent: status === 1 ? '停用后,司机将被限制使用,无法登陆,请谨慎操作!' : '启用后,该司机将恢复正常使用功能,请再次确认!',
|
||||
nzOnOk: () => {
|
||||
// this.service.request(this.service.$api_lock_user)
|
||||
this.initData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
approveUser() {
|
||||
this.nzModalService.confirm({
|
||||
nzTitle: '审核通过',
|
||||
nzContent: `是否确认通过(姓名:${this.userDetail?.name})审核`,
|
||||
nzOnOk: () => {
|
||||
this.adjuctUser({ auditStatus: 0, auditType: 0, identityId: this.userIdentityDetail?.id }, '审核通过');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
rejectedUser() {
|
||||
this.approvalOpinion = '';
|
||||
this.nzModalService.create({
|
||||
nzTitle: '审核驳回',
|
||||
nzContent: this.redectModal,
|
||||
nzOnOk: () => {
|
||||
if (!this.approvalOpinion) {
|
||||
return false;
|
||||
}
|
||||
this.adjuctUser(
|
||||
{
|
||||
auditStatus: 1,
|
||||
auditType: 0,
|
||||
identityId: this.userIdentityDetail?.id,
|
||||
certificationOpinions: this.approvalOpinion
|
||||
},
|
||||
'审核驳回成功'
|
||||
);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
approveDriver() {
|
||||
this.nzModalService.confirm({
|
||||
nzTitle: '审核通过',
|
||||
nzContent: `<p>驾驶证号:${this.driverDetail?.licenseNo}</p><p>从业资格证号:${this.licenseDetail?.licenseNo}</p><p>是否确认通过审核`,
|
||||
nzOnOk: () => {
|
||||
this.adjuctDriverLicense(
|
||||
{
|
||||
auditStatus: 20,
|
||||
appUserId: this.userDetail?.appUserId,
|
||||
},
|
||||
like: {
|
||||
type: 'number',
|
||||
title: '可选理由',
|
||||
enum: [
|
||||
{ value: 1, label: '电影' },
|
||||
{ value: 2, label: '书' },
|
||||
{ value: 3, label: '旅行' },
|
||||
],
|
||||
ui: {
|
||||
widget: 'tag',
|
||||
} as SFTagWidgetSchema,
|
||||
default: [1, 2],
|
||||
},
|
||||
},
|
||||
required: ['roleDescription'],
|
||||
};
|
||||
this.ui2 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
|
||||
}
|
||||
showModal(name: any) {
|
||||
this.modalName = name;
|
||||
if (name === 'effectiveDate') {
|
||||
this.isShow = true;
|
||||
} else {
|
||||
this.isVisible = true;
|
||||
}
|
||||
}
|
||||
async initData() {
|
||||
console.log(this.route.snapshot, 'this.route.snapshot');
|
||||
|
||||
const params = {
|
||||
tenantId: this.route.snapshot.params.id,
|
||||
// tenantId: this.route.snapshot.queryParams.tenantId,
|
||||
};
|
||||
const res = await this.service.asyncRequest(this.service.$api_get_one, params);
|
||||
// // 商品资质
|
||||
// if (res.enterpriseBusinessJson) {
|
||||
// res.enterpriseBusinessJson.aptitudes = res.enterpriseBusinessJson?.aptitudes ? res.enterpriseBusinessJson.aptitudes.split(',') : [];
|
||||
// }
|
||||
// // // 申请人身份证证件
|
||||
// // res.applyUserJson.imagelist = [];
|
||||
// // res.applyUserJson.imagelist.push(res.applyUserJson.certificatePhotoFront);
|
||||
// // res.applyUserJson.imagelist.push(res.applyUserJson.certificatePhotoBack);
|
||||
// // res.applyUserJson.imagelist.push(res.applyUserJson.handCertificate);
|
||||
|
||||
// 法人身份证证件
|
||||
const imagelist = [];
|
||||
imagelist.push(res?.certificatePhotoFront);
|
||||
imagelist.push(res?.certificatePhotoBack);
|
||||
res.certificatePhoto = imagelist;
|
||||
|
||||
// 营业执照
|
||||
res.enterpriseQualificationCertificate = res.enterpriseQualificationCertificate
|
||||
? res.enterpriseQualificationCertificate.split(',')
|
||||
: [];
|
||||
|
||||
// 返回所在地
|
||||
res.enterpriseAddressCodeStr = await this.getRegionFullName(res.enterpriseAddressCode);
|
||||
|
||||
this.detailData = res;
|
||||
this.suppliersData = {
|
||||
suppliersType: res?.suppliersType,
|
||||
externalSuppliersId: res?.externalSuppliersId,
|
||||
};
|
||||
'审核成功'
|
||||
);}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据地区code查询地区详情
|
||||
* @param code 地区代码
|
||||
*/
|
||||
async getRegionFullName(code: any) {
|
||||
const params = {
|
||||
regionCode: code,
|
||||
};
|
||||
const res = await this.service.asyncRequest(this.service.$api_get_one, params, 'POST', true);
|
||||
// if (res && res.regionFullName) {
|
||||
// const arr = res.regionFullName.split(',');
|
||||
// res.regionFullName = arr.reverse().join('-');
|
||||
// }
|
||||
return res && res.regionFullName;
|
||||
rejectedDriver() {
|
||||
this.approvalOpinion = '';
|
||||
this.nzModalService.create({
|
||||
nzTitle: '审核驳回',
|
||||
nzContent: this.rejectedDriverModal,
|
||||
nzOnOk: () => {
|
||||
if (!this.approvalOpinion) {
|
||||
return false;
|
||||
}
|
||||
this.adjuctDriverLicense(
|
||||
{
|
||||
auditStatus: 30,
|
||||
appUserId: this.userDetail?.appUserId,
|
||||
approvalOpinion: this.approvalOpinion
|
||||
},
|
||||
'审核驳回成功'
|
||||
);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
add() {
|
||||
// this.modal
|
||||
// .createStatic(FormEditComponent, { i: { id: 0 } })
|
||||
// .subscribe(() => this.st.reload());
|
||||
|
||||
private adjuctUser(params: any, msg: string) {
|
||||
this.service.request(this.service.$api_approve_identity, { ...params }).subscribe(res => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success(msg);
|
||||
}
|
||||
this.initData();
|
||||
});
|
||||
}
|
||||
|
||||
private adjuctDriverLicense(params: any, msg: string) {
|
||||
this.service.request(this.service.$api_approve_driver_license, { ...params }).subscribe(res => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success(msg);
|
||||
}
|
||||
this.initData();
|
||||
});
|
||||
}
|
||||
|
||||
ratify() {}
|
||||
|
||||
goBack() {
|
||||
window.history.go(-1);
|
||||
}
|
||||
/**
|
||||
* 冻结
|
||||
*/
|
||||
freezeOrResume(type: number) {
|
||||
console.log(type)
|
||||
// this.service.http
|
||||
// .post(this.service.$api_set_freezeOrResume, {
|
||||
// tenantId: this.route.snapshot.params.id,
|
||||
// // tenantId: this.route.snapshot.queryParams.tenantId,
|
||||
// status: type,
|
||||
// })
|
||||
// .subscribe((res) => {
|
||||
// if (res.data === true) {
|
||||
// if (type === 0) {
|
||||
// this.service.msgSrv.success(`启用成功!`);
|
||||
// } else if (type === 1) {
|
||||
// this.service.msgSrv.success(`冻结成功!`);
|
||||
// }
|
||||
// this.ngOnInit();
|
||||
// } else {
|
||||
// this.service.msgSrv.error(res.msg || '操作失败!');
|
||||
// }
|
||||
// });
|
||||
}
|
||||
PayOrResume(type: number) {
|
||||
console.log(type)
|
||||
// this.service.http
|
||||
// .post(this.service.$api_set_freezeOrResume, {
|
||||
// tenantId: this.route.snapshot.params.id,
|
||||
// // tenantId: this.route.snapshot.queryParams.tenantId,
|
||||
// status: type,
|
||||
// })
|
||||
// .subscribe((res) => {
|
||||
// if (res.data === true) {
|
||||
// if (type === 0) {
|
||||
// this.service.msgSrv.success(`启用成功!`);
|
||||
// } else if (type === 1) {
|
||||
// this.service.msgSrv.success(`冻结成功!`);
|
||||
// }
|
||||
// this.ngOnInit();
|
||||
// } else {
|
||||
// this.service.msgSrv.error(res.msg || '操作失败!');
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
handleCancel(name: any) {
|
||||
if (name === 'suppliersTypeNo') {
|
||||
this.isVisibleNo = false;
|
||||
} else {
|
||||
this.isVisible = false;
|
||||
}
|
||||
}
|
||||
handleOK() {
|
||||
const params: any = {
|
||||
tenantId: this.route.snapshot.params.id,
|
||||
// tenantId: this.route.snapshot.queryParams.tenantId,
|
||||
};
|
||||
|
||||
// if (name === 'effectiveDate') {
|
||||
// params.effectiveDate = this.sf?.value?.effectiveDate;
|
||||
// } else {
|
||||
// Object.assign(params, this.sf1?.value);
|
||||
// }
|
||||
// this.service.http.post(this.service.$api_set_freezeOrResume, params).subscribe((res) => {
|
||||
// if (res.data === true) {
|
||||
// this.service.msgSrv.success(`编辑成功!`);
|
||||
// this.ngOnInit();
|
||||
// } else {
|
||||
// this.service.msgSrv.error(res.msg || '编辑失败!');
|
||||
// }
|
||||
// if (name === 'effectiveDate') {
|
||||
// this.isShow = false;
|
||||
// } else {
|
||||
// this.isVisible = false;
|
||||
// }
|
||||
// });
|
||||
}
|
||||
auditPass() {
|
||||
this.isVisible = true
|
||||
}
|
||||
auditNo() {
|
||||
this.isVisibleNo = true
|
||||
}
|
||||
ratify() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user