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

@ -22,23 +22,44 @@ export class CartConfigActionModalComponent implements OnInit {
};
@Input()
configType: number = 1;
@Input()
params = {};
dictKey = '';
constructor(private modal: NzModalRef, public service: SystemService) {}
ngOnInit(): void {
this.initSF(this.i);
console.log(this.configType);
}
initSF(staff: any) {
let required: any = [];
let option: any = {};
switch (this.configType) {
case 1:
required = ['phone1'];
option = {
title: '车型',
ui: {
placeholder: '请输入'
}
};
this.dictKey = 'car:model';
break;
case 2:
required = ['phone2'];
option = {
title: '车长',
ui: {
placeholder: '请输入',
addOnAfter: '米'
} as SFStringWidgetSchema
};
this.dictKey = 'car:length';
break;
case 3:
required = ['phone3'];
option = {
title: '物品名称',
ui: {
placeholder: '请输入'
}
};
this.dictKey = 'car:model';
break;
default:
@ -46,35 +67,12 @@ export class CartConfigActionModalComponent implements OnInit {
}
this.schema = {
properties: {
phone1: {
title: '车型',
itemValue: {
...option,
type: 'string',
ui: {
placeholder: '请输入',
hidden: this.configType === 2 || this.configType === 3
},
default: staff.phone1
default: staff.itemValue
},
phone2: {
title: '车长',
type: 'string',
ui: {
placeholder: '请输入',
addOnAfter: '米',
hidden: this.configType === 1 || this.configType === 3
} as SFStringWidgetSchema,
default: staff.phone2
},
phone3: {
title: '物品名称',
type: 'string',
ui: {
placeholder: '请输入',
hidden: this.configType === 1 || this.configType === 2
},
default: staff.phone3
},
roleId: {
stateLocked: {
type: 'string',
title: '状态',
enum: [
@ -87,7 +85,7 @@ export class CartConfigActionModalComponent implements OnInit {
default: staff?.roleId || 1
}
},
required: required
required: ['itemValue']
};
}
@ -95,26 +93,27 @@ export class CartConfigActionModalComponent implements OnInit {
if (this.i.id === 0) {
const params: any = {
...this.sf.value,
roleId: this.sf.value.roleId,
telephone: this.sf.value.phone,
staffName: this.sf.value.name
...this.params,
dictKey: this.dictKey,
itemData: this.sf.value.itemValue
};
// this.service.request(this.service.$api_addStaff, params).subscribe((res) => {
// console.log(res);
// if (res) {
// this.service.msgSrv.success('保存成功!');
// this.modal.close(true);
// }
// // this.showInviteFlag = true;
// // this.inviteCode = res.inviteCode;
// });
this.service.request(this.service.$api_add_dict, params).subscribe(res => {
if (res) {
this.service.msgSrv.success('保存成功!');
this.modal.close(true);
}
});
} else {
const params: any = {
appUserId: this.i.appUserId,
staffName: this.sf.value.name,
roleId: this.sf.value.roleId,
telephone: this.i.telephone
...this.i,
...this.sf.value
};
this.service.request(this.service.$api_update_dict, params).subscribe(res => {
if (res) {
this.service.msgSrv.success('保存成功!');
this.modal.close(true);
}
});
}
}

View File

@ -25,9 +25,9 @@
<button nz-button nzType="primary" (click)="configAction()">新增</button>
</div>
</div>
<st #st [data]="url" [columns]="columns"
<st #st [data]="service.$api_get_dict_page" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loading]="service.http.loading" [scroll]="{ y: '370px' }" (change)="stChange($event)"></st>
[loading]="service.http.loading" [scroll]="{ y: '370px' }"></st>
</nz-card>

View File

@ -33,7 +33,6 @@ export class CartConfigComponent implements OnInit {
}
];
tabType = 1;
url = `/rule?_allow_anonymous=true`;
searchSchema: SFSchema = {
properties: {
@ -77,24 +76,22 @@ export class CartConfigComponent implements OnInit {
};
columns: STColumn[] = [
{ title: '车型', index: 'no', iif: () => this.tabType === 1 },
{ title: '车长', index: 'no', iif: () => this.tabType === 2 },
{ title: '物品名称', index: 'no', iif: () => this.tabType === 3 },
{ title: '车型', index: 'itemValue', iif: () => this.tabType === 1 },
{ title: '车长', index: 'itemValue', iif: () => this.tabType === 2 },
{ title: '物品名称', index: 'itemValue', iif: () => this.tabType === 3 },
{
title: '启用状态',
className: 'text-center',
index: 'status',
index: 'stateLocked',
type: 'badge',
badge: {
0: { text: '启用', color: 'success' },
2: { text: '禁用', color: 'error' },
3: { text: '禁用', color: 'error' },
1: { text: '禁用', color: 'error' }
false: { text: '启用', color: 'success' },
true: { text: '禁用', color: 'error' }
}
},
{
title: '创建时间',
index: 'updatedAt',
index: 'modifyTime',
type: 'date'
},
{
@ -112,9 +109,24 @@ export class CartConfigComponent implements OnInit {
}
];
selectedRows: any[] = [];
get reqParams() {
let params = {};
switch (this.tabType) {
case 1:
Object.assign(params, { dictKey: 'car:model', itemValue: this.sf?.value.params1 });
break;
case 2:
Object.assign(params, { dictKey: 'car:length', itemValue: this.sf?.value.params2 });
break;
case 3:
Object.assign(params, { dictKey: 'car:model', itemValue: this.sf?.value.params3 });
break;
reqParams = { pageIndex: 1, pageSize: 10 };
default:
break;
}
return { ...params };
}
constructor(public service: SystemService, private nzModalService: NzModalService) {}
@ -133,27 +145,18 @@ export class CartConfigComponent implements OnInit {
}, 500);
}
stChange(e: STChange): void {
switch (e.type) {
case 'checkbox':
this.selectedRows = e.checkbox!;
break;
case 'filter':
this.st.load();
break;
}
}
configAction(item?: any) {
const modal = this.nzModalService.create({
nzContent: CartConfigActionModalComponent,
nzComponentParams: item
? { i: { ...item, roleId: 1, phone1: '车辆审核', phone2: '车辆审核', phone3: '车辆审核' }, configType: this.tabType }
: { i: { id: 0 }, configType: this.tabType },
? { i: { ...item }, configType: this.tabType }
: { i: { id: 0 }, configType: this.tabType, params: { itemKey: this.st.total + 1 } },
nzFooter: null
});
modal.afterClose.subscribe(res => {
this.st.load();
if (res) {
this.st.load();
}
});
}
@ -162,7 +165,14 @@ export class CartConfigComponent implements OnInit {
nzTitle: '确认删除?',
nzClosable: false,
nzCancelText: '取消',
nzOnOk: () => {}
nzOnOk: () => {
this.service.request(this.service.$api_delete_dict_by_ids, [item.id]).subscribe(res => {
if (res) {
this.service.msgSrv.success('删除配置成功');
this.st.load();
}
});
}
});
}
/**

View File

@ -17,6 +17,15 @@ export class SystemService extends BaseService {
$api_delete_staff = '/api/mdc/cuc/userApp/deleteAppUser';
// 冻结或恢复员工
$api_free_or_resume_staff = '/api/mdc/cuc/userApp/freezeOrResumeStaff';
// 查询字典选项列表
$api_get_dict_page = '/api/mdc/pbc/dictItems/list/page';
// 根据id批量删除字典选项
$api_delete_dict_by_ids = '/api/mdc/pbc/dictItems/deleteBatchByIds';
// 新增字典选项
$api_add_dict = '/api/mdc/pbc/dictItems/save';
// 更新字典选项
$api_update_dict = '/api/mdc/pbc/dictItems/update';
$api_getAllFunctionInfoByAppId: string = '';

View File

@ -252,7 +252,7 @@
<sv-title>关联企业</sv-title>
<st #st [columns]="columns" [data]="service.$api_get_driver_projects" size="small"
[req]="{ method: 'POST', allInBody: true, params: {appUserId:route.snapshot.params.id} }" [page]="{ show: false }"
style="width: 100%;">
[res]="{ reName: { list: 'data' } }" style="width: 100%;">
</st>
</sv-container>
</nz-card>

View File

@ -20,5 +20,14 @@
}
}
.imgBox {
display: flex;
img {
width : 200px !important;
height: 160px;
}
}
}
}

View File

@ -82,11 +82,11 @@ export class UserCenterComponentsDriverDetailComponent implements OnInit {
}
});
// 获取载具信息
// this.service.request(this.service.$api_get_driver_car_license, { appUserId: this.route.snapshot.params.id }).subscribe(res => {
// if (res) {
// this.carList = res;
// }
// });
this.service.request(this.service.$api_get_driver_car_license, { appUserId: [this.route.snapshot.params.id] }).subscribe(res => {
if (res) {
this.carList = res;
}
});
}
/** 启用/冻结司机 */

View File

@ -8,7 +8,7 @@
</div>
<div nz-col [nzXl]="_$expand ? 24 : 6" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="text-right"
[class.expend-options]="_$expand">
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">导出</button>
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="exportList()">导出</button>
<button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="service.http.loading"
(click)="st?.load(1)">查询</button>
<button nz-button (click)="resetSF()">重置</button>

View File

@ -89,6 +89,11 @@ export class UserCenterComponentsDriverComponent implements OnInit {
this._$expand = false;
}
exportList() {
const params = this.reqParams;
this.service.downloadFile(this.service.$api_export_driver, params);
}
private initSF(): SFSchema {
return {
properties: {

View File

@ -10,7 +10,8 @@
<button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="service.http.loading"
(click)="st?.load(1)">查询</button>
<button nz-button (click)="resetSF()">重置</button>
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">导出</button>
<button *ngIf="tabType === 1" nz-button nzType="primary" [nzLoading]="service.http.loading"
(click)="exportList()">导出</button>
<button nz-button nzType="link" (click)="expandToggle(!_$expand)">
{{ !_$expand ? '展开' : '收起' }}
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
@ -21,8 +22,7 @@
<nz-card>
<!-- 数据列表 -->
<st #st multiSort [data]="service.$api_get_freight_list"
[columns]="tabType===1?enterColumns:adminColumns"
<st #st multiSort [data]="service.$api_get_freight_list" [columns]="tabType===1?enterColumns:adminColumns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"

View File

@ -144,6 +144,11 @@ export class FreightComponentsEnterpriseAuditComponent implements OnInit {
});
}
exportList() {
const params = this.reqParams;
this.service.downloadFile(this.service.$api_export_enterprise, params);
}
/**
* 初始化数据列表
*/

View File

@ -223,13 +223,7 @@ export class FreightComponentsListComponent implements OnInit {
exportList() {
const params = this.reqParams;
this.service
.request(this.service.$api_export_freight_list, { ...params, pageSize: this.st.ps, pageIndex: this.st.pi })
.subscribe(res => {
if (res) {
this.service.msgSrv.success('导出成功');
}
});
this.service.downloadFile(this.service.$api_export_enterprise, params);
}
/**

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

View File

@ -66,7 +66,7 @@ export class UsermanageService extends BaseService {
// 司机详情查看-从业资格证信息
$api_get_driver_practice_seniority = '/api/mdc/cuc/driver/getDriversPracticeSeniority';
// 司机详情查看-载具信息
$api_get_driver_car_license = '/api/mdc/cuc/driver/getUserCarLicense';
$api_get_driver_car_license = '/api/mdc/cuc/carLicense/getUserCatListByUserIds';
// 司机详情查看-获取用户关联的企业项目角色信息
$api_get_driver_projects = '/api/mdc/cuc/user/getEnterpriceProjectInfo';
@ -94,6 +94,11 @@ export class UsermanageService extends BaseService {
// 根据地区code查询列表
$api_get_region_by_code = '/api/mdc/pbc/region/getRegionByCode';
// 导出企业
$api_export_enterprise = '/api/mdc/cuc/enterpriseInfo/operate/export';
// 司机列表导出
$api_export_driver = '/api/mdc/cuc/driver/export';
constructor(public injector: Injector, private nzModalService: NzModalService) {
super(injector);
}