Merge branch 'develop' of https://gitlab.eascs.com/tms-ui/tms-obc-web into develop

This commit is contained in:
Taric Xin
2022-03-02 14:30:41 +08:00
9 changed files with 263 additions and 134 deletions

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2021-12-15 13:17:42 * @Date : 2021-12-15 13:17:42
* @LastEditors : Shiming * @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 * @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\vehicle\\confir-receipt\\confir-receipt.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
--> -->
@ -17,7 +17,20 @@
<sv-container col="1"> <sv-container col="1">
<sv label="费用明细"> <sv label="费用明细">
<st #st [widthMode]="{ type: 'strict' }" [data]="costDetail" [columns]="columns" bordered="true" [page]="{ show: false }"></st> <st #st [widthMode]="{ type: 'strict' }" [data]="costDetail" [columns]="columns" bordered="true" [page]="{ show: false }">
<ng-template st-row="PRE" let-item let-index="index">
{{item.PRE | currency}}
</ng-template>
<ng-template st-row="RECE" let-item let-index="index">
{{ item.RECE | currency }}
</ng-template>
<ng-template st-row="BACK" let-item let-index="index">
{{ item.BACK | currency }}
</ng-template>
<ng-template st-row="traiPrice" let-item let-index="index">
{{ item.traiPrice | currency }}
</ng-template>
</st>
</sv> </sv>
<sv label="司机车辆"> <sv label="司机车辆">
<div>{{ dataInfo?.driverName }} / {{ dataInfo?.driverPhone }}/ {{ dataInfo?.carNo }}</div> <div>{{ dataInfo?.driverName }} / {{ dataInfo?.driverPhone }}/ {{ dataInfo?.carNo }}</div>

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2021-12-15 13:17:42 * @Date : 2021-12-15 13:17:42
* @LastEditors : Shiming * @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 * @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\vehicle\\confir-receipt\\confir-receipt.component.ts
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
*/ */
@ -143,23 +143,27 @@ export class VehicleConfirReceiptComponent implements OnInit {
this.columns = [ this.columns = [
{ {
title: '预付', title: '预付',
index: 'PRE' index: 'PRE',
render:'PRE'
}, },
{ {
title: '到付', title: '到付',
index: 'RECE' index: 'RECE',
}, render:'RECE'
{
title: '油卡',
index: 'OIL'
}, },
// {
// title: '油卡',
// index: 'OIL'
// },
{ {
title: '回单付', title: '回单付',
index: 'BACK' index: 'BACK',
render:'BACK'
}, },
{ {
title: '总运费', title: '总运费',
index: 'traiPrice' index: 'traiPrice',
render:'traiPrice'
} }
]; ];
} }

View File

