From cc7f7c76492aa12db4c10580013a1f4c1a120886 Mon Sep 17 00:00:00 2001 From: wangshiming Date: Mon, 13 Dec 2021 10:43:03 +0800 Subject: [PATCH] fix bug --- .../onecar-publish.component.html | 45 +++- .../onecar-publish.component.ts | 162 +++++++++--- .../components/audit/audit.component.html | 17 +- .../components/audit/audit.component.ts | 120 ++++----- .../audit/detail/detail.component.html | 126 ++++++---- .../audit/detail/detail.component.spec.ts | 16 +- .../audit/detail/detail.component.ts | 233 ++++++------------ .../vehicle/components/list/list.component.ts | 2 +- .../vehicle/services/vehicle.service.ts | 2 + .../routes/vehicle/vehicle-routing.module.ts | 6 +- src/app/routes/vehicle/vehicle.module.ts | 8 +- .../dict-select/dict-select.component.html | 3 + .../dict-select/dict-select.component.less | 0 .../dict-select/dict-select.component.spec.ts | 25 ++ .../dict-select/dict-select.component.ts | 68 +++++ .../dict-select/dict-select.service.ts | 16 ++ .../shared/components/dict-select/index.ts | 11 + src/app/shared/index.ts | 3 +- src/app/shared/services/index.ts | 1 + .../dict-select/dict-select.widget.html | 10 + .../widget/dict-select/dict-select.widget.ts | 30 +++ src/app/shared/widget/st-widget.module.ts | 13 +- src/assets/mocks/menu-data.json | 9 + 23 files changed, 572 insertions(+), 354 deletions(-) create mode 100644 src/app/shared/components/dict-select/dict-select.component.html create mode 100644 src/app/shared/components/dict-select/dict-select.component.less create mode 100644 src/app/shared/components/dict-select/dict-select.component.spec.ts create mode 100644 src/app/shared/components/dict-select/dict-select.component.ts create mode 100644 src/app/shared/components/dict-select/dict-select.service.ts create mode 100644 src/app/shared/components/dict-select/index.ts create mode 100644 src/app/shared/widget/dict-select/dict-select.widget.html create mode 100644 src/app/shared/widget/dict-select/dict-select.widget.ts diff --git a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html index ab7ffbab..7d1d662e 100644 --- a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html +++ b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html @@ -21,7 +21,13 @@
- + - - + + - - + + + + + + + diff --git a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts index b884099f..28471285 100644 --- a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts +++ b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { FormBuilder, FormGroup } from '@angular/forms'; +import { FormBuilder, FormGroup,Validators,FormControl } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { SFComponent, @@ -248,10 +248,11 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { properties: { weight: { type: 'string', - title: '重量/体积', + title: '货物数量', ui: { widget: 'custom', - placeholder: '请输入' + placeholder: '请输入', + errors: { required: '必填项' } } }, volume: { @@ -262,16 +263,27 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { placeholder: '请输入' } }, - vehicleDemand: { + number: { type: 'string', - title: '用车需求', + title: '', + ui: { + widget: 'custom', + placeholder: '请输入' + } + }, + maxWeight: { + type: 'string', + title: '车型/车长', + enum: [ { label: '1', value: '1' }, { label: '2', value: '2' } ], ui: { widget: 'select', - placeholder: '请选择车型' + placeholder: '请选择车型', + mode: 'multiple', + errors: { required: '请选择车型' } // asyncData: () => // this.categoryService.loadChildData2('0', '2').pipe( // map((data: any) => { @@ -292,7 +304,9 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { ], ui: { widget: 'select', - placeholder: '请选择车长' + placeholder: '请选择车长', + mode: 'multiple', + errors: { required: '请选择车长' } // asyncData: () => // this.categoryService.loadChildData2('0', '2').pipe( // map((data: any) => { @@ -304,7 +318,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { // change: (i) => this.updateCategory(i, '/categoryId2'), } as SFSelectWidgetSchema } - } + }, + required: ['weight', 'maxWeight', 'maxCube'] }; this.ui4 = { '*': { @@ -312,12 +327,15 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { grid: { span: 24 } }, $weight: { - grid: { span: 12 } + grid: { span: 8 } }, $volume: { - grid: { span: 12 } + grid: { span: 8 } }, - $vehicleDemand: { + $number: { + grid: { span: 8 } + }, + $maxWeight: { grid: { span: 12 } }, $maxCube: { @@ -354,33 +372,97 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { type: 'string', title: '是否回单', enum: [ - { label: '是', value: '1' }, - { label: '否', value: '2' } + { label: '需要', value: true }, + { label: '不需要', value: false } ], ui: { widget: 'select', + errors: { required: '请选择' }, placeholder: '请选择' - // asyncData: () => - // this.categoryService.loadChildData2('0', '2').pipe( - // map((data: any) => { - // return data.map((m: any) => { - // return { label: m.name, value: m.id }; - // }); - // }), - // ), - // change: (i) => this.updateCategory(i, '/categoryId2'), - } as SFSelectWidgetSchema + } + }, + receiptType: { + type: 'string', + title: '回单类型', + enum: [ + { label: '电子回单', value: 1 }, + { label: '纸质回单', value: 2 } + ], + ui: { + widget: 'select', + placeholder: '请选择', + errors: { required: '请选择' }, + visibleIf: { + stateReceipt: value => value === true + } + } + }, + receiptUserId: { + type: 'string', + title: '选择地址', + ui: { + widget: 'custom', + placeholder: '请点击选择收回单地址', + validator: val => (this.sf6?.value?.receiptType === '2' ? [{ keyword: 'required', message: '请点击选择收回单地址' }] : []), + visibleIf: { + receiptType: value => value === '2' + } + }, + default: '1212' + }, + name4: { + type: 'string', + title: '联系人', + ui: { + visibleIf: { + receiptType: value => value === '2' + } + }, + readOnly: true + }, + name5: { + type: 'string', + title: '联系电话', + ui: { + visibleIf: { + receiptType: value => value === '2' + } + }, + readOnly: true + }, + name6: { + type: 'string', + title: '所在地区', + ui: { + visibleIf: { + receiptType: value => value === '2' + } + }, + readOnly: true + }, + receiptAddress: { + type: 'string', + title: '详细地址', + maxLength: 20, + ui: { + visibleIf: { + receiptType: value => value === '2' + } + }, + readOnly: true }, remarks: { type: 'string', title: '备注', + maxLength: 200, ui: { widget: 'textarea', placeholder: '请输入', autosize: { minRows: 3, maxRows: 3 } } as SFTextareaWidgetSchema } - } + }, + required: ['stateReceipt', 'receiptType'] }; this.ui6 = { '*': { @@ -468,12 +550,23 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { } addStartInfo(event: any) { - this.startInfo.push({ - detailedAddress: '', - appUserName: '', - contractTelephone: '', - type: 1 - }); + if (this.startInfo.length < 5) { + const controlId = this.startInfo.length; + this.startInfo.push({ + detailedAddress: '', + appUserName: '', + contractTelephone: '', + latitude: '', + longitude: '', + province: '', + city: '', + area: '', + type: 1 + }); + this.validateForm1.addControl(`loadAddress${controlId}`, new FormControl(null, Validators.required)); + this.validateForm1.addControl(`loadName${controlId}`, new FormControl(null, Validators.required)); + this.validateForm1.addControl(`loadPhone${controlId}`, new FormControl(null, Validators.required)); + } } subStartInfo(event: any, index: number, id?:any) { console.log(event, index, id) @@ -709,14 +802,5 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { if(this.PageStatus === '整车修改' || this.PageStatus === '大宗修改') { } - - // console.log(this.sf1.value) - // console.log(this.startInfo) - // console.log(this.endInfo) - // console.log(this.validateForm1.value) - // console.log(this.sf3.value) - // console.log(this.sf4.value) - // console.log(this.sf5.value) - // console.log(this.sf6.value) } } diff --git a/src/app/routes/vehicle/components/audit/audit.component.html b/src/app/routes/vehicle/components/audit/audit.component.html index 3d688f79..3580e807 100644 --- a/src/app/routes/vehicle/components/audit/audit.component.html +++ b/src/app/routes/vehicle/components/audit/audit.component.html @@ -1,7 +1,7 @@ - + - + + 车辆基础信息 + + {{ detailData?.carNo }} + + + {{ detailData?.carNoColor }} + + + {{ detailData?.carModel }} + + + {{ detailData?.carLength }} + + + {{ detailData?.isTrailer === true ? '是' : '否'}} + + + + + + + - 行驶证信息 + 行驶证信息 - {{ detailData?.contactsName }} + {{ detailData?.archivesNo }} - {{ detailData?.contactsPhone }} + {{ detailData?.carModel }} - {{ detailData?.contactsPhone }} + {{ detailData?.driverLicenseRegisterTime }} - {{ detailData?.contactsPhone }} + {{ detailData?.driverLicenseEndTime }} - {{ detailData?.contactsPhone }} + {{ detailData?.driverLicenseSigningOrg }} - {{ detailData?.contactsName }} + {{ detailData?.driverLicenseGetTime }} - {{ detailData?.contactsPhone }} + {{ detailData?.carDistinguishCode }} - {{ detailData?.contactsPhone }} + {{ detailData?.useNature === '1' ? '营运' : '非营运'}} - {{ detailData?.contactsName }} + {{ detailData?.carLoad }} - {{ detailData?.contactsPhone }} + {{ detailData?.curbWeight }} - {{ detailData?.contactsPhone }} + {{ detailData?.carOwner }} @@ -75,47 +83,73 @@ {{ detailData?.contactsName }} - + - 道路运输证信息 + 道路运输证信息 - {{ detailData?.enterpriseName }} + {{ detailData?.roadTransportNo }} - - {{ detailData?.unifiedSocialCreditCode }} + + {{ detailData?.roadTransportLicenceNo }} - - {{ detailData?.enterpriseType }} + + {{ detailData?.roadTransportStartTime }} - - + + {{detailData?.roadTransportEndTime}} + + + - 其他信息 - - {{ detailData?.name }} - - - - + 认证司机 - + +
+
+ {{ item?.isSelf ? '是' : '否' }} +
+
+
+ + + + +
+ 评分: +
评价内容:
+
+
+ +
+ 暂无评价内容 +
+
+
+
+ + + + +
\ No newline at end of file diff --git a/src/app/routes/vehicle/components/audit/detail/detail.component.spec.ts b/src/app/routes/vehicle/components/audit/detail/detail.component.spec.ts index 00666a0b..df98f9ac 100644 --- a/src/app/routes/vehicle/components/audit/detail/detail.component.spec.ts +++ b/src/app/routes/vehicle/components/audit/detail/detail.component.spec.ts @@ -1,26 +1,26 @@ /* * @Author: your name * @Date: 2021-11-29 20:19:08 - * @LastEditTime: 2021-11-29 20:31:00 - * @LastEditors: your name + * @LastEditTime: 2021-12-13 09:58:36 + * @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\components\freight\list\detail\detail.component.spec.ts */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { FreightComponentsListDetailComponent } from './detail.component'; +import { VehicleComponentsAuditDetailComponent } from './detail.component'; -describe('FreightComponentsListDetailComponent', () => { - let component: FreightComponentsListDetailComponent; - let fixture: ComponentFixture; +describe('VehicleComponentsAuditDetailComponent', () => { + let component: VehicleComponentsAuditDetailComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [FreightComponentsListDetailComponent], + declarations: [VehicleComponentsAuditDetailComponent], }).compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(FreightComponentsListDetailComponent); + fixture = TestBed.createComponent(VehicleComponentsAuditDetailComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/routes/vehicle/components/audit/detail/detail.component.ts b/src/app/routes/vehicle/components/audit/detail/detail.component.ts index 447fe5a6..1b46f35e 100644 --- a/src/app/routes/vehicle/components/audit/detail/detail.component.ts +++ b/src/app/routes/vehicle/components/audit/detail/detail.component.ts @@ -4,14 +4,16 @@ 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 { UsermanageService } from '../../../services/vehicle.service'; +import { VehicleService } from '../../../services/vehicle.service'; +// import { VehicleComponentsListEditComponent } from '../edit/edit.component'; +// import { VehicleImgViewComponent } from '../img-view/img-view.component'; @Component({ - selector: 'app-supplier-components-list-view', + selector: 'app-Vehicle-components-Audit-detail', templateUrl: './detail.component.html', styleUrls: ['./detail.component.less'], }) -export class VehicleComponentsListDetailComponent implements OnInit { +export class VehicleComponentsAuditDetailComponent implements OnInit { i: any; url = `/rule?_allow_anonymous=true`; @ViewChild('st', { static: false }) st!: STComponent; @@ -20,25 +22,8 @@ export class VehicleComponentsListDetailComponent implements OnInit { modalTitle = '有效期'; modalName = ''; ui!: SFUISchema; - 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' }, - ]; - detailData: any = { - goodsList: [ - { - perPrice: '22323', - goodsQuantity: '项目名称', - totalPrice: '角色', - }, - { - perPrice: '2259595', - goodsQuantity: '项目名称2', - totalPrice: '角色', - }, - ] - }; + columns!: STColumn[]; + detailData: any; schema!: SFSchema; @ViewChild('sf', { static: false }) sf!: SFComponent; schema1!: SFSchema; @@ -49,19 +34,24 @@ export class VehicleComponentsListDetailComponent implements OnInit { constructor( private http: _HttpClient, private modal: ModalHelper, - public service: UsermanageService, + public service: VehicleService, private route: ActivatedRoute, private modalHelper: ModalHelper, private msgSrv: NzMessageService, ) {} ngOnInit() { - console.log(this.route.snapshot); - // this.initData(); + this.getDetailList(); this.initSF(); this.initSF1(); - // this.launchSign(); + this.initST(); } + /** + * 查询参数 + */ + get reqParams() { + return { id: this.route.snapshot?.params?.id }; + } /** * 初始化查询表单 */ @@ -83,6 +73,30 @@ export class VehicleComponentsListDetailComponent implements OnInit { }; this.ui = { '*': { spanLabelFixed: 120, grid: { span: 24 } } }; } + initST() { + this.columns =[ + { title: '认证司机', index: 'name', width: 300, className: 'text-center' }, + { title: '司机手机号', index: 'mobile', width: 300, className: 'text-center' }, + { title: '是否挂靠', render: 'isSelf', width: 300, className: 'text-center' }, + { title: '录入人员', index: 'totalPrice', width: 300, className: 'text-center' }, + { + title: '车主申明/挂靠协议', + fixed: 'right', + width: '200px', + className: 'text-left', + buttons: [ + { + text: '查看协议', + click: (_record) => this.viewEvaluate(_record), + }, + { + text: '上传协议', + click: (_record) => this.updateEvaluate(_record), + }, + ], + }, + ] + } initSF1() { this.schema1 = { properties: { @@ -122,152 +136,45 @@ 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'); - + // 获取录单员 + getDetailList() { + console.log( this.route.snapshot?.params?.id) 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; - - // 营业执照 - 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, + id: this.route.snapshot?.params?.id }; + this.service.request(`${this.service.$api_get_operate_get}`, params).subscribe((res) => { + console.log(res) + this.detailData = res; + }) } - /** - * 根据地区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(); + // }); + } + handleOK() { + } } diff --git a/src/app/routes/vehicle/components/list/list.component.ts b/src/app/routes/vehicle/components/list/list.component.ts index 665ae1e0..1d7bdc4f 100644 --- a/src/app/routes/vehicle/components/list/list.component.ts +++ b/src/app/routes/vehicle/components/list/list.component.ts @@ -5,7 +5,7 @@ import { SFComponent, SFSchema, SFUISchema } from '@delon/form'; import { NzModalService } from 'ng-zorro-antd/modal'; import { VehicleService } from '../../../vehicle/services/vehicle.service'; @Component({ - selector: 'app-Freight-components-list', + selector: 'app-Vehicle-components-list', templateUrl: './list.component.html', }) export class VehicleComponentsListComponent implements OnInit { diff --git a/src/app/routes/vehicle/services/vehicle.service.ts b/src/app/routes/vehicle/services/vehicle.service.ts index c187ba42..b9ff4c4a 100644 --- a/src/app/routes/vehicle/services/vehicle.service.ts +++ b/src/app/routes/vehicle/services/vehicle.service.ts @@ -18,6 +18,8 @@ import { EAFileUtil } from 'src/app/shared/utils/file.util'; export class VehicleService extends BaseService { // 查询车辆认证表 $api_get_operate_list = `/api/mdc/cuc/carLicense/operate/list/page`; + // 查询用户车辆认证表(审核列表) + $api_get_userCarLicense_list = `/api/mdc/cuc/userCarLicense/operate/list/page`; // 获取车辆认证表 $api_get_operate_get = `/api/mdc/cuc/carLicense/operate/get`; // 获取车辆认证司机列表 diff --git a/src/app/routes/vehicle/vehicle-routing.module.ts b/src/app/routes/vehicle/vehicle-routing.module.ts index 87a78b97..fa066cf2 100644 --- a/src/app/routes/vehicle/vehicle-routing.module.ts +++ b/src/app/routes/vehicle/vehicle-routing.module.ts @@ -1,13 +1,15 @@ /* * @Author: your name * @Date: 2021-11-29 15:22:34 - * @LastEditTime: 2021-12-02 11:11:39 + * @LastEditTime: 2021-12-13 09:56:49 * @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-routing.module.ts */ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { VehicleComponentsAuditComponent } from './components/audit/audit.component'; +import { VehicleComponentsAuditDetailComponent } from './components/audit/detail/detail.component'; import { VehicleComponentsListDetailComponent } from './components/list/detail/detail.component'; import { VehicleComponentsListComponent } from './components/list/list.component'; @@ -17,6 +19,8 @@ const routes: Routes = [ { path: 'list', component: VehicleComponentsListComponent }, { path: 'list/detail/:id', component: VehicleComponentsListDetailComponent }, + { path: 'audit', component: VehicleComponentsAuditComponent }, + { path: 'audit/detail/:id', component: VehicleComponentsAuditDetailComponent }, ]; @NgModule({ diff --git a/src/app/routes/vehicle/vehicle.module.ts b/src/app/routes/vehicle/vehicle.module.ts index 82c45639..41aa0854 100644 --- a/src/app/routes/vehicle/vehicle.module.ts +++ b/src/app/routes/vehicle/vehicle.module.ts @@ -1,13 +1,15 @@ /* * @Author: your name * @Date: 2021-11-29 15:22:34 - * @LastEditTime: 2021-12-07 17:30:51 + * @LastEditTime: 2021-12-13 09:58:58 * @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 */ import { NgModule } from '@angular/core'; import { SharedModule } from '@shared'; +import { VehicleComponentsAuditComponent } from './components/audit/audit.component'; +import { VehicleComponentsAuditDetailComponent } from './components/audit/detail/detail.component'; 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'; @@ -19,7 +21,9 @@ const COMPONENTS = [ VehicleComponentsListComponent, VehicleComponentsListDetailComponent, VehicleComponentsListEditComponent, - VehicleImgViewComponent + VehicleImgViewComponent, + VehicleComponentsAuditComponent, + VehicleComponentsAuditDetailComponent ]; @NgModule({ diff --git a/src/app/shared/components/dict-select/dict-select.component.html b/src/app/shared/components/dict-select/dict-select.component.html new file mode 100644 index 00000000..af04c543 --- /dev/null +++ b/src/app/shared/components/dict-select/dict-select.component.html @@ -0,0 +1,3 @@ + + + diff --git a/src/app/shared/components/dict-select/dict-select.component.less b/src/app/shared/components/dict-select/dict-select.component.less new file mode 100644 index 00000000..e69de29b diff --git a/src/app/shared/components/dict-select/dict-select.component.spec.ts b/src/app/shared/components/dict-select/dict-select.component.spec.ts new file mode 100644 index 00000000..d5aa71e4 --- /dev/null +++ b/src/app/shared/components/dict-select/dict-select.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DictSelectComponent } from './dict-select.component'; + +describe('DictSelectComponent', () => { + let component: DictSelectComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ DictSelectComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(DictSelectComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shared/components/dict-select/dict-select.component.ts b/src/app/shared/components/dict-select/dict-select.component.ts new file mode 100644 index 00000000..232b95e0 --- /dev/null +++ b/src/app/shared/components/dict-select/dict-select.component.ts @@ -0,0 +1,68 @@ +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, forwardRef, Input, OnInit } from '@angular/core'; +import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; +import { AddressComponent } from '@shared'; +import { DictSelectService } from './dict-select.service'; + +@Component({ + selector: 'app-dict-select', + templateUrl: './dict-select.component.html', + styleUrls: ['./dict-select.component.less'], + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => DictSelectComponent), + multi: true, + }, + ], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class DictSelectComponent implements OnInit, ControlValueAccessor { + + private onChangeFn?: (val: string) => void; + private onTouchedFn?: () => void; + + defaultUrl = `/api/mdc/pbc/dictItems/getDictValue`; + @Input() value: string = ''; // 默认选中值 + @Input() url: string = ''; // 获取字典数据的地址 + @Input() params = {};// 请求参数 + + dictList: any[] = []; + + constructor(public service: DictSelectService, public cdr: ChangeDetectorRef) { } + + writeValue(geo: string): void { + if (geo == null) { + this.value = ''; + return; + } + this.value = geo; + } + registerOnChange(fn: any): void { + this.onChangeFn = fn; + } + registerOnTouched(fn: any): void { + this.onTouchedFn = fn; + } + + ngOnInit(): void { + + this.service.getDictList(this.url || this.defaultUrl, this.params).subscribe(res => { + if (res) { + this.dictList = res || []; + if (this.dictList.length > 0) { + const obj = { label: '全部', value: '' }; + this.dictList.unshift(obj); + } + this.cdr.markForCheck(); + } + }); + } + change($event: any) { + this.onChangeFn!($event); + } + + isEmpty(val: any) { + return val === undefined || val === null || val === ''; + } + +} diff --git a/src/app/shared/components/dict-select/dict-select.service.ts b/src/app/shared/components/dict-select/dict-select.service.ts new file mode 100644 index 00000000..40446e89 --- /dev/null +++ b/src/app/shared/components/dict-select/dict-select.service.ts @@ -0,0 +1,16 @@ +import { Injectable, Injector } from '@angular/core'; +import { BaseService } from '../../services/core/base.service'; + +@Injectable({ + providedIn: 'root' +}) +export class DictSelectService extends BaseService { + + constructor(public injector: Injector) { + super(injector); + } + + getDictList(url: string, params = {}) { + return this.request(url, params); + } +} diff --git a/src/app/shared/components/dict-select/index.ts b/src/app/shared/components/dict-select/index.ts new file mode 100644 index 00000000..446b7507 --- /dev/null +++ b/src/app/shared/components/dict-select/index.ts @@ -0,0 +1,11 @@ +/* + * @Author: your name + * @Date: 2021-12-13 10:41:19 + * @LastEditTime: 2021-12-13 10:41:57 + * @LastEditors: your name + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: \tms-obc-web\src\app\shared\components\dict-select\index.ts + */ +export * from './dict-select.component.spec'; +export * from './dict-select.component'; +export * from './dict-select.service'; diff --git a/src/app/shared/index.ts b/src/app/shared/index.ts index c623f596..9d2d0dc2 100644 --- a/src/app/shared/index.ts +++ b/src/app/shared/index.ts @@ -1,7 +1,7 @@ /* * @Author: your name * @Date: 2021-11-29 10:04:12 - * @LastEditTime: 2021-12-06 15:21:46 + * @LastEditTime: 2021-12-13 10:42:19 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: \tms-obc-web\src\app\shared\index.ts @@ -17,6 +17,7 @@ export * from './components/scrollbar/index'; export * from './components/address/index'; export * from './components/captcha/index'; export * from './components/amap/index'; +export * from './components/dict-select/index'; // Utils export * from './utils'; diff --git a/src/app/shared/services/index.ts b/src/app/shared/services/index.ts index 0e906064..a20ef675 100644 --- a/src/app/shared/services/index.ts +++ b/src/app/shared/services/index.ts @@ -12,3 +12,4 @@ export * from './business/user.service'; export * from './business/sl-platform.service'; export * from './business/user.service'; export * from './business/environment.service'; + diff --git a/src/app/shared/widget/dict-select/dict-select.widget.html b/src/app/shared/widget/dict-select/dict-select.widget.html new file mode 100644 index 00000000..76e719cd --- /dev/null +++ b/src/app/shared/widget/dict-select/dict-select.widget.html @@ -0,0 +1,10 @@ + + + + + diff --git a/src/app/shared/widget/dict-select/dict-select.widget.ts b/src/app/shared/widget/dict-select/dict-select.widget.ts new file mode 100644 index 00000000..f3ef917d --- /dev/null +++ b/src/app/shared/widget/dict-select/dict-select.widget.ts @@ -0,0 +1,30 @@ +import { Component, OnInit } from "@angular/core"; +import { ControlWidget } from "@delon/form"; + +@Component({ + selector: 'sf-dict-select', + templateUrl: './dict-select.widget.html', + preserveWhitespaces: false, +}) + +export class DictSelectWidget extends ControlWidget implements OnInit { + + + static readonly KEY = 'dict-select'; + /** + * 字典数据数组 + */ + + + dictList: any[] = []; + + + ngOnInit(): void { + + } + + change(value: string) { + if (this.ui.change) this.ui.change(value); + this.setValue(value); + } +} diff --git a/src/app/shared/widget/st-widget.module.ts b/src/app/shared/widget/st-widget.module.ts index 402f66ec..634efc46 100644 --- a/src/app/shared/widget/st-widget.module.ts +++ b/src/app/shared/widget/st-widget.module.ts @@ -1,3 +1,11 @@ +/* + * @Author: your name + * @Date: 2021-12-01 15:07:23 + * @LastEditTime: 2021-12-13 10:37:39 + * @LastEditors: your name + * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @FilePath: \tms-obc-web\src\app\shared\widget\st-widget.module.ts + */ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; @@ -15,6 +23,7 @@ import { NgxTinymceModule } from 'ngx-tinymce'; // import { STWidgetRegistry } from '@delon/abc/st'; import { SharedModule } from '../shared.module'; import { AddressWidget } from './address/address.widget'; +import { DictSelectWidget } from './dict-select/dict-select.widget'; import { EditorWidget } from './editor/editor.widget'; import { SLFromToSearchWidget } from './from-to-search/from-to-search.widget'; import { EAFromToWidget } from './from-to/from-to.widget'; @@ -33,7 +42,8 @@ export const STWIDGET_COMPONENTS = [ EAFromToWidget, SpecValuesWidget, PropertyValuesWidget, - SLFromToSearchWidget + SLFromToSearchWidget, + DictSelectWidget ]; @NgModule({ @@ -68,5 +78,6 @@ export class STWidgetModule { widgetRegistry.register(SpecValuesWidget.KEY, SpecValuesWidget); widgetRegistry.register(PropertyValuesWidget.KEY, PropertyValuesWidget); widgetRegistry.register(SLFromToSearchWidget.KEY, SLFromToSearchWidget); + widgetRegistry.register(DictSelectWidget.KEY, DictSelectWidget) } } diff --git a/src/assets/mocks/menu-data.json b/src/assets/mocks/menu-data.json index 4abd2ff5..ec12cc51 100644 --- a/src/assets/mocks/menu-data.json +++ b/src/assets/mocks/menu-data.json @@ -285,6 +285,15 @@ "hide": true, "text": "车辆详情", "link": "/vehicle/list/detail/:id" + }, + { + "text": "车辆审核列表", + "link": "/vehicle/audit" + }, + { + "hide": true, + "text": "车辆审核列表详情", + "link": "/vehicle/audit/detail/:id" } ] },