diff --git a/src/app/routes/order-management/components/vehicle/vehicle.component.ts b/src/app/routes/order-management/components/vehicle/vehicle.component.ts index af61608e..d89e2058 100644 --- a/src/app/routes/order-management/components/vehicle/vehicle.component.ts +++ b/src/app/routes/order-management/components/vehicle/vehicle.component.ts @@ -376,6 +376,7 @@ resourceStatus: any; click: (_record) => this.cancellation(_record), iif: item => item.externalSn === '1' || item.externalSn === 1, }, + ], }, ]; diff --git a/src/app/routes/supply-management/components/add-driver/add-driver.component.html b/src/app/routes/supply-management/components/add-driver/add-driver.component.html new file mode 100644 index 00000000..038319ff --- /dev/null +++ b/src/app/routes/supply-management/components/add-driver/add-driver.component.html @@ -0,0 +1,44 @@ + + +
+ + +
+
+
正面照
+
示例
+
+
+
+
+ +
+
+
背面照
+
示例
+
+
+
+
+
+ + + +
+ \ No newline at end of file diff --git a/src/app/routes/supply-management/components/add-driver/add-driver.component.less b/src/app/routes/supply-management/components/add-driver/add-driver.component.less new file mode 100644 index 00000000..54338ad9 --- /dev/null +++ b/src/app/routes/supply-management/components/add-driver/add-driver.component.less @@ -0,0 +1,25 @@ +.pr { + position: relative; + } + + .pa { + position: absolute; + top: 35px; + left: 150px; + } + + .tips { + display: flex; + margin-bottom: 0; + color: #333; + + dt { + width: 150px; + } + + dd { + width: 190px; + margin-bottom: 0; + text-align: center; + } + } diff --git a/src/app/routes/supply-management/components/add-driver/add-driver.component.spec.ts b/src/app/routes/supply-management/components/add-driver/add-driver.component.spec.ts new file mode 100644 index 00000000..92751ffa --- /dev/null +++ b/src/app/routes/supply-management/components/add-driver/add-driver.component.spec.ts @@ -0,0 +1,24 @@ +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; +import { CarAddDriverComponent } from './add-driver.component'; + +describe('CarAddDriverComponent', () => { + let component: CarAddDriverComponent; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ CarAddDriverComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CarAddDriverComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/routes/supply-management/components/add-driver/add-driver.component.ts b/src/app/routes/supply-management/components/add-driver/add-driver.component.ts new file mode 100644 index 00000000..703e2b54 --- /dev/null +++ b/src/app/routes/supply-management/components/add-driver/add-driver.component.ts @@ -0,0 +1,556 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { apiConf } from '@conf/api.conf'; +import { cacheConf } from '@conf/cache.conf'; +import { SFComponent, SFUISchema, SFSchema, SFUploadWidgetSchema, SFDateWidgetSchema } from '@delon/form'; +import { _HttpClient } from '@delon/theme'; +import { EACacheService, EAEnvironmentService } from '@shared'; +import { NzModalRef } from 'ng-zorro-antd/modal'; +import { Observable, Observer } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { SupplyManagementService } from '../../services/supply-management.service'; + +@Component({ + selector: 'app-car-add-driver', + templateUrl: './add-driver.component.html', + styleUrls: ['./add-driver.component.less'] +}) +export class CarAddDriverComponent implements OnInit { + @ViewChild('sf', { static: false }) sf!: SFComponent; + @ViewChild('sf1', { static: false }) sf1!: SFComponent; + @ViewChild('sf2', { static: false }) sf2!: SFComponent; + record: any = {}; + i: any; + ui: SFUISchema = {}; + schema: SFSchema = {}; + schema1: SFSchema = {}; + schema2: SFSchema = {}; + showCardFlag = false; + showJopFlag = false; + detailData: any = { + identityInfoDTO: {}, + userDriverLicenseDTO: {}, + userPracticeSeniorityDTO: {} + }; + companyData: any = {}; + mobile = '' + constructor( + private modal: NzModalRef, + public service: SupplyManagementService, + private envSrv: EAEnvironmentService, + private eaCacheSrv: EACacheService, + ) { } + + ngOnInit(): void { + this.companyData = this.eaCacheSrv.get(cacheConf.env) + this.initSF() + } + initSF() { + this.schema = { + properties: { + titleA: { + title: '司机信息(必填)', + type: 'string', + ui: { + widget: 'text', + }, + default: '照片上传后会自动识别文字并填充下列内容栏' + }, + mobile: { + title: '手机号', + type: 'string', + format: 'email', + maxLength: 11, + ui: { + widget: 'text', + }, + default: this.mobile + }, + showName: { + title: '身份证照片', + type: 'string', + ui: { + widget: 'text', + showRequired: true, + }, + default: '请上传身份证原件的高清照片,若上传复印件,则需加盖公司印章及法人签字;上传后系统会自动识别并填写', + }, + tipsA: { + title: '', + type: 'string', + ui: { + widget: 'custom', + offsetControl: 6, + }, + }, + certificatePhotoFrontWatermark: { + type: 'string', + title: '', + ui: { + offsetControl: 6, + action: apiConf.fileUpload, + fileType: 'image/png,image/jpeg,image/jpg,image/gif', + limit: 1, + limitFileCount: 1, + resReName: 'data.fullFileWatermarkPath', + urlReName: 'data.fullFileWatermarkPath', + widget: 'upload', + descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过2M', + data: { + appId: this.envSrv.env.appId, + }, + name: 'multipartFile', + multiple: false, + listType: 'picture-card', + change: (args) => { + if (args.type === 'success') { + this.detailData.certificatePhotoFront = args.file.response.data.fullFilePath + this.checkIdCard(args.file.response.data.fullFilePath, 'front', 0); + } + }, + beforeUpload: (file: any, _fileList) => { + return new Observable((observer: Observer) => { + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isLt2M) { + this.service.msgSrv.warning('图片大小超过2M!'); + observer.complete(); + return; + } + observer.next(isLt2M); + observer.complete(); + }); + }, + } as SFUploadWidgetSchema, + }, + tipsB: { + title: '', + type: 'string', + ui: { + widget: 'custom', + offsetControl: 6, + }, + }, + certificatePhotoBackWatermark: { + type: 'string', + title: '', + ui: { + offsetControl: 6, + action: apiConf.fileUpload, + fileType: 'image/png,image/jpeg,image/jpg,image/gif', + limit: 1, + limitFileCount: 1, + resReName: 'data.fullFileWatermarkPath', + urlReName: 'data.fullFileWatermarkPath', + widget: 'upload', + descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过2M', + data: { + appId: this.envSrv.env.appId, + }, + name: 'multipartFile', + multiple: false, + listType: 'picture-card', + change: (args) => { + if (args.type === 'success') { + this.detailData.certificatePhotoBack = args.file.response.data.fullFilePath + this.checkIdCard(args.file.response.data.fullFilePath, 'back', 0); + } + }, + beforeUpload: (file: any, _fileList) => { + return new Observable((observer: Observer) => { + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isLt2M) { + this.service.msgSrv.warning('图片大小超过2M!'); + observer.complete(); + return; + } + observer.next(isLt2M); + observer.complete(); + }); + }, + } as SFUploadWidgetSchema, + }, + name: { + title: '姓名', + type: 'string', + maxLength: 32, + ui: { + widget: '', + placeholder: '请输入姓名', + }, + }, + certificateNumber: { + title: '身份证号', + type: 'string', + format: 'id-card', + minLength: 1, + maxLength: 18, + ui: { + widget: '', + placeholder: '请输入法定代表人证件号', + errors: { + required: '请输入18位身份证号码', + }, + }, + }, + }, + required: [ + 'certificatePhotoFrontWatermark', + 'certificatePhotoBackWatermark', + 'name', + 'certificateNumber' + ], + }; + this.schema1 = { + properties: { + titleB: { + title: '驾驶证信息(必填)', + type: 'string', + ui: { + widget: 'text', + }, + default: '照片上传后会自动识别文字并填充下列内容栏' + }, + certificatePhotoWatermark: { + type: 'string', + title: '驾驶证照片', + ui: { + action: apiConf.fileUpload, + fileType: 'image/png,image/jpeg,image/jpg,image/gif', + limit: 1, + limitFileCount: 1, + resReName: 'data.fullFileWatermarkPath', + urlReName: 'data.fullFileWatermarkPath', + widget: 'upload', + descriptionI18n: '请上传驾驶证照片,支持JPG、PNG格式,文件小于5M。照片信息缺失、拼凑、过度PS、模糊不清,都不会通过审核。', + data: { + appId: this.envSrv.env.appId, + }, + name: 'multipartFile', + multiple: false, + listType: 'picture-card', + change: (args) => { + if (args.type === 'success') { + this.detailData.userDriverLicenseDTO.certificatePhoto = args.file.response.data.fullFilePath + this.checkDriverCard(args.file.response.data.fullFilePath, 'front', 0); + } + }, + beforeUpload: (file: any, _fileList) => { + return new Observable((observer: Observer) => { + const isLt4M = file.size / 1024 / 1024 < 4; + if (!isLt4M) { + this.service.msgSrv.warning('图片大小超过4M!'); + observer.complete(); + return; + } + observer.next(isLt4M); + observer.complete(); + }); + }, + } as SFUploadWidgetSchema, + }, + licenseNo: { + title: '驾驶证号', + type: 'string', + ui: { + // widget: 'text', + placeholder: '请输入', + }, + // default: this.ar.snapshot.queryParams.licenseNo + }, + driverModel: { + title: '准驾车型', + type: 'string', + enum: [ + {label: 'A1', value: 0}, + {label: 'B1', value: 1}, + ], + ui: { + // widget: this.detailData.commitFlag !== 0 ? 'text' : '', + placeholder: '请输入', + }, + }, + validStartTime: { + title: '法人证件有效开始日期', + type: 'string', + ui: { + widget: 'date', + format: 'yyyy-MM-dd', + placeholder: '请选择', + errors: { + required: '请选择起始日期', + }, + change: (i) => { }, + } as SFDateWidgetSchema, + }, + validEndTime: { + title: '法人证件有效开始日期', + type: 'string', + ui: { + widget: 'date', + format: 'yyyy-MM-dd', + placeholder: '请选择', + errors: { + required: '请选择起始日期', + }, + change: (i) => { }, + } as SFDateWidgetSchema, + }, + signingOrganization: { + title: '签发机关', + type: 'string', + maxLength: 30, + ui: { + // widget: this.detailData.commitFlag !== 0 ? 'text' : '', + placeholder: '请输入', + }, + }, + }, + required: [ + 'certificatePhotoWatermark', + 'licenseNo', + 'driverModel', + 'validStartTime', + 'validEndTime', + ], + }; + this.schema2 = { + properties: { + titleC: { + title: '从业资格证(选填)', + type: 'string', + ui: { + widget: 'text', + }, + default: '照片上传后会自动识别文字并填充下列内容栏', + }, + certificatePhotoWatermark: { + type: 'string', + title: '', + ui: { + offsetControl: 6, + action: apiConf.fileUpload, + fileType: 'image/png,image/jpeg,image/jpg,image/gif', + limit: 1, + limitFileCount: 1, + resReName: 'data.fullFileWatermarkPath', + urlReName: 'data.fullFileWatermarkPath', + widget: 'upload', + descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过5M', + data: { + appId: this.envSrv.env.appId, + }, + name: 'multipartFile', + multiple: false, + listType: 'picture-card', + change: (args) => { + if (args.type === 'success') { + this.detailData.userPracticeSeniorityDTO.certificatePhoto = args.file.response.data.fullFilePath + //this.checkIdCard(args.file.response.data.fullFile, 0, 0); + } + }, + beforeUpload: (file: any, _fileList) => { + return new Observable((observer: Observer) => { + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isLt2M) { + this.service.msgSrv.warning('图片大小超过2M!'); + observer.complete(); + return; + } + observer.next(isLt2M); + observer.complete(); + }); + }, + } as SFUploadWidgetSchema, + }, + licenseNo: { + title: '从业资格证号', + type: 'string', + maxLength: 30, + ui: { + // widget: this.detailData.commitFlag !== 0 ? 'text' : '', + placeholder: '请输入', + }, + }, + regionCode: { + title: '签发省份', + type: 'string', + ui: { + widget: 'select', + placeholder: '请选择', + asyncData: () => this.getProvinceData(), + } as SFDateWidgetSchema, + }, + validStartTime: { + title: '发证日期', + type: 'string', + ui: { + widget: 'date', + format: 'yyyy-MM-dd', + placeholder: '请选择', + errors: { + required: '请选择起始日期', + }, + change: (i) => { }, + } as SFDateWidgetSchema, + }, + validEndTime: { + title: '有效期止', + type: 'string', + ui: { + widget: 'date', + format: 'yyyy-MM-dd', + placeholder: '请选择', + errors: { + required: '请选择起始日期', + }, + change: (i) => { }, + } as SFDateWidgetSchema, + }, + }, + required: [ + + ], + }; + this.ui = { + '*': { + spanLabelFixed: 180, + grid: { span: 24 }, + width: 700, + }, + $title1: { + spanLabelFixed: 0, + }, + $title2: { + spanLabelFixed: 0, + }, + $title3: { + spanLabelFixed: 0, + }, + $title4: { + spanLabelFixed: 0, + }, + $enterpriseRegistrationTime: { + width: 680, + }, + $operatingEndTime: { + grid: { span: 9 }, + }, + $dateType: { + grid: { span: 4 }, + }, + $validEndTime: { + grid: { span: 9 }, + }, + $dateType01: { + grid: { span: 4 }, + }, + $registrationCapital: { + grid: { span: 12 }, + }, + $unit: { + spanLabelFixed: 20, + grid: { span: 3 }, + }, + }; + } + getProvinceData() { + // return this.service.request(this.service.$api_getRegionByCode, { regionCode: '' }).pipe( + // map(res => { + // const result: any = [] + // if (res) { + // res.map((m: any) => { + // const item = { label: m.name, value: m.regionCode } + // result.push(item) + // }); + // } + // return result + // }) + // ); + } + checkIdCard(imgurl: any, side: any, type: any) { + // 识别身份证 参数side:0-正面、1-背面;type:0-申请人身份证,1-法定代表人身份证 + const params = { + idCardUrl: imgurl, + side, + }; + // this.service.request(this.service.$api_checkIdCard, params).subscribe((res) => { + // if (res) { + // if (type === 0) { + // // 法定代表人身份证 + // if (side === 'front') { + // // 正面 + // this.sf.setValue('/name', res.name); + // this.sf.setValue('/certificateNumber', res.number); + // } + // } + // } + // }); + } + checkDriverCard(imgurl: any, side: any, type: any) { + // 识别身份证 参数side:0-正面、1-背面;type:0-申请人身份证,1-法定代表人身份证 + const params = { + driverLicenseUrl: imgurl, + side, + }; + // this.service.request(this.service.$api_recognizeDriverLicense, params).subscribe((res) => { + // if (res) { + // if (type === 0) { + // // 法定代表人身份证 + // if (side === 'front') { + // // 正面 + // this.sf1.setValue('/licenseNo', res.number); + // this.sf1.setValue('/driverModel', res.number); + // this.sf1.setValue('/validStartTime', res.validFrom); + // this.sf1.setValue('/validEndTime', res.validTo); + // this.sf1.setValue('/signingOrganization', res.issuingAuthority); + // } + // } + // } + // }); + } + close(): void { + this.modal.destroy(); + } + showExample(){ + this.showCardFlag = !this.showCardFlag + } + showJopExample(){ + this.showJopFlag = !this.showJopFlag + } + submitForm(){ + const params:any = { + enterpriseId: this.companyData.enterpriseId, + enterpriseProjectId: this.companyData.projectId, + source: 1, + mobile: this.mobile, + identityInfoDTO:{ + ...this.sf.value, + certificatePhotoFront: this.detailData.certificatePhotoFront, + certificatePhotoBack: this.detailData.certificatePhotoBack, + }, + userDriverLicenseDTO: { + ...this.sf1.value, + certificatePhoto: this.detailData.userDriverLicenseDTO.certificatePhoto, + }, + userPracticeSeniorityDTO: { + ...this.sf2.value, + certificatePhoto: this.detailData.userPracticeSeniorityDTO.certificatePhoto, + }, + }; + params.identityInfoDTO.certificatePhotoFrontWatermark = this.sf?.value.certificatePhotoFrontWatermark + params.identityInfoDTO.certificatePhotoBackWatermark = this.sf?.value.certificatePhotoBackWatermark + params.userDriverLicenseDTO.certificatePhotoWatermark = this.sf1?.value.certificatePhotoWatermark + params.userPracticeSeniorityDTO.certificatePhotoWatermark = this.sf2?.value.certificatePhotoWatermark + delete params.identityInfoDTO.titleA; + delete params.identityInfoDTO.titleB; + delete params.identityInfoDTO.titleC; + delete params.userDriverLicenseDTO.tipsA; + delete params.userPracticeSeniorityDTO.tipsC; + delete params.showName + // this.service.request(this.service.$api_enterpriseVehicleSave, params).subscribe(res => { + // if(res){ + // this.service.msgSrv.success('添加成功') + // this.close() + // } + // }) + } +} diff --git a/src/app/routes/supply-management/components/addmodal/addmodal.component.html b/src/app/routes/supply-management/components/addmodal/addmodal.component.html new file mode 100644 index 00000000..a5b6c0c4 --- /dev/null +++ b/src/app/routes/supply-management/components/addmodal/addmodal.component.html @@ -0,0 +1,48 @@ + + +
+ +
+ +
+ +
+ + + +
+ +
+
+ + + +
+
+
+ + +
+ + + + {{item.carModel}};{{item.carLength}};{{item.carLoad}}; + + +
+ + + +
+ \ No newline at end of file diff --git a/src/app/routes/supply-management/components/addmodal/addmodal.component.less b/src/app/routes/supply-management/components/addmodal/addmodal.component.less new file mode 100644 index 00000000..700887cc --- /dev/null +++ b/src/app/routes/supply-management/components/addmodal/addmodal.component.less @@ -0,0 +1,38 @@ + +:host{ + ::ng-deep{ + .ant-card-meta-title{ + display: flex; + align-items: center; + justify-content: space-between; + } + .nameBox { + display: flex; + align-items: baseline; + .name{ + margin: 0 10px 0 0; + } + } + .ant-badge-status{ + color: #666 + } + + } + .title{ + clear: both; + margin: 10px 0; + font-weight: bold; + font-size: 14px; + } + .noContent{ + width: 100%; + min-height: 300px; + font-size: 16px; + line-height: 300px; + text-align: center; + span { + color: #1890ff; + cursor: pointer; + } + } +} \ No newline at end of file diff --git a/src/app/routes/supply-management/components/addmodal/addmodal.component.spec.ts b/src/app/routes/supply-management/components/addmodal/addmodal.component.spec.ts new file mode 100644 index 00000000..b15da72d --- /dev/null +++ b/src/app/routes/supply-management/components/addmodal/addmodal.component.spec.ts @@ -0,0 +1,24 @@ +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; +import { CarAddmodalComponent } from './addmodal.component'; + +describe('CarAddmodalComponent', () => { + let component: CarAddmodalComponent; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ CarAddmodalComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CarAddmodalComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/routes/supply-management/components/addmodal/addmodal.component.ts b/src/app/routes/supply-management/components/addmodal/addmodal.component.ts new file mode 100644 index 00000000..feaa1445 --- /dev/null +++ b/src/app/routes/supply-management/components/addmodal/addmodal.component.ts @@ -0,0 +1,179 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; +import { cacheConf } from '@conf/cache.conf'; +import { STColumn, STComponent, STChange, STData } from '@delon/abc/st'; +import { SFUISchema, SFSchema, SFComponent } from '@delon/form'; +import { ModalHelper, _HttpClient } from '@delon/theme'; +import { EACacheService } from '@shared'; +import { NzModalRef } from 'ng-zorro-antd/modal'; +import { SupplyManagementService } from '../../services/supply-management.service'; +import { CarAddDriverComponent } from '../add-driver/add-driver.component'; + +@Component({ + selector: 'app-car-addmodal', + templateUrl: './addmodal.component.html', + styleUrls: ['./addmodal.component.less'] +}) +export class CarAddmodalComponent implements OnInit { + @ViewChild('st', { static: false }) st!: STComponent; + @ViewChild('sf', { static: false }) sf!: SFComponent; + _$expand = false; + ui!: SFUISchema; + schema!: SFSchema; + columns!: STColumn[]; + tableData: any = []; + companyData: any = {}; + flag = false + constructor( + private modal: NzModalRef, + private eaCacheSrv: EACacheService, + public service: SupplyManagementService, private router: Router, private ar: ActivatedRoute, + private modalHelper: ModalHelper + ) { } + + /** + * 查询字段个数 + */ + get queryFieldCount(): number { + return Object.keys(this.schema?.properties || {}).length; + } + + /** + * 查询参数 + */ + get reqParams() { + const params = Object.assign({}, this.sf?.value || {}); + delete params._$expand; + return { ...params }; + } + + /** + * 选中行 + */ + get selectedRows() { + return this.st?.list.filter((item: any) => item.checked) || []; + } + + /** + * 伸缩查询条件 + */ + expandToggle() { + this._$expand = !this._$expand; + this.sf?.setValue('/_$expand', this._$expand); + } + + /** + * 重置表单 + */ + resetSF() { + this.sf.reset(); + this._$expand = false; + } + /** + * 程序初始化入口 + */ + ngOnInit() { + this.companyData = this.eaCacheSrv.get(cacheConf.env) + this.initSF(); + this.initST() + this.initData() + } + + /** + * 初始化查询表单 + */ + initSF() { + this.schema = { + properties: { + _$expand: { type: 'boolean', ui: { hidden: true } }, + mobile: { title: '司机手机号', type: 'string', maxLength: 11, ui: { showRequired: false, placeholder: '请输入司机手机号', } }, + }, + }; + this.ui = { + '*': { spanLabelFixed: 120, grid: { span: 8, gutter: 4 }, enter: () => this.st?.load(1) }, + $time: { grid: { span: 24 } }, + }; + } + + /** + * 初始化数据列表 + */ + initST() { + this.columns = [ + { title: '司机头像', type: 'img', index: 'avatar', className: 'text-center' }, + { title: '司机姓名', index: 'name', className: 'text-center' }, + { title: '当前车辆', index: 'carNo', className: 'text-center' }, + { title: '车辆信息', render: 'carModel', className: 'text-center' }, + { + title: '个人认证状态', + index: 'identityStatus', + className: 'text-center', + type: 'enum', + enum: { + 10: '待审核', + 20: '已成功', + 30: '已驳回', + 40: '证件过期', + } + }, + { title: '驾驶证类型', index: 'createTime', className: 'text-center' }, + { + title: '操作', + width: '180px', + className: 'text-center', + buttons: [ + { text: '添加', click: (_record: any) => this.add(_record) }, + ], + }, + ]; + } + initData(flag?: any) { + if (this.sf?.value.mobile) { + this.flag = flag + // this.service.request(this.service.$api_getCarCaptainByMobile, { mobile: this.sf?.value.mobile }).subscribe(res => { + // if (res.userId) { + // this.tableData = [res]; + // } else { + // this.tableData = [] + // } + // this.st.reload() + // }) + } + } + /** + * 数据列表状态变化事件 + */ + change(change: STChange) { + // console.log(change); + } + + /** + * 新增 + */ + add(item: any) { + const params: any = { + enterpriseId: this.companyData.enterpriseId, + enterpriseProjectId: this.companyData.projectId, + source: 1, + appUserId: item.appUserId ? item.appUserId : '', + mobile: item.mobile + } + // this.service.request(this.service.$api_enterpriseVehicleSave, params).subscribe(res => { + // if (res.data) { + // this.service.msgSrv.success('添加成功') + // } + // }) + } + addModal() { + this.modalHelper.create(CarAddDriverComponent, {mobile: this.sf?.value.mobile}, { size: 900 }).subscribe((res) => { + this.initData() + }); + //this.router.navigate(['/car/add']) + } + goBack() { + window.history.go(-1); + } + close(): void { + this.modal.destroy(); + } +} diff --git a/src/app/routes/supply-management/components/assigned-car/assigned-car.component.html b/src/app/routes/supply-management/components/assigned-car/assigned-car.component.html index f15c5a54..e9ef1f28 100644 --- a/src/app/routes/supply-management/components/assigned-car/assigned-car.component.html +++ b/src/app/routes/supply-management/components/assigned-car/assigned-car.component.html @@ -1,15 +1,59 @@
- -
- - +
+
+ +
+
+ +
-
\ No newline at end of file + +
+ + + + + + {{car.carNo}} - + {{car.carLength}}米,{{car.carLoad}}顿 - + 空闲 + 已被指派 + 未认证 + + + + + + {{item.name}} {{item.phone}} + 设置 + + + 空闲 + 已被指派 + 未认证 + + +
+ +
diff --git a/src/app/routes/supply-management/components/assigned-car/assigned-car.component.ts b/src/app/routes/supply-management/components/assigned-car/assigned-car.component.ts index d7bed985..67b5319f 100644 --- a/src/app/routes/supply-management/components/assigned-car/assigned-car.component.ts +++ b/src/app/routes/supply-management/components/assigned-car/assigned-car.component.ts @@ -1,10 +1,19 @@ -import { Component, OnInit } from '@angular/core'; -import { STColumn } from '@delon/abc/st'; -import { SFSchema, SFUISchema } from '@delon/form'; -import { _HttpClient } from '@delon/theme'; +import { Component, OnInit, ViewChild } from '@angular/core'; +import { STChange, STColumn, STColumnBadge, STComponent, STData } from '@delon/abc/st'; +import { SFComponent, SFSchema, SFUISchema } from '@delon/form'; +import { ModalHelper, _HttpClient } from '@delon/theme'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef } from 'ng-zorro-antd/modal'; import { SupplyManagementService } from '../../services/supply-management.service'; +import { SupplyManagementAddDriversComponent } from '../add-drivers/add-drivers.component'; + +import { CarAddmodalComponent } from '../addmodal/addmodal.component'; + +const BADGE: STColumnBadge = { + 1: { text: '空闲', color: 'success' }, + 2: { text: '未实名', color: 'error' }, + 3: { text: '在途', color: 'warning' }, +}; @Component({ selector: 'app-supply-management-assigned-car', @@ -16,15 +25,38 @@ export class SupplyManagementAssignedCarComponent implements OnInit { schema: SFSchema = {}; ui: SFUISchema = {}; columns: STColumn[] = []; + + @ViewChild('st') st!: STComponent; + @ViewChild('sf', { static: false }) sf!: SFComponent; + status: string = 'anew'; + url = ''; // 请求的api地址 + params: any = {}; // 传进来的参数 + cardBADGE: STColumnBadge | any = { + 0: { text: '空闲', color: 'success' }, + 1: { text: '在途', color: 'warning' }, + 2: { text: '未认证', color: 'error' }, + }; + selectedRows: any = null; // 已选行 constructor( private modal: NzModalRef, private msgSrv: NzMessageService, - public service: SupplyManagementService + public service: SupplyManagementService, + private modalHelper: ModalHelper, ) { this.initSF(); this.initSt(); } + /** +* 查询参数 +*/ + get reqParams() { + return { + ...this.sf?.value, + }; + } + + /** * 初始化查询表单 */ @@ -32,24 +64,24 @@ export class SupplyManagementAssignedCarComponent implements OnInit { this.schema = { properties: { _$expand: { type: 'boolean', ui: { hidden: true } }, - no: { + nameOrPhone: { type: 'string', title: '', ui: { - placholder: '请输入司机姓名/手机号' + placeholder: '请输入司机姓名/手机号' } }, - no2: { + carNo: { type: 'string', title: '', ui: { - placholder: '请输入车牌号' + placeholder: '请输入车牌号' } }, }, type: 'object', }; - this.ui = { '*': { spanLabelFixed: 80, grid: { span: 12, gutter: 4 } } }; + this.ui = { '*': { spanLabelFixed: 10, grid: { span: 8, gutter: 1 } } }; } /** @@ -57,25 +89,79 @@ export class SupplyManagementAssignedCarComponent implements OnInit { */ initSt() { this.columns = [ - { width: 50, type: 'checkbox', className: 'text-center' }, - { title: '司机姓名', width: 80, index: 'owner', className: 'text-center' }, - { title: '手机号', index: 'goodsQuantity', width: 100, className: 'text-center' }, - { title: '车牌号', width: 100, index: 'carNo', className: 'text-center' }, - { title: '状态', index: 'status', width: 100, className: 'text-center' }, + { width: 50, type: 'radio', className: 'text-center' }, + { title: '司机姓名', width: 120, index: 'name', className: 'text-center' }, + { title: '手机号', index: 'telephone', width: 200, className: 'text-center' }, + { title: '车队长', render: 'carCaptain', className: 'text-center' }, + { title: '指定车辆', width: 300, render: 'carId', className: 'text-center' }, + { title: '状态', render: 'driverStatus', className: 'text-center', type: 'badge', badge: BADGE }, ]; } ngOnInit(): void { } - save(value: any): void { - this.service.request(`/user/${this.record.id}`, value).subscribe(res => { - this.msgSrv.success('保存成功'); - this.modal.close(true); + dataProcess(data: STData[]): STData[] { + return data.map((i, index) => { + i.carId = ''; + i.disabled = i.carStatus === '1'; + const defaultCar = i?.userCarLicenseDesensitizationVOList?.filter((item: any) => item.isDefault); + if (defaultCar.length > 0) { + i.carId = defaultCar[0].carId; + } + return i; + }); + } + + save(): void { + console.log(this.selectedRows); + if (this.selectedRows) { + const { carId, userId: driverId } = this.selectedRows; + const params: any = { carId, driverId }; + this.service.request(this.url, { ...params, ...this.params }).subscribe((res: any) => { + if (res) { + this.modal.close(res); + } + }) + + } + } + + changeSt(e: STChange): void { + if (e?.type === 'loaded') this.selectedRows = null; + if (e?.type === 'radio') this.selectedRows = e?.radio; + console.log(this.selectedRows); + + } + /** + * 添加司机 + * @param item + */ + addDriver() { + this.modalHelper.create(CarAddmodalComponent, {}, { size: 900, modalOptions: { nzMaskClosable: false } }).subscribe((res) => { + if (res) this.st.reload(); + }); + } + + /** + * 设置车队长 + */ + setCarCaptain(item: any) { + this.modalHelper.create(SupplyManagementAddDriversComponent, { dirvierInfo: item }, { + size: 900, + modalOptions: { nzMaskClosable: false, nzTitle: '设置' } + } + ).subscribe((res) => { + if (res) this.st.reload(); }); } close(): void { this.modal.destroy(); } + + reset() { + this.sf.reset(); + this.st.load(1); + } } diff --git a/src/app/routes/supply-management/components/vehicle/vehicle.component.ts b/src/app/routes/supply-management/components/vehicle/vehicle.component.ts index 1a7f44a1..78828e09 100644 --- a/src/app/routes/supply-management/components/vehicle/vehicle.component.ts +++ b/src/app/routes/supply-management/components/vehicle/vehicle.component.ts @@ -288,7 +288,7 @@ export class SupplyManagementVehicleComponent implements OnInit { }, { text: '重新指派', - // click: (_record) => this.assignedCar(_record), + click: (_record) => this.assignedCar(_record), // iif: item => item.auditStatus === 2, }, ], @@ -377,17 +377,28 @@ export class SupplyManagementVehicleComponent implements OnInit { /** * 重新指派 */ - assignedCar(item: any) { + assignedCar(item: any) { + const { resourceId } = item; const modalRef = this.modal.create({ nzTitle: '指派熟车', - nzWidth: '800px', + nzWidth: '1200px', nzContent: SupplyManagementAssignedCarComponent, nzComponentParams: { i: item, + status: 'anew', + // url: this.service.$api_save_assign_vehicle, + params: { resourceId } }, nzFooter: null, + + }); + modalRef.afterClose.subscribe((result) => { + if (result) { + this.st.reload(); + } }); } + /** * 审核 */ diff --git a/src/app/routes/supply-management/supply-management.module.ts b/src/app/routes/supply-management/supply-management.module.ts index 5d72caf9..100b2898 100644 --- a/src/app/routes/supply-management/supply-management.module.ts +++ b/src/app/routes/supply-management/supply-management.module.ts @@ -1,7 +1,7 @@ /* * @Author: your name * @Date: 2021-12-03 11:10:14 - * @LastEditTime: 2021-12-20 13:38:26 + * @LastEditTime: 2021-12-21 11:04:45 * @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\supply-management\supply-management.module.ts @@ -26,6 +26,8 @@ import { PublishchooseFamifiarAddComponent } from './components/choose-famifiar/ import { SupplyManagementBulkPublishComponent } from './components/bulk-publish/bulk-publish.component'; import { PublishAddressListComponent } from './components/onecar-publish/address-list/address-list.component'; import { PublishSuccessComponent } from './components/onecar-publish/publish-success/publish-success.component'; +import { CarAddDriverComponent } from './components/add-driver/add-driver.component'; +import { CarAddmodalComponent } from './components/addmodal/addmodal.component'; const COMPONENTS: Type[] = [ @@ -45,8 +47,9 @@ const COMPONENTS: Type[] = [ PublishchooseFamifiarAddComponent, SupplyManagementBulkPublishComponent, PublishAddressListComponent, - PublishSuccessComponent - + PublishSuccessComponent, + CarAddDriverComponent, + CarAddmodalComponent ]; @NgModule({