@ -1,66 +1,49 @@
<!--
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2021-12-03 11:10:14
* @LastEditors : Shiming
* @LastEditTime : 2022-01-18 17:27:30
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\components\\assigned-car\\assigned-car.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<div> <div>
<div nz-row> <div nz-row>
<div nz-col nzSpan="18"> <div nz-col nzSpan="18">
<sf #sf [schema]="schema" mode="search" [ui]="ui" [compact]="true" (formSubmit)="st.load(1)" (formReset)="reset()"></sf> <sf #sf [schema]="schema" mode="search" [ui]="ui" [compact]="true" (formSubmit)="st.load(1)"
</div> (formReset)="reset()"></sf>
<div nz-col nzSpan="6">
<button nz-button nzType="primary" style="margin-bottom: 24px" (click)="addDriver()"><i nz-icon nzType="plus"></i>添加司机</button>
</div> </div>
<!-- <div nz-col nzSpan="6">
<button nz-button nzType="primary" style="margin-bottom: 24px" (click)="addDriver()"><i nz-icon
nzType="plus"></i>添加司机</button>
</div> -->
</div> </div>
<div> <div>
<st <st #st [data]="service.$api_get_practice_car_list"
#st
[data]="service.$api_get_practice_car_list"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }" [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[columns]="columns" [columns]="columns" [res]="{ reName: { list: 'data.records', total: 'data.total' },process:dataProcess }"
[res]="{ reName: { list: 'data.records', total: 'data.total' }, process: dataProcess }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
(change)="changeSt($event)" (change)="changeSt($event)">
>
<ng-template st-row="carId" let-item let-index="index"> <ng-template st-row="carId" let-item let-index="index">
<nz-select [(ngModel)]="item.carId" style="width: 280px"> <nz-select [(ngModel)]="item.carId" style="width: 280px;">
<nz-option [nzValue]="''" nzLabel="不限"></nz-option> <nz-option [nzValue]="''" nzLabel="不限"></nz-option>
<nz-option <nz-option [nzValue]="car.carId" [nzLabel]="car.carNo"
[nzValue]="car.carId" *ngFor="let car of item.userCarLicenseDesensitizationVOList" [nzCustomContent]="true">
[nzLabel]="car.carNo" <span>{{car.carNo}} -</span>
*ngFor="let car of item.userCarLicenseDesensitizationVOList" <span>{{car.carLength}}米,{{car.carLoad}}吨 -</span>
[nzCustomContent]="true" <span *ngIf="car?.approvalStatus === 20 && !car.carStatus " class="text-success-dark">空闲</span>
> <span *ngIf="car?.approvalStatus === 20 && car.carStatus " class="text-warning-dark">在途</span>
<span>{{ car.carNo }} -</span>
<span>{{ car.carLength }}米,{{ car.carLoad }}吨 -</span>
<span *ngIf="car?.approvalStatus === 20 && !car.carStatus" class="text-success-dark">空闲</span>
<span *ngIf="car?.approvalStatus === 20 && car.carStatus" class="text-warning-dark">已被指派</span>
<span *ngIf="car?.approvalStatus !== 20" class="text-red-dark">未认证</span> <span *ngIf="car?.approvalStatus !== 20" class="text-red-dark">未认证</span>
<!-- <span [ngClass]="cardBADGE[car.carStatus]?.color">{{cardBADGE[car.carStatus]?.text}}</span> --> <!-- <span [ngClass]="cardBADGE[car.carStatus]?.color">{{cardBADGE[car.carStatus]?.text}}</span> -->
</nz-option> </nz-option>
</nz-select> </nz-select>
</ng-template> </ng-template>
<ng-template st-row="carCaptain" let-item let-index> <ng-template st-row="carCaptain" let-item let-index>
<span>{{ item.captainName }} {{ item.captainPhone }}</span> <span>{{item.captainName}} {{item.captainPhone}}</span>
<a (click)="setCarCaptain(item)">设置</a> <a (click)="verifyCanSetCarCaptain(item)">设置</a>
</ng-template> </ng-template>
<ng-template st-row="driverStatus" let-item let-index> <ng-template st-row="driverStatus" let-item let-index>
<span *ngIf="item?.certificationStatus === 1 && item.driverStatus === 0" class="text-success-dark">空闲</span> <span *ngIf="item?.certificationStatus === 1 && item.driverStatus === 0" class="text-success-dark">空闲</span>
<span *ngIf="item?.certificationStatus === 1 && item.driverStatus === 1" class="text-warning-dark">已被指派</span> <span *ngIf="item?.certificationStatus === 1 && item.driverStatus === 1" class="text-warning-dark">在途</span>
<span *ngIf="item?.certificationStatus !== 1" class="text-red-dark">未认证</span> <span *ngIf="item?.certificationStatus !== 1" class="text-red-dark">未认证</span>
</ng-template> </ng-template>
</st> </st>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button nz-button type="button" (click)="close()">关闭</button> <button nz-button type="button" (click)="close()">关闭</button>
<button nz-button type="submit" nzType="primary" (click)="save()" [disabled]="!selectedRows" [nzLoading]="service.http.loading" <button nz-button type="submit" nzType="primary" (click)="verifyVechicleStatus(params)" [disabled]="!selectedRows"
>发布并指派给司机</button [nzLoading]="service.http.loading">发布并指派给司机</button>
>
</div> </div>
</div> </div>

View File

