From 6eeb714434ca74e74f428eab81a52c8c5429f875 Mon Sep 17 00:00:00 2001 From: wangshiming Date: Wed, 2 Mar 2022 13:52:51 +0800 Subject: [PATCH 1/3] fix bug --- .../confir-receipt.component.html | 17 ++++++++++++-- .../confir-receipt.component.ts | 22 +++++++++++-------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/app/routes/order-management/modal/vehicle/confir-receipt/confir-receipt.component.html b/src/app/routes/order-management/modal/vehicle/confir-receipt/confir-receipt.component.html index b94a1580..d4e298cb 100644 --- a/src/app/routes/order-management/modal/vehicle/confir-receipt/confir-receipt.component.html +++ b/src/app/routes/order-management/modal/vehicle/confir-receipt/confir-receipt.component.html @@ -4,7 +4,7 @@ * @Author : Shiming * @Date : 2021-12-15 13:17:42 * @LastEditors : Shiming - * @LastEditTime : 2022-01-18 17:21:57 + * @LastEditTime : 2022-03-02 13:50:12 * @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\vehicle\\confir-receipt\\confir-receipt.component.html * Copyright (C) 2022 huzhenhong. All rights reserved. --> @@ -17,7 +17,20 @@ - + + + {{item.PRE | currency}} + + + {{ item.RECE | currency }} + + + {{ item.BACK | currency }} + + + {{ item.traiPrice | currency }} + +
{{ dataInfo?.driverName }} / {{ dataInfo?.driverPhone }}/ {{ dataInfo?.carNo }}
diff --git a/src/app/routes/order-management/modal/vehicle/confir-receipt/confir-receipt.component.ts b/src/app/routes/order-management/modal/vehicle/confir-receipt/confir-receipt.component.ts index 86e57768..6d6170e4 100644 --- a/src/app/routes/order-management/modal/vehicle/confir-receipt/confir-receipt.component.ts +++ b/src/app/routes/order-management/modal/vehicle/confir-receipt/confir-receipt.component.ts @@ -4,7 +4,7 @@ * @Author : Shiming * @Date : 2021-12-15 13:17:42 * @LastEditors : Shiming - * @LastEditTime : 2022-02-25 15:34:07 + * @LastEditTime : 2022-03-02 13:52:27 * @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\vehicle\\confir-receipt\\confir-receipt.component.ts * Copyright (C) 2022 huzhenhong. All rights reserved. */ @@ -143,23 +143,27 @@ export class VehicleConfirReceiptComponent implements OnInit { this.columns = [ { title: '预付', - index: 'PRE' + index: 'PRE', + render:'PRE' }, { title: '到付', - index: 'RECE' - }, - { - title: '油卡', - index: 'OIL' + index: 'RECE', + render:'RECE' }, + // { + // title: '油卡', + // index: 'OIL' + // }, { title: '回单付', - index: 'BACK' + index: 'BACK', + render:'BACK' }, { title: '总运费', - index: 'traiPrice' + index: 'traiPrice', + render:'traiPrice' } ]; } From 0ae6f030be86f5fd5bd686e3d9fa5748c60c0d01 Mon Sep 17 00:00:00 2001 From: wangshiming Date: Wed, 2 Mar 2022 14:16:26 +0800 Subject: [PATCH 2/3] fix bug --- .../assigned-car/assigned-car.component.html | 59 ++++------ .../assigned-car/assigned-car.component.ts | 106 +++++++++++++++--- .../onecar-publish.component.ts | 2 - .../services/supply-management.service.ts | 2 + 4 files changed, 114 insertions(+), 55 deletions(-) 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 65a2952a..22030b03 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,66 +1,49 @@ -
- -
-
- +
+
- + (change)="changeSt($event)"> - + - - {{ car.carNo }} - - {{ car.carLength }}米,{{ car.carLoad }}吨 - - 空闲 - 已被指派 + + {{car.carNo}} - + {{car.carLength}}米,{{car.carLoad}}吨 - + 空闲 + 在途 未认证 - {{ item.captainName }} {{ item.captainPhone }} - 设置 + {{item.captainName}} {{item.captainPhone}} + 设置 空闲 - 已被指派 + 在途 未认证
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 11a756c4..bcbd14e5 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 @@ -2,8 +2,9 @@ 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 { EAEnvironmentService } from '@shared'; import { NzMessageService } from 'ng-zorro-antd/message'; -import { NzModalRef } from 'ng-zorro-antd/modal'; +import { NzModalRef, NzModalService } 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'; @@ -29,7 +30,6 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit { @ViewChild('st') st!: STComponent; @ViewChild('sf', { static: false }) sf!: SFComponent; status: string = 'anew'; - type: any; url = ''; // 请求的api地址 params: any = {}; // 传进来的参数 cardBADGE: STColumnBadge | any = { @@ -43,6 +43,8 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit { private msgSrv: NzMessageService, public service: SupplyManagementService, private modalHelper: ModalHelper, + private envSrv: EAEnvironmentService, + private modalSrv: NzModalService ) { this.initSF(); this.initSt(); @@ -54,10 +56,14 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit { get reqParams() { return { ...this.sf?.value, + loadingTime: this.params?.loadingTime, + unloadingTime: this.params?.unloadingTime }; } + + /** * 初始化查询表单 */ @@ -67,14 +73,15 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit { _$expand: { type: 'boolean', ui: { hidden: true } }, nameOrPhone: { type: 'string', - title: '', + title: '承运司机', ui: { placeholder: '请输入司机姓名/手机号' } }, carNo: { type: 'string', - title: '', + title: '车牌号', + maxLength: 9, ui: { placeholder: '请输入车牌号' } @@ -100,13 +107,12 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit { } ngOnInit(): void { - console.log(this.type) } dataProcess(data: STData[]): STData[] { return data.map((i, index) => { i.carId = ''; - i.disabled = i.carStatus === '1'; + i.disabled = (i?.certificationStatus === 1 && i.driverStatus === 1); const defaultCar = i?.userCarLicenseDesensitizationVOList?.find((item: any) => item.isDefault); if (defaultCar) { i.carId = defaultCar?.carId; @@ -116,16 +122,15 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit { } save(): void { - if (this.selectedRows) { - const { carId, appUserId: driverId, captainAppUserId: carCaptainId } = this.selectedRows; - const params: any = { carId, driverId, carCaptainId }; - this.service.request(this.url, { ...params, ...this.params }).subscribe((res: any) => { - if (res) { - this.modal.close(res); - } - }) + const { carId, appUserId: driverId, captainAppUserId: carCaptainId } = this.selectedRows; + const params: any = { carId, driverId, carCaptainId }; + this.service.request(this.url, { ...params, ...this.params }).subscribe((res: any) => { + if (res) { + this.service.msgSrv.success('指派成功!'); + this.modal.close(res); + } + }) - } } changeSt(e: STChange): void { @@ -143,10 +148,28 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit { }); } + /** + * 校验司机是否能设置车队长 + * @param item 当前对象 + */ + verifyCanSetCarCaptain(item: any) { + this.service.request(this.service.$api_get_sys_config, [{ itemKey: 'sys.config.shipper.setCarCaptain', businessId: this.envSrv.env.enterpriseId }]).subscribe(res => { + if (res && res.length > 0) { + const { itemValue } = res[0]; + if (itemValue !== '1') { + this.service.msgSrv.error('不可设置车队长!'); + return; + } + this.setCarCaptain(item); + } + }) + } + /** * 设置车队长 */ setCarCaptain(item: any) { + this.modalHelper.create(SupplyManagementAddDriversComponent, { dirvierInfo: item }, { size: 900, modalOptions: { nzMaskClosable: false, nzTitle: '设置' } @@ -168,4 +191,57 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit { this.sf.reset(); this.st.load(1); } + + /** + * 验证车辆的状态 + */ + verifyVechicleStatus(params: any) { + if (this.selectedRows) { + const obj = this.status === 'anew' ? { resourceId: params.id } : { ...params }; + const { carId, appUserId: driverId, captainAppUserId: carCaptainId } = this.selectedRows; + const carInfo: any = { carId, driverId, carCaptainId }; + this.service.request(this.service.$api_verify_vehicle_status, { ...obj, ...carInfo }).subscribe(res => { + if (res) { + const { title, alert, subContent, content } = res; + switch (alert) { + case 'Error': + // if (code === '3' || code === '4' || code === '8') { + // this.error(title, subContent, '#CF3834'); + // } else { + this.error(title, content, subContent); + break; + case 'Warn': + this.showConfirm(title, content, subContent); + break; + case 'Success': + this.save(); + break; + } + } + }) + } + + } + + error(title: string, content: string, subContent: string): void { + this.modalSrv.error({ + nzTitle: title, + nzContent: `${content ? content : ''}${subContent ? subContent : ''}`, + nzOkText: '知道了' + }); + } + + showConfirm(title: string, content: string, subContent: string): void { + this.modalSrv.confirm({ + nzTitle: title, + nzContent: `${content ? content : ''}${subContent ? subContent : ''}`, + nzOkText: '继续', + nzCancelText: '取消', + nzOnOk: () => { + this.save(); + } + }); + } + + } 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 9b1f69ae..0084578d 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 @@ -864,7 +864,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { } //指派熟车 chooseFamifiar(item: any) { - console.log('999'); const modalRef = this.modalService.create({ nzTitle: '指派熟车', nzContent: SupplyManagementVehicleAssignedCarComponent, @@ -873,7 +872,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { status: 'new', url: this.service.$api_save_assign_whole, params: item, - type: 'next' }, nzFooter: null }); diff --git a/src/app/routes/supply-management/services/supply-management.service.ts b/src/app/routes/supply-management/services/supply-management.service.ts index 5b9641c6..78dd862e 100644 --- a/src/app/routes/supply-management/services/supply-management.service.ts +++ b/src/app/routes/supply-management/services/supply-management.service.ts @@ -163,4 +163,6 @@ export class SupplyManagementService extends BaseService { public $api_goodsResourceOperateImport = '/api/sdc/uploadGoodsResource/goodsResourceOperateImport'; // 根据货主ID查询网络货运人信息 public $api_getNetworkTransporter = '/api/mdc/cuc/enterpriseInfo/operate/getNetworkTransporter'; + $api_verify_vehicle_status = `/api/sdc/goodsResourceShipper/saveVerify`;// 发布货源校验司机/车队长的状态 + $api_get_sys_config = `/api/mdc/pbc/sysConfigItem/findConfigValues`; // 根据项key、业务id获取配置信息 } From e66779ecb3cb6c951139fd7d92fcb39bd003ec29 Mon Sep 17 00:00:00 2001 From: wangshiming Date: Wed, 2 Mar 2022 14:29:37 +0800 Subject: [PATCH 3/3] fix bug --- .../choose-famifiar.component.html | 58 ++++------ .../choose-famifiar.component.ts | 108 ++++++++++++++---- .../set-captain/set-captain.component.ts | 19 ++- .../services/supply-management.service.ts | 4 +- 4 files changed, 121 insertions(+), 68 deletions(-) diff --git a/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.html b/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.html index df51267d..016d7031 100644 --- a/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.html +++ b/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.html @@ -4,48 +4,35 @@ * @Author : Shiming * @Date : 2022-01-12 10:52:50 * @LastEditors : Shiming - * @LastEditTime : 2022-01-18 17:27:53 + * @LastEditTime : 2022-03-02 14:27:20 * @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\components\\choose-famifiar\\choose-famifiar.component.html * Copyright (C) 2022 huzhenhong. All rights reserved. --> - - +
-
-
-
- -
-
- - -
-
+
+ +
+
+ +
- + [loadingDelay]="500" [loading]="service.http.loading" [widthMode]="{ type: 'strict' }" [scroll]="{ x: '600px' }" + style="margin-top: 22px"> - + @@ -53,21 +40,18 @@
已选择{{ st2Data.length }}位司机
- + {{ item.captainName }} {{ item.captainPhone }}   设置 + + {{item.default?.carNo}} +
diff --git a/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.ts b/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.ts index f73d3461..d2f126d1 100644 --- a/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.ts +++ b/src/app/routes/supply-management/components/choose-famifiar/choose-famifiar.component.ts @@ -3,7 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { STChange, STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st'; import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form'; import { ModalHelper } from '@delon/theme'; -import { processSingleSort } from '@shared'; +import { EAEnvironmentService, processSingleSort } from '@shared'; import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; import { SupplyManagementAddDriversComponent } from 'src/app/routes/supply-management/components/add-drivers/add-drivers.component'; @@ -37,7 +37,7 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { submitUrl = ''; @Input() - submitParams = {}; + submitParams:any; constructor( private modal: NzModalRef, @@ -47,8 +47,8 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { public service: SupplyManagementService, private modalService: NzModalService, private modalHelper: ModalHelper, - private cdr: ChangeDetectorRef - ) {} + private envSrv: EAEnvironmentService + ) { } /** * 查询参数 @@ -61,26 +61,23 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { } ngOnInit() { this.initSF(); - - setTimeout(() => { - this.initST(); - this.initST2(); - }, 200); + this.initST(); + this.initST2(); } initSF() { this.schema = { properties: { - name: { + nameOrPhone: { type: 'string', - title: '', + title: '承运司机', ui: { placeholder: '请输入司机姓名/手机号' } }, - name2: { + carNo: { type: 'string', - title: '', + title: '车牌号', ui: { placeholder: '请输入车牌号' } @@ -98,13 +95,11 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { this.columns = [ { title: '司机姓名', - index: 'name', - width: 120 + index: 'name' }, { title: '手机号', - index: 'telephone', - width: 120 + index: 'telephone' }, { title: '指定车辆', @@ -115,7 +110,6 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { title: '状态', className: 'text-center', index: 'certificationStatus', - width: 120, type: 'badge', badge: { '-1': { text: '未提交', color: 'default' }, @@ -127,12 +121,11 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { { title: '操作', className: 'text-center', - width: 80, buttons: [ { text: '选择', iif: item => item.showChoose != false, - click: (_record, _modal, _instance) => this.choose(_record), + click: (_record, _modal, _instance) => this.verifyVechicleStatus(_record), iifBehavior: 'disabled' } ] @@ -145,7 +138,7 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { { title: '司机姓名', index: 'name', - width: 120 + width: '90px' }, { title: '手机号', @@ -155,17 +148,17 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { { title: '车队长', render: 'captain', - width: '100px' + width: '200px' }, { title: '指定车辆', - index: 'carNo', + render: 'defaultCar', width: '130px' }, { title: '操作', className: 'text-center', - width: 80, + width: '90px', buttons: [ { text: '移除', @@ -198,6 +191,23 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { }); } + /** + * 校验司机是否能设置车队长 + * @param item 当前对象 + */ + verifyCanSetCarCaptain(item: any, index: any) { + this.service.request(this.service.$api_get_sys_config, [{ itemKey: 'sys.config.shipper.setCarCaptain', businessId: this.envSrv.env.enterpriseId }]).subscribe(res => { + if (res && res.length > 0) { + const { itemValue } = res[0]; + if (itemValue !== '1') { + this.service.msgSrv.error('不可设置车队长!'); + return; + } + this.setCaptain(item, index); + } + }) + } + //设置车队长 setCaptain(record: STData, index: any) { this.modalHelper @@ -260,5 +270,53 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit { }); } - carChange(event: any, item: STData) {} + carChange(event: any, item: STData) { + + } + + /** + * 验证车辆的状态 + */ + verifyVechicleStatus(_record: STData) { + const { carId, appUserId: driverId, captainAppUserId: carCaptainId } = _record; + const carInfo: any = { carId, driverId, carCaptainId }; + const goodsInfoList = this.submitParams?.goodsInfoList; + this.service.request(this.service.$api_verify_vehicle_status, { ...carInfo, goodsInfoList }).subscribe((res: any) => { + if (res) { + const { title, alert, subContent, content } = res; + switch (alert) { + case 'Error': + this.error(title, content, subContent); + break; + case 'Warn': + this.showConfirm(_record, title, content, subContent); + break; + case 'Success': + this.choose(_record); + break; + } + } + }); + + } + + error(title: string, content: string, subContent: string): void { + this.modalService.error({ + nzTitle: title, + nzContent: `${content ? content : ''}${subContent ? subContent : ''}`, + nzOkText: '知道了' + }); + } + + showConfirm(_record: STData, title: string, content: string, subContent: string): void { + this.modalService.confirm({ + nzTitle: title, + nzContent: `${content ? content : ''}${subContent ? subContent : ''}`, + nzOkText: '继续', + nzCancelText: '取消', + nzOnOk: () => { + this.choose(_record); + } + }); + } } diff --git a/src/app/routes/supply-management/components/choose-famifiar/set-captain/set-captain.component.ts b/src/app/routes/supply-management/components/choose-famifiar/set-captain/set-captain.component.ts index cf3b2b56..395a7514 100644 --- a/src/app/routes/supply-management/components/choose-famifiar/set-captain/set-captain.component.ts +++ b/src/app/routes/supply-management/components/choose-famifiar/set-captain/set-captain.component.ts @@ -1,3 +1,13 @@ +/* + * @Description : + * @Version : 1.0 + * @Author : Shiming + * @Date : 2021-12-06 15:17:52 + * @LastEditors : Shiming + * @LastEditTime : 2022-03-02 14:29:12 + * @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\components\\choose-famifiar\\set-captain\\set-captain.component.ts + * Copyright (C) 2022 huzhenhong. All rights reserved. + */ import { AfterViewInit, ChangeDetectorRef, Component, OnChanges, OnInit, ViewChild } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { SFComponent, SFSchema, SFSchemaEnumType, SFUISchema } from '@delon/form'; @@ -16,7 +26,7 @@ export class PublishchooseFamifiarSetCaptainComponent implements OnInit { i: any; - constructor(public http: _HttpClient, private cdr: ChangeDetectorRef, private route: ActivatedRoute) {} + constructor(public http: _HttpClient, private cdr: ChangeDetectorRef, private route: ActivatedRoute, private modal: NzModalRef,) {} ngOnInit(): void { this.initSF(); @@ -24,12 +34,11 @@ export class PublishchooseFamifiarSetCaptainComponent implements OnInit { initSF() { this.schema = { properties: { - name: { + captainPhone: { type: 'string', title: '车队长手机号' } }, - required: ['name'] }; this.ui = { '*': { @@ -39,6 +48,6 @@ export class PublishchooseFamifiarSetCaptainComponent implements OnInit { }; } - close() {} - save() {} + close() {this.modal.close()} + save() {this.modal.close(this.sf.value.captainPhone)} } diff --git a/src/app/routes/supply-management/services/supply-management.service.ts b/src/app/routes/supply-management/services/supply-management.service.ts index 78dd862e..303b6a46 100644 --- a/src/app/routes/supply-management/services/supply-management.service.ts +++ b/src/app/routes/supply-management/services/supply-management.service.ts @@ -4,7 +4,7 @@ * @Author : Shiming * @Date : 2021-12-03 11:10:14 * @LastEditors : Shiming - * @LastEditTime : 2022-03-02 10:10:18 + * @LastEditTime : 2022-03-02 14:27:18 * @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\services\\supply-management.service.ts * Copyright (C) 2022 huzhenhong. All rights reserved. */ @@ -165,4 +165,6 @@ export class SupplyManagementService extends BaseService { public $api_getNetworkTransporter = '/api/mdc/cuc/enterpriseInfo/operate/getNetworkTransporter'; $api_verify_vehicle_status = `/api/sdc/goodsResourceShipper/saveVerify`;// 发布货源校验司机/车队长的状态 $api_get_sys_config = `/api/mdc/pbc/sysConfigItem/findConfigValues`; // 根据项key、业务id获取配置信息 + // 获取指派熟车列表 + $api_getListCars = '/api/mdc/cuc/enterpriseVehicle/getPracticeCarList'; }