From f27735b72f465a80c91dac545abab8f69295f7b2 Mon Sep 17 00:00:00 2001 From: wangshiming Date: Tue, 7 Dec 2021 17:33:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/audit/audit.component.ts | 2 +- .../list/detail/detail.component.html | 53 ++--- .../list/detail/detail.component.ts | 205 ++++++------------ .../components/list/edit/edit.component.html | 20 ++ .../list/edit/edit.component.spec.ts | 23 ++ .../components/list/edit/edit.component.ts | 129 +++++++++++ .../list/img-view/img-view.component.html | 18 ++ .../list/img-view/img-view.component.spec.ts | 23 ++ .../list/img-view/img-view.component.ts | 25 +++ .../vehicle/components/list/list.component.ts | 3 +- src/app/routes/vehicle/vehicle.module.ts | 8 +- src/assets/mocks/menu-data.json | 4 +- 12 files changed, 346 insertions(+), 167 deletions(-) create mode 100644 src/app/routes/vehicle/components/list/edit/edit.component.html create mode 100644 src/app/routes/vehicle/components/list/edit/edit.component.spec.ts create mode 100644 src/app/routes/vehicle/components/list/edit/edit.component.ts create mode 100644 src/app/routes/vehicle/components/list/img-view/img-view.component.html create mode 100644 src/app/routes/vehicle/components/list/img-view/img-view.component.spec.ts create mode 100644 src/app/routes/vehicle/components/list/img-view/img-view.component.ts diff --git a/src/app/routes/vehicle/components/audit/audit.component.ts b/src/app/routes/vehicle/components/audit/audit.component.ts index cf8a5236..3ace63a4 100644 --- a/src/app/routes/vehicle/components/audit/audit.component.ts +++ b/src/app/routes/vehicle/components/audit/audit.component.ts @@ -6,7 +6,7 @@ import { NzModalService } from 'ng-zorro-antd/modal'; import { UsermanageService } from '../../../vehicle/services/vehicle.service'; @Component({ selector: 'app-Freight-components-list', - templateUrl: './list.component.html', + templateUrl: './audit.component.html', }) export class VehicleComponentsListComponent implements OnInit { _$expand = false; diff --git a/src/app/routes/vehicle/components/list/detail/detail.component.html b/src/app/routes/vehicle/components/list/detail/detail.component.html index 714ae589..88c19a52 100644 --- a/src/app/routes/vehicle/components/list/detail/detail.component.html +++ b/src/app/routes/vehicle/components/list/detail/detail.component.html @@ -1,32 +1,40 @@ - + - + + 车辆基础信息 + + {{ detailData?.contactsName }} + + + {{ detailData?.contactsPhone }} + + + {{ detailData?.contactsPhone }} + + + {{ detailData?.contactsPhone }} + + + {{ detailData?.contactsPhone }} + + + + + + + - 行驶证信息 + 行驶证信息 {{ detailData?.contactsName }} @@ -80,7 +88,7 @@ - 道路运输证信息 + 道路运输证信息 {{ detailData?.enterpriseName }} @@ -96,15 +104,8 @@ - 其他信息 - - {{ detailData?.name }} - - - - + 认证司机 - this.viewEvaluate(_record), + }, + { + text: '上传协议', + click: (_record) => this.updateEvaluate(_record), + }, + ], + }, ]; detailData: any = { goodsList: [ @@ -122,152 +141,70 @@ export class VehicleComponentsListDetailComponent implements OnInit { required: this.validData, }; } - 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'); + // 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_supplier_info, 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 params = { + // tenantId: this.route.snapshot.params.id, + // // tenantId: this.route.snapshot.queryParams.tenantId, + // }; + // const res = await this.service.asyncRequest(this.service.$api_get_supplier_info, 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; + // // 法人身份证证件 + // const imagelist = []; + // imagelist.push(res?.certificatePhotoFront); + // imagelist.push(res?.certificatePhotoBack); + // res.certificatePhoto = imagelist; - // 营业执照 - res.enterpriseQualificationCertificate = res.enterpriseQualificationCertificate - ? res.enterpriseQualificationCertificate.split(',') - : []; + // // 营业执照 + // res.enterpriseQualificationCertificate = res.enterpriseQualificationCertificate + // ? res.enterpriseQualificationCertificate.split(',') + // : []; - // 返回所在地 - res.enterpriseAddressCodeStr = await this.getRegionFullName(res.enterpriseAddressCode); + // // 返回所在地 + // res.enterpriseAddressCodeStr = await this.getRegionFullName(res.enterpriseAddressCode); + + // this.detailData = res; + // this.suppliersData = { + // suppliersType: res?.suppliersType, + // externalSuppliersId: res?.externalSuppliersId, + // }; + // } - 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_region_detailByCode, params, 'POST', true); - // if (res && res.regionFullName) { - // const arr = res.regionFullName.split(','); - // res.regionFullName = arr.reverse().join('-'); - // } - return res && res.regionFullName; - } - add() { - // this.modal - // .createStatic(FormEditComponent, { i: { id: 0 } }) - // .subscribe(() => this.st.reload()); - } 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 === 'effectiveDate') { - this.isShow = false; - } else { - this.isVisible = false; - } - } - handleOK(name: any) { - 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; - } + } + + /** + *查看评价 + */ + viewEvaluate(item: any) { + this.modal.createStatic(VehicleImgViewComponent, { i: { imgUrl: item } }).subscribe(() => { + // this.st.reload(); + }); + } + /** + *查看评价 + */ + updateEvaluate(item: any) { + this.modal.createStatic(VehicleComponentsListEditComponent, { i: { item }, infoData: item }).subscribe(() => { + // this.st.reload(); + // this.getInfo(); }); } } diff --git a/src/app/routes/vehicle/components/list/edit/edit.component.html b/src/app/routes/vehicle/components/list/edit/edit.component.html new file mode 100644 index 00000000..bcb00157 --- /dev/null +++ b/src/app/routes/vehicle/components/list/edit/edit.component.html @@ -0,0 +1,20 @@ + + + +
+ + +
+ diff --git a/src/app/routes/vehicle/components/list/edit/edit.component.spec.ts b/src/app/routes/vehicle/components/list/edit/edit.component.spec.ts new file mode 100644 index 00000000..688a7662 --- /dev/null +++ b/src/app/routes/vehicle/components/list/edit/edit.component.spec.ts @@ -0,0 +1,23 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { UcenterComponentsInfoEditComponent } from './edit.component'; + +describe('UcenterComponentsInfoEditComponent', () => { + let component: UcenterComponentsInfoEditComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [UcenterComponentsInfoEditComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UcenterComponentsInfoEditComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/routes/vehicle/components/list/edit/edit.component.ts b/src/app/routes/vehicle/components/list/edit/edit.component.ts new file mode 100644 index 00000000..0859c1c2 --- /dev/null +++ b/src/app/routes/vehicle/components/list/edit/edit.component.ts @@ -0,0 +1,129 @@ +import { Component, OnInit, ViewChild, Type } from '@angular/core'; +import { SFComponent, SFSchema, SFUISchema, SFUploadWidgetSchema, SFTextareaWidgetSchema } from '@delon/form'; +import { EAEnvironmentService, CaptchaComponent, EAUserService } from '@shared'; +import { Observable, Observer } from 'rxjs'; +import { NzMessageService } from 'ng-zorro-antd/message'; +import { NzModalRef } from 'ng-zorro-antd/modal'; +import { UsermanageService } from '../../../services/vehicle.service'; +@Component({ + selector: 'app-setting-components-info-edit', + templateUrl: './edit.component.html', +}) +export class VehicleComponentsListEditComponent implements OnInit { + @ViewChild('sf', { static: false }) sf!: SFComponent; + record: any = {}; + i: any = {}; + infoData: any = {}; + schema!: SFSchema; + ui!: SFUISchema; + formData: any = {}; + interval$: any; + phone!: string; + + constructor( + private modal: NzModalRef, + public msgSrv: NzMessageService, + public service: UsermanageService, + private envSrv: EAEnvironmentService, + ) {} + + ngOnInit(): void { + console.log('init:', this.i, this.infoData); + // 设置初始值 + this.initInfo(); + this.initSF(); + } + initInfo() { + if (this.infoData.enterpriseLogo) { + this.formData = { + enterpriseLogo: [ + { + uid: 'logo', + name: 'LOGO', + status: 'done', + url: this.infoData.enterpriseLogo, + response: { + url: this.infoData.enterpriseLogo, + }, + }, + ], + }; + } + } + initSF() { + // 依据类型初始表单 + this.schema = { + properties: { + enterpriseLogo: { + type: 'string', + title: 'Logo', + ui: { + widget: 'upload', + action: `/cms/upload/multipartFile/fileModel`, + // fileType: 'image/png,image/jpeg,image/gif,image/bmp', + limit: 1, + limitFileCount: 1, + resReName: 'url', + urlReName: 'url', + descriptionI18n: '支持JPG、GIF、PNG、JPEG格式,图片小于2M', + data: { + appId: this.envSrv.env.appId, + }, + name: 'multipartFile', + change: (args) => { + if (args.type === 'success') { + const avatar = [ + { + uid: 'logo', + name: 'LOGO', + status: 'done', + url: args.fileList[0].response.url, + response: { + url: args.fileList[0].response.url, + }, + }, + ]; + this.sf?.setValue('/enterpriseLogo', avatar); + } + }, + beforeUpload: (file: any, fileList: any) => { + return new Observable((observer: Observer) => { + const isLt1M = file.size / 1024 / 1024 < 2; + const fileType = 'image/png,image/jpeg'; + if (fileType.indexOf(file.type) === -1) { + this.service.msgSrv.warning('图片格式不正确!'); + observer.complete(); + return; + } + if (!isLt1M) { + this.service.msgSrv.warning('图片大小超过2M!'); + observer.complete(); + return; + } + observer.next(isLt1M); + observer.complete(); + }); + }, + multiple: false, + listType: 'picture-card', + showRequired: true, + } as SFUploadWidgetSchema, + }, + }, + required: ['enterpriseLogo'], + }; + this.ui = { + '*': { + spanLabelFixed: 120, + grid: { span: 24 }, + }, + }; + } + + close() { + this.modal.destroy(); + } + sure() { + + } +} diff --git a/src/app/routes/vehicle/components/list/img-view/img-view.component.html b/src/app/routes/vehicle/components/list/img-view/img-view.component.html new file mode 100644 index 00000000..198181d3 --- /dev/null +++ b/src/app/routes/vehicle/components/list/img-view/img-view.component.html @@ -0,0 +1,18 @@ + + + +
+ diff --git a/src/app/routes/vehicle/components/list/img-view/img-view.component.spec.ts b/src/app/routes/vehicle/components/list/img-view/img-view.component.spec.ts new file mode 100644 index 00000000..419a51ce --- /dev/null +++ b/src/app/routes/vehicle/components/list/img-view/img-view.component.spec.ts @@ -0,0 +1,23 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { SettingComponentsInfoImgViewComponent } from './img-view.component'; + +describe('SettingComponentsInfoImgViewComponent', () => { + let component: SettingComponentsInfoImgViewComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [SettingComponentsInfoImgViewComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SettingComponentsInfoImgViewComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/routes/vehicle/components/list/img-view/img-view.component.ts b/src/app/routes/vehicle/components/list/img-view/img-view.component.ts new file mode 100644 index 00000000..5019df4a --- /dev/null +++ b/src/app/routes/vehicle/components/list/img-view/img-view.component.ts @@ -0,0 +1,25 @@ +import { Component, OnInit } from '@angular/core'; +import { _HttpClient } from '@delon/theme'; +import { NzMessageService } from 'ng-zorro-antd/message'; +import { NzModalRef } from 'ng-zorro-antd/modal'; + +@Component({ + selector: 'app-setting-components-info-img-view', + templateUrl: './img-view.component.html', +}) +export class VehicleImgViewComponent implements OnInit { + record: any = {}; + i: any; + + constructor(private modal: NzModalRef, public msgSrv: NzMessageService, public http: _HttpClient) {} + + ngOnInit(): void { + console.log(this.i.imgUrl, 66666666666); + + // this.http.get(`/user/${this.record.id}`).subscribe(res => this.i = res); + } + + close() { + this.modal.destroy(); + } +} diff --git a/src/app/routes/vehicle/components/list/list.component.ts b/src/app/routes/vehicle/components/list/list.component.ts index cf8a5236..4ac469a4 100644 --- a/src/app/routes/vehicle/components/list/list.component.ts +++ b/src/app/routes/vehicle/components/list/list.component.ts @@ -155,7 +155,7 @@ export class VehicleComponentsListComponent implements OnInit { }, }, }; - this.ui = { '*': { spanLabelFixed: 90, grid: { span: 8, gutter: 4 }, enter: () => this.st.load() } }; + this.ui = { '*': { spanLabelFixed: 110, grid: { span: 8, gutter: 4 }, enter: () => this.st.load() } }; } initST() { @@ -164,7 +164,6 @@ export class VehicleComponentsListComponent implements OnInit { { title: '车牌号', className: 'text-center', index: 'storeName' }, { title: '车牌颜色', className: 'text-center', index: 'contactsName' }, { title: '车型-车长-载重', className: 'text-center', render: 'enterpriseName' }, - { title: '承运总单量', className: 'text-center', index: 'unifiedSocialCreditCode' }, { title: '运营状态', className: 'text-center', index: 'effectiveDateStr', type: 'badge', badge: { diff --git a/src/app/routes/vehicle/vehicle.module.ts b/src/app/routes/vehicle/vehicle.module.ts index 19165da6..82c45639 100644 --- a/src/app/routes/vehicle/vehicle.module.ts +++ b/src/app/routes/vehicle/vehicle.module.ts @@ -1,7 +1,7 @@ /* * @Author: your name * @Date: 2021-11-29 15:22:34 - * @LastEditTime: 2021-12-01 20:36:45 + * @LastEditTime: 2021-12-07 17:30:51 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: \tms-obc-web\src\app\routes\usercenter\usercenter.module.ts @@ -9,13 +9,17 @@ import { NgModule } from '@angular/core'; import { SharedModule } from '@shared'; import { VehicleComponentsListDetailComponent } from './components/list/detail/detail.component'; +import { VehicleComponentsListEditComponent } from './components/list/edit/edit.component'; +import { VehicleImgViewComponent } from './components/list/img-view/img-view.component'; import { VehicleComponentsListComponent } from './components/list/list.component'; import { VehicleRoutingModule } from './vehicle-routing.module'; const COMPONENTS = [ VehicleComponentsListComponent, - VehicleComponentsListDetailComponent + VehicleComponentsListDetailComponent, + VehicleComponentsListEditComponent, + VehicleImgViewComponent ]; @NgModule({ diff --git a/src/assets/mocks/menu-data.json b/src/assets/mocks/menu-data.json index 406d064f..678570e2 100644 --- a/src/assets/mocks/menu-data.json +++ b/src/assets/mocks/menu-data.json @@ -270,12 +270,12 @@ ] }, { - "text": "车辆管理", + "text": "运力管理", "icon": "anticon anticon-dashboard", "group": true, "children": [ { - "text": "车辆列表", + "text": "车辆管理", "link": "/vehicle/list" }, {