@ -2,8 +2,9 @@ import { Component, OnInit, ViewChild } from '@angular/core';
import { STChange, STColumn, STColumnBadge, STComponent, STData } from '@delon/abc/st'; import { STChange, STColumn, STColumnBadge, STComponent, STData } from '@delon/abc/st';
import { SFComponent, SFSchema, SFUISchema } from '@delon/form'; import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
import { ModalHelper, _HttpClient } from '@delon/theme'; import { ModalHelper, _HttpClient } from '@delon/theme';
import { EAEnvironmentService } from '@shared';
import { NzMessageService } from 'ng-zorro-antd/message'; 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 { SupplyManagementService } from '../../services/supply-management.service';
import { SupplyManagementAddDriversComponent } from '../add-drivers/add-drivers.component'; import { SupplyManagementAddDriversComponent } from '../add-drivers/add-drivers.component';
import { CarAddmodalComponent } from '../addmodal/addmodal.component'; import { CarAddmodalComponent } from '../addmodal/addmodal.component';
@ -29,7 +30,6 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit {
@ViewChild('st') st!: STComponent; @ViewChild('st') st!: STComponent;
@ViewChild('sf', { static: false }) sf!: SFComponent; @ViewChild('sf', { static: false }) sf!: SFComponent;
status: string = 'anew'; status: string = 'anew';
type: any;
url = ''; // 请求的api地址 url = ''; // 请求的api地址
params: any = {}; // 传进来的参数 params: any = {}; // 传进来的参数
cardBADGE: STColumnBadge | any = { cardBADGE: STColumnBadge | any = {
@ -43,6 +43,8 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit {
private msgSrv: NzMessageService, private msgSrv: NzMessageService,
public service: SupplyManagementService, public service: SupplyManagementService,
private modalHelper: ModalHelper, private modalHelper: ModalHelper,
private envSrv: EAEnvironmentService,
private modalSrv: NzModalService
) { ) {
this.initSF(); this.initSF();
this.initSt(); this.initSt();
@ -54,10 +56,14 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit {
get reqParams() { get reqParams() {
return { return {
...this.sf?.value, ...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 } }, _$expand: { type: 'boolean', ui: { hidden: true } },
nameOrPhone: { nameOrPhone: {
type: 'string', type: 'string',
title: '', title: '承运司机',
ui: { ui: {
placeholder: '请输入司机姓名/手机号' placeholder: '请输入司机姓名/手机号'
} }
}, },
carNo: { carNo: {
type: 'string', type: 'string',
title: '', title: '车牌号',
maxLength: 9,
ui: { ui: {
placeholder: '请输入车牌号' placeholder: '请输入车牌号'
} }
@ -100,13 +107,12 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
console.log(this.type)
} }
dataProcess(data: STData[]): STData[] { dataProcess(data: STData[]): STData[] {
return data.map((i, index) => { return data.map((i, index) => {
i.carId = ''; i.carId = '';
i.disabled = i.carStatus === '1'; i.disabled = (i?.certificationStatus === 1 && i.driverStatus === 1);
const defaultCar = i?.userCarLicenseDesensitizationVOList?.find((item: any) => item.isDefault); const defaultCar = i?.userCarLicenseDesensitizationVOList?.find((item: any) => item.isDefault);
if (defaultCar) { if (defaultCar) {
i.carId = defaultCar?.carId; i.carId = defaultCar?.carId;
@ -116,17 +122,16 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit {
} }
save(): void { save(): void {
if (this.selectedRows) {
const { carId, appUserId: driverId, captainAppUserId: carCaptainId } = this.selectedRows; const { carId, appUserId: driverId, captainAppUserId: carCaptainId } = this.selectedRows;
const params: any = { carId, driverId, carCaptainId }; const params: any = { carId, driverId, carCaptainId };
this.service.request(this.url, { ...params, ...this.params }).subscribe((res: any) => { this.service.request(this.url, { ...params, ...this.params }).subscribe((res: any) => {
if (res) { if (res) {
this.service.msgSrv.success('指派成功!');
this.modal.close(res); this.modal.close(res);
} }
}) })
} }
}
changeSt(e: STChange): void { changeSt(e: STChange): void {
if (e?.type === 'loaded') this.selectedRows = null; if (e?.type === 'loaded') this.selectedRows = null;
@ -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) { setCarCaptain(item: any) {
this.modalHelper.create(SupplyManagementAddDriversComponent, { dirvierInfo: item }, { this.modalHelper.create(SupplyManagementAddDriversComponent, { dirvierInfo: item }, {
size: 900, size: 900,
modalOptions: { nzMaskClosable: false, nzTitle: '设置' } modalOptions: { nzMaskClosable: false, nzTitle: '设置' }
@ -168,4 +191,57 @@ export class SupplyManagementVehicleAssignedCarComponent implements OnInit {
this.sf.reset(); this.sf.reset();
this.st.load(1); 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: `<span class="text-error-dark">${content ? content : ''}</span><span class="text-grey-dark">${subContent ? subContent : ''}</span>`,
nzOkText: '知道了'
});
}
showConfirm(title: string, content: string, subContent: string): void {
this.modalSrv.confirm({
nzTitle: title,
nzContent: `<span class="text-error-dark">${content ? content : ''}</span><span class="text-grey-dark">${subContent ? subContent : ''}</span>`,
nzOkText: '继续',
nzCancelText: '取消',
nzOnOk: () => {
this.save();
}
});
}
} }

View File

@ -4,16 +4,13 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2022-01-12 10:52:50 * @Date : 2022-01-12 10:52:50
* @LastEditors : Shiming * @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 * @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\components\\choose-famifiar\\choose-famifiar.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
--> -->
<!-- <button nz-button nzType="primary" style="margin-bottom: 24px" (click)="add()"><i nz-icon nzType="plus"></i>添加司机</button> -->
<button nz-button nzType="primary" style="margin-bottom: 24px" (click)="add()"><i nz-icon nzType="plus"></i>添加司机</button>
<!-- 搜索区 --> <!-- 搜索区 -->
<div nz-row nzGutter="8"> <div nz-row nzGutter="8">
<div nz-col [nzSpan]="12">
<div nz-row nzGutter="8">
<div nz-col [nzSpan]="18"> <div nz-col [nzSpan]="18">
<sf #sf [ui]="ui" [schema]="schema" [button]="'none'"></sf> <sf #sf [ui]="ui" [schema]="schema" [button]="'none'"></sf>
</div> </div>
@ -21,31 +18,21 @@
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st.load(1)">查询</button> <button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st.load(1)">查询</button>
<button nz-button (click)="resetSF()">重置</button> <button nz-button (click)="resetSF()">重置</button>
</div> </div>
</div>
</div>
</div> </div>
<div nz-row nzGutter="8"> <div nz-row nzGutter="8">
<div nz-col [nzSpan]="12"> <div nz-col [nzSpan]="12">
<!-- 数据列表 --> <!-- 数据列表 -->
<st <st #st [bordered]="true" [data]="service.$api_getListCars" [columns]="columns" size="small"
#st
*ngIf="columns"
[bordered]="true"
[data]="service.$api_getList_card"
[columns]="columns"
size="small"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }" [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' }, process: reqProcess }" [res]="{ reName: { list: 'data.records', total: 'data.total' }, process: reqProcess }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loading]="service.http.loading" [loadingDelay]="500" [loading]="service.http.loading" [widthMode]="{ type: 'strict' }" [scroll]="{ x: '600px' }"
[widthMode]="{ type: 'strict' }" style="margin-top: 22px">
[scroll]="{ x: '600px' }"
style="margin-top: 22px; width: 100%"
>
<ng-template st-row="userCarLicenseDesensitizationVOList" let-item let-index="index"> <ng-template st-row="userCarLicenseDesensitizationVOList" let-item let-index="index">
<nz-select [(ngModel)]="item.default" (ngModelChange)="carChange($event, item)" style="width: 100%"> <nz-select [(ngModel)]="item.default" (ngModelChange)="carChange($event, item)" style="width: 100%">
<nz-option nzValue="" nzLabel="不限"></nz-option> <nz-option nzValue="" nzLabel="不限"></nz-option>
<nz-option [nzValue]="cart" [nzLabel]="cart.carNo" *ngFor="let cart of item.userCarLicenseDesensitizationVOList"> </nz-option> <nz-option [nzValue]="cart" [nzLabel]="cart.carNo"
*ngFor="let cart of item.userCarLicenseDesensitizationVOList"> </nz-option>
</nz-select> </nz-select>
</ng-template> </ng-template>
</st> </st>
@ -53,21 +40,18 @@
<div nz-col [nzSpan]="12"> <div nz-col [nzSpan]="12">
<!-- 选中列表 --> <!-- 选中列表 -->
<div>已选择{{ st2Data.length }}位司机</div> <div>已选择{{ st2Data.length }}位司机</div>
<st <st #st2 [bordered]="true" [data]="st2Data" [columns]="columns2" size="small"
#st2 [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
*ngIf="columns2" [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[bordered]="true" [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[data]="st2Data" [loadingDelay]="500" [loading]="service.http.loading" [widthMode]="{ type: 'strict' }" [scroll]="{ x: '600px' }">
[columns]="columns2"
size="small"
[page]="{ show: false }"
[scroll]="{ x: '600px', y: '300px' }"
style="width: 100%"
>
<ng-template st-row="captain" let-item let-index="index"> <ng-template st-row="captain" let-item let-index="index">
<span>{{ item.captainName }}&nbsp;{{ item.captainPhone }}</span> &nbsp; <span>{{ item.captainName }}&nbsp;{{ item.captainPhone }}</span> &nbsp;
<a (click)="setCaptain(item, index)">设置</a> <a (click)="setCaptain(item, index)">设置</a>
</ng-template> </ng-template>
<ng-template st-row="defaultCar" let-item let-index="index">
{{item.default?.carNo}}
</ng-template>
</st> </st>
</div> </div>
</div> </div>

View File

@ -3,7 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { STChange, STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st'; import { STChange, STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form'; import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
import { ModalHelper } from '@delon/theme'; import { ModalHelper } from '@delon/theme';
import { processSingleSort } from '@shared'; import { EAEnvironmentService, processSingleSort } from '@shared';
import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer'; import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer';
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
import { SupplyManagementAddDriversComponent } from 'src/app/routes/supply-management/components/add-drivers/add-drivers.component'; import { SupplyManagementAddDriversComponent } from 'src/app/routes/supply-management/components/add-drivers/add-drivers.component';
@ -37,7 +37,7 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
submitUrl = ''; submitUrl = '';
@Input() @Input()
submitParams = {}; submitParams:any;
constructor( constructor(
private modal: NzModalRef, private modal: NzModalRef,
@ -47,8 +47,8 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
public service: SupplyManagementService, public service: SupplyManagementService,
private modalService: NzModalService, private modalService: NzModalService,
private modalHelper: ModalHelper, private modalHelper: ModalHelper,
private cdr: ChangeDetectorRef private envSrv: EAEnvironmentService
) {} ) { }
/** /**
* 查询参数 * 查询参数
@ -61,26 +61,23 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.initSF(); this.initSF();
setTimeout(() => {
this.initST(); this.initST();
this.initST2(); this.initST2();
}, 200);
} }
initSF() { initSF() {
this.schema = { this.schema = {
properties: { properties: {
name: { nameOrPhone: {
type: 'string', type: 'string',
title: '', title: '承运司机',
ui: { ui: {
placeholder: '请输入司机姓名/手机号' placeholder: '请输入司机姓名/手机号'
} }
}, },
name2: { carNo: {
type: 'string', type: 'string',
title: '', title: '车牌号',
ui: { ui: {
placeholder: '请输入车牌号' placeholder: '请输入车牌号'
} }
@ -98,13 +95,11 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
this.columns = [ this.columns = [
{ {
title: '司机姓名', title: '司机姓名',
index: 'name', index: 'name'
width: 120
}, },
{ {
title: '手机号', title: '手机号',
index: 'telephone', index: 'telephone'
width: 120
}, },
{ {
title: '指定车辆', title: '指定车辆',
@ -115,7 +110,6 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
title: '状态', title: '状态',
className: 'text-center', className: 'text-center',
index: 'certificationStatus', index: 'certificationStatus',
width: 120,
type: 'badge', type: 'badge',
badge: { badge: {
'-1': { text: '未提交', color: 'default' }, '-1': { text: '未提交', color: 'default' },
@ -127,12 +121,11 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
{ {
title: '操作', title: '操作',
className: 'text-center', className: 'text-center',
width: 80,
buttons: [ buttons: [
{ {
text: '选择', text: '选择',
iif: item => item.showChoose != false, iif: item => item.showChoose != false,
click: (_record, _modal, _instance) => this.choose(_record), click: (_record, _modal, _instance) => this.verifyVechicleStatus(_record),
iifBehavior: 'disabled' iifBehavior: 'disabled'
} }
] ]
@ -145,7 +138,7 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
{ {
title: '司机姓名', title: '司机姓名',
index: 'name', index: 'name',
width: 120 width: '90px'
}, },
{ {
title: '手机号', title: '手机号',
@ -155,17 +148,17 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
{ {
title: '车队长', title: '车队长',
render: 'captain', render: 'captain',
width: '100px' width: '200px'
}, },
{ {
title: '指定车辆', title: '指定车辆',
index: 'carNo', render: 'defaultCar',
width: '130px' width: '130px'
}, },
{ {
title: '操作', title: '操作',
className: 'text-center', className: 'text-center',
width: 80, width: '90px',
buttons: [ buttons: [
{ {
text: '移除', 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) { setCaptain(record: STData, index: any) {
this.modalHelper 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: `<span class="text-error-dark">${content ? content : ''}</span><span class="text-grey-dark">${subContent ? subContent : ''}</span>`,
nzOkText: '知道了'
});
}
showConfirm(_record: STData, title: string, content: string, subContent: string): void {
this.modalService.confirm({
nzTitle: title,
nzContent: `<span class="text-error-dark">${content ? content : ''}</span><span class="text-grey-dark">${subContent ? subContent : ''}</span>`,
nzOkText: '继续',
nzCancelText: '取消',
nzOnOk: () => {
this.choose(_record);
}
});
}
} }

View File

@ -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 { AfterViewInit, ChangeDetectorRef, Component, OnChanges, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { SFComponent, SFSchema, SFSchemaEnumType, SFUISchema } from '@delon/form'; import { SFComponent, SFSchema, SFSchemaEnumType, SFUISchema } from '@delon/form';
@ -16,7 +26,7 @@ export class PublishchooseFamifiarSetCaptainComponent implements OnInit {
i: any; 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 { ngOnInit(): void {
this.initSF(); this.initSF();
@ -24,12 +34,11 @@ export class PublishchooseFamifiarSetCaptainComponent implements OnInit {
initSF() { initSF() {
this.schema = { this.schema = {
properties: { properties: {
name: { captainPhone: {
type: 'string', type: 'string',
title: '车队长手机号' title: '车队长手机号'
} }
}, },
required: ['name']
}; };
this.ui = { this.ui = {
'*': { '*': {
@ -39,6 +48,6 @@ export class PublishchooseFamifiarSetCaptainComponent implements OnInit {
}; };
} }
close() {} close() {this.modal.close()}
save() {} save() {this.modal.close(this.sf.value.captainPhone)}
} }

View File

@ -864,7 +864,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
} }
//指派熟车 //指派熟车
chooseFamifiar(item: any) { chooseFamifiar(item: any) {
console.log('999');
const modalRef = this.modalService.create({ const modalRef = this.modalService.create({
nzTitle: '指派熟车', nzTitle: '指派熟车',
nzContent: SupplyManagementVehicleAssignedCarComponent, nzContent: SupplyManagementVehicleAssignedCarComponent,
@ -873,7 +872,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
status: 'new', status: 'new',
url: this.service.$api_save_assign_whole, url: this.service.$api_save_assign_whole,
params: item, params: item,
type: 'next'
}, },
nzFooter: null nzFooter: null
}); });

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2021-12-03 11:10:14 * @Date : 2021-12-03 11:10:14
* @LastEditors : Shiming * @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 * @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\services\\supply-management.service.ts
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
*/ */
@ -163,4 +163,8 @@ export class SupplyManagementService extends BaseService {
public $api_goodsResourceOperateImport = '/api/sdc/uploadGoodsResource/goodsResourceOperateImport'; public $api_goodsResourceOperateImport = '/api/sdc/uploadGoodsResource/goodsResourceOperateImport';
// 根据货主ID查询网络货运人信息 // 根据货主ID查询网络货运人信息
public $api_getNetworkTransporter = '/api/mdc/cuc/enterpriseInfo/operate/getNetworkTransporter'; 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';
} }