车辆对接
This commit is contained in:
@ -1,3 +1,11 @@
|
||||
<!--
|
||||
* @Author: your name
|
||||
* @Date: 2021-12-21 10:57:48
|
||||
* @LastEditTime: 2022-01-06 16:51:38
|
||||
* @LastEditors: your name
|
||||
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
* @FilePath: \tms-obc-web\src\app\routes\supply-management\components\addmodal\addmodal.component.html
|
||||
-->
|
||||
<div class="modal-header">
|
||||
<div class="modal-title">添加熟车</div>
|
||||
</div>
|
||||
|
||||
@ -122,7 +122,7 @@ export class CarAddmodalComponent implements OnInit {
|
||||
}
|
||||
initData(flag?: any) {
|
||||
if (this.sf?.value.mobile) {
|
||||
this.service.request(this.service.$api_getCarCaptainByMobile, { mobile: this.sf?.value.mobile }).subscribe(res => {
|
||||
this.service.request(this.service.$api_getCarCaptainByMobile, { mobile: this.sf?.value.mobile }).subscribe((res: any) => {
|
||||
this.flag = flag
|
||||
if (res.userId) {
|
||||
this.tableData = [res];
|
||||
@ -151,7 +151,7 @@ export class CarAddmodalComponent implements OnInit {
|
||||
appUserId: item.appUserId ? item.appUserId : '',
|
||||
mobile: item.mobile
|
||||
}
|
||||
this.service.request(this.service.$api_enterpriseVehicleSave, params).subscribe(res => {
|
||||
this.service.request(this.service.$api_enterpriseVehicleSave, params).subscribe((res: any) => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success('添加成功')
|
||||
this.modal.close(true)
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
<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-col [nzSpan]="12">
|
||||
<div nz-row nzGutter="8">
|
||||
<div nz-col [nzSpan]="18">
|
||||
<sf #sf [ui]="ui" [schema]="schema" [button]="'none'"></sf>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="6">
|
||||
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st.load(1)">查询</button>
|
||||
<button nz-button (click)="resetSF()">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div nz-row nzGutter="8">
|
||||
<div nz-col [nzSpan]="14">
|
||||
<!-- 数据列表 -->
|
||||
<st #st [bordered]="true" [data]="service.$api_get_practice_car_list" [columns]="columns" size="small"
|
||||
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams,lazyLoad:true }"
|
||||
[res]="{ reName: { list: 'data.records', total: 'data.total' } , process: resProcess}"
|
||||
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
|
||||
[loadingDelay]="500" [loading]="service.http.loading" [widthMode]="{ type: 'strict' }" [scroll]="{ x: '600px' }"
|
||||
style="margin-top: 22px;" (change)="changeSt($event)">
|
||||
<ng-template st-row="userCarLicenseDesensitizationVOList" let-item let-index="index">
|
||||
<nz-select [(ngModel)]="item.default" (ngModelChange)="carChange($event, item)" style="width: 100%;">
|
||||
<nz-option nzValue="" nzLabel="不限"></nz-option>
|
||||
<nz-option [nzValue]="cart" [nzLabel]="cart.carNo"
|
||||
*ngFor="let cart of item.userCarLicenseDesensitizationVOList">
|
||||
</nz-option>
|
||||
</nz-select>
|
||||
</ng-template>
|
||||
|
||||
|
||||
</st>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="10">
|
||||
<!-- 选中列表 -->
|
||||
<div>已选择{{ st2Data.length }}位司机</div>
|
||||
<st #st2 [bordered]="true" [data]="st2Data" [columns]="columns2" size="small"
|
||||
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
|
||||
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
|
||||
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
|
||||
[loadingDelay]="500" [loading]="service.http.loading" [widthMode]="{ type: 'strict' }">
|
||||
<ng-template st-row="carNo" let-item let-index="index">
|
||||
<span>{{ item.carNo ? item.carNo:'不限' }}</span>
|
||||
</ng-template>
|
||||
<ng-template st-row="captain" let-item let-index="index">
|
||||
<span>{{ item.captainName }} {{ item.captainPhone }}</span>
|
||||
<a (click)="setCaptain(item)">设置</a>
|
||||
</ng-template>
|
||||
</st>
|
||||
</div>
|
||||
</div>
|
||||
<div *nzModalFooter>
|
||||
<button nz-button nzType="default" (click)="cancel()">取消</button>
|
||||
<button nz-button nzType="primary" (click)="submit()">发布并指派给司机</button>
|
||||
</div>
|
||||
@ -0,0 +1,24 @@
|
||||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SupplyManagementBulkAssignedCarComponent } from './assigned-car-bulk.component';
|
||||
|
||||
describe('SupplyManagementBulkAssignedCarComponent', () => {
|
||||
let component: SupplyManagementBulkAssignedCarComponent;
|
||||
let fixture: ComponentFixture<SupplyManagementBulkAssignedCarComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [SupplyManagementBulkAssignedCarComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SupplyManagementBulkAssignedCarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,292 @@
|
||||
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { STChange, STColumn, STColumnBadge, STComponent, STData } from '@delon/abc/st';
|
||||
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
|
||||
import { ModalHelper } from '@delon/theme';
|
||||
import { isTemplateRef } from 'ng-zorro-antd/core/util';
|
||||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { SupplyManagementService } from '../../services/supply-management.service';
|
||||
import { SupplyManagementAddDriversComponent } from '../add-drivers/add-drivers.component';
|
||||
import { PublishchooseFamifiarAddComponent } from '../choose-famifiar/add/add.component';
|
||||
|
||||
const BADGE: STColumnBadge = {
|
||||
1: { text: '空闲', color: 'success' },
|
||||
2: { text: '未实名', color: 'error' },
|
||||
3: { text: '在途', color: 'warning' },
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-supply-management-assigned-car',
|
||||
templateUrl: './assigned-car-bulk.component.html',
|
||||
})
|
||||
export class SupplyManagementBulkAssignedCarComponent implements OnInit {
|
||||
schema: SFSchema = {};
|
||||
columns!: STColumn[];
|
||||
i: any;
|
||||
ui!: SFUISchema;
|
||||
sfExpand = false;
|
||||
@ViewChild('st', { static: false })
|
||||
st!: STComponent;
|
||||
@ViewChild('sf', { static: false })
|
||||
sf!: SFComponent;
|
||||
|
||||
@ViewChild('st2', { static: false })
|
||||
st2!: STComponent;
|
||||
columns2!: STColumn[];
|
||||
st2Data: STData[] = [];
|
||||
|
||||
@Input()
|
||||
submitUrl = '';
|
||||
|
||||
@Input()
|
||||
submitParams = {};
|
||||
hasSelectedDrivers = [];
|
||||
|
||||
constructor(
|
||||
private modal: NzModalRef,
|
||||
public router: Router,
|
||||
public ar: ActivatedRoute,
|
||||
public service: SupplyManagementService,
|
||||
private modalService: NzModalService,
|
||||
private modalHelper: ModalHelper,
|
||||
) { }
|
||||
|
||||
/**
|
||||
* 查询参数
|
||||
*/
|
||||
get reqParams() {
|
||||
return {
|
||||
...this.sf?.value,
|
||||
isManage: 0
|
||||
};
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.initSF();
|
||||
this.initST();
|
||||
this.initST2();
|
||||
this.getHasAssignedCar(this.i?.id);
|
||||
}
|
||||
|
||||
initSF() {
|
||||
this.schema = {
|
||||
properties: {
|
||||
nameOrPhone: {
|
||||
type: 'string',
|
||||
title: '',
|
||||
ui: {
|
||||
placeholder: '请输入司机姓名/手机号'
|
||||
}
|
||||
},
|
||||
carNo: {
|
||||
type: 'string',
|
||||
title: '',
|
||||
ui: {
|
||||
placeholder: '请输入车牌号'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
this.ui = {
|
||||
'*': {
|
||||
spanLabelFixed: 10,
|
||||
grid: { span: 12, gutter: 4, }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
initST() {
|
||||
this.columns = [
|
||||
{
|
||||
title: '司机姓名',
|
||||
index: 'name'
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
index: 'telephone'
|
||||
},
|
||||
|
||||
{
|
||||
title: '指定车辆',
|
||||
width: 130,
|
||||
render: 'userCarLicenseDesensitizationVOList'
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
className: 'text-center',
|
||||
index: 'certificationStatus',
|
||||
type: 'badge',
|
||||
badge: {
|
||||
'-1': { text: '未提交', color: 'default' },
|
||||
0: { text: '待审核', color: 'processing' },
|
||||
1: { text: '已认证', color: 'success' },
|
||||
2: { text: '未认证', color: 'error' }
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
className: 'text-center',
|
||||
buttons: [
|
||||
{
|
||||
text: '选择',
|
||||
iif: item => !item.checked,
|
||||
click: (_record, _modal, _instance) => this.choose(_record),
|
||||
iifBehavior: 'disabled'
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
initST2() {
|
||||
this.columns2 = [
|
||||
{
|
||||
title: '司机姓名',
|
||||
index: 'name',
|
||||
className: 'text-center',
|
||||
width: '80px'
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
index: 'telephone',
|
||||
className: 'text-center',
|
||||
width: '100px'
|
||||
},
|
||||
{
|
||||
title: '车队长',
|
||||
render: 'captain',
|
||||
className: 'text-center',
|
||||
width: '200px'
|
||||
},
|
||||
{
|
||||
title: '指定车辆',
|
||||
render: 'carNo',
|
||||
className: 'text-center',
|
||||
width: '100px'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
className: 'text-center',
|
||||
width: '80px',
|
||||
buttons: [
|
||||
{
|
||||
text: '移除',
|
||||
click: (_record, _modal, _instance) => this.remove(_record, _modal, _instance)
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
// 选择
|
||||
choose(record: STData) {
|
||||
this.st2Data = [...this.st2Data, ...[record]];
|
||||
this.st.setRow(record, { checked: true });
|
||||
}
|
||||
|
||||
// 移除
|
||||
remove(record: STData, value1: any, comp: any) {
|
||||
const index = this.st?.list.findIndex((obj: any) => obj.appUserId === record.appUserId);
|
||||
if (index >= 0) {
|
||||
comp!.removeRow(record);
|
||||
this.st2Data = this.st2Data.filter(item => item.appUserId !== record.appUserId);
|
||||
this.st.setRow(index, { checked: false });
|
||||
}
|
||||
}
|
||||
|
||||
//添加司机
|
||||
add() {
|
||||
this.modalService.create({
|
||||
nzTitle: '添加司机',
|
||||
nzContent: PublishchooseFamifiarAddComponent
|
||||
});
|
||||
}
|
||||
|
||||
//设置车队长
|
||||
setCaptain(record: STData) {
|
||||
|
||||
this.modalHelper.create(SupplyManagementAddDriversComponent, { dirvierInfo: record }, {
|
||||
size: 900,
|
||||
modalOptions: { nzMaskClosable: false, nzTitle: '设置' }
|
||||
}
|
||||
).subscribe((res) => {
|
||||
if (res) {
|
||||
this.st2Data = this.st2Data.map(_item => {
|
||||
if (_item?.userId === record?.userId) {
|
||||
_item.captainName = res?.name;
|
||||
_item.captainPhone = res?.mobile;
|
||||
_item.captainAppUserId = res?.appUserId;
|
||||
}
|
||||
return _item;
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置表单
|
||||
*/
|
||||
resetSF() {
|
||||
this.sf.reset();
|
||||
this.sfExpand = false;
|
||||
this.st.load(1);
|
||||
}
|
||||
|
||||
expandToggle() {
|
||||
this.sfExpand = !this.sfExpand;
|
||||
this.sf?.setValue('/_expand', this.sfExpand);
|
||||
}
|
||||
|
||||
// 熟车请求数据处理
|
||||
resProcess(data: STData[]): STData[] {
|
||||
return data.map((i, index) => {
|
||||
const defaultCart = i.userCarLicenseDesensitizationVOList.find((cart: any) => cart.isDefault);
|
||||
return { ...i, default: defaultCart || '' };
|
||||
});
|
||||
}
|
||||
|
||||
cancel() {
|
||||
this.modal.close();
|
||||
}
|
||||
|
||||
submit() {
|
||||
if (this.st2Data?.length <= 0) {
|
||||
this.service.msgSrv.warning('请选择熟车');
|
||||
return;
|
||||
}
|
||||
const data = this.st2Data.map(item => ({ driverId: item.appUserId, carId: item.default?.carId || null, carCaptainId: item.captainAppUserId }));
|
||||
this.service.request(this.service.$api_save_assign_bulk, { id: this.i?.id, carDriverIds: data }).subscribe(res => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success('指派成功');
|
||||
this.modal.destroy(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
changeSt(e: STChange) {
|
||||
if (e?.type === 'loaded' && this.st2Data.length > 0) {
|
||||
// 页面加载完成时勾选
|
||||
(e?.loaded || []).forEach((r, index) => {
|
||||
this.st2Data.forEach((x) => {
|
||||
if (x.appUserId === r.appUserId) {
|
||||
this.st.setRow(index, { checked: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
carChange(event: any, item: STData) {
|
||||
// this.st.setRow(item, { carName: event });
|
||||
}
|
||||
|
||||
getHasAssignedCar(id: any) {
|
||||
this.service.request(this.service.$api_get_has_assigned_car_list, { id }).subscribe(res => {
|
||||
if (res) {
|
||||
this.hasSelectedDrivers = res;
|
||||
this.st2Data = [...res];
|
||||
this.st.reload();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@ -237,8 +237,10 @@
|
||||
|
||||
<nz-card>
|
||||
<div class="align-center">
|
||||
<!-- <button nz-button nzType="primary" (click)="submit('assign')">指派熟车</button> -->
|
||||
<button nz-button nzType="primary" (click)="choose()">取消</button>
|
||||
|
||||
<button nz-button nzType="primary" (click)="submit('assign')">生成二维码</button>
|
||||
<button nz-button nzType="primary" (click)="submit('assign')">指派熟车</button>
|
||||
<button nz-button nzType="primary" style="margin-left: 48px" (click)="submit('publish')">司机抢单</button>
|
||||
</div>
|
||||
</nz-card>
|
||||
|
||||
@ -457,28 +457,43 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
|
||||
|
||||
//指派熟车
|
||||
chooseFamifiar(item: any) {
|
||||
// this.modalService.create({
|
||||
// nzTitle: '指派熟车',
|
||||
// nzContent: PublishGoodsChooseFamifiarComponent,
|
||||
// nzComponentParams: {
|
||||
// submitParams: item,
|
||||
// submitUrl: this.service.$api_save_bulk_assign
|
||||
// },
|
||||
// nzWidth: 1300
|
||||
// });
|
||||
}
|
||||
submit(submitType: string): void {
|
||||
Object.keys(this.validateForm1.controls).forEach(key => {
|
||||
this.validateForm1.controls[key].markAsDirty();
|
||||
this.validateForm1.controls[key].updateValueAndValidity();
|
||||
const modalRef = this.modalService.create({
|
||||
nzTitle: '指派熟车',
|
||||
nzContent: PublishGoodsChooseFamifiarComponent,
|
||||
nzComponentParams: {
|
||||
submitParams: item,
|
||||
submitUrl: this.service.$api_save_bulk_assign
|
||||
},
|
||||
nzWidth: 1300,
|
||||
});
|
||||
this.sf1.validator({ emitError: true });
|
||||
this.sf3.validator({ emitError: true });
|
||||
this.sf4.validator({ emitError: true });
|
||||
this.sf6.validator({ emitError: true });
|
||||
if (this.validateForm1.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) {
|
||||
return;
|
||||
modalRef.afterClose.subscribe(result => {
|
||||
if (result) {
|
||||
this.openFinishPage(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
// 打开下单完成页面
|
||||
openFinishPage(resourceObj: any = null) {
|
||||
this.modalService.create({
|
||||
nzTitle: '',
|
||||
nzContent: PublishSuccessComponent,
|
||||
nzWidth: 900,
|
||||
nzFooter: null,
|
||||
nzComponentParams: { type: 'bulk' }
|
||||
});
|
||||
}
|
||||
submit(submitType: string): void {
|
||||
// Object.keys(this.validateForm1.controls).forEach(key => {
|
||||
// this.validateForm1.controls[key].markAsDirty();
|
||||
// this.validateForm1.controls[key].updateValueAndValidity();
|
||||
// });
|
||||
// this.sf1.validator({ emitError: true });
|
||||
// this.sf3.validator({ emitError: true });
|
||||
// this.sf4.validator({ emitError: true });
|
||||
// this.sf6.validator({ emitError: true });
|
||||
// if (this.validateForm1.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// //装卸货信息
|
||||
const LoadingList = this.startInfo.concat(this.endInfo);
|
||||
@ -646,7 +661,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
|
||||
if (res) {
|
||||
this.sf3.getProperty('/goodsNameId')!.schema.enum = res;
|
||||
this.sf3.getProperty('/goodsNameId')!.widget.reset(res);
|
||||
if(this.sf3data.goodsNameId){
|
||||
if(this.sf3data?.goodsNameId){
|
||||
this.sf3.setValue('/goodsNameId',this.sf3data.goodsNameId);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -8,6 +8,7 @@ import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { of } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { SupplyManagementService } from '../../services/supply-management.service';
|
||||
import { SupplyManagementBulkAssignedCarComponent } from '../assigned-car-bulk/assigned-car-bulk.component';
|
||||
import { SupplyManagementQrcodePageComponent } from '../qrcode-page/qrcode-page.component';
|
||||
import { SupplyManagementUpdatePriceComponent } from '../update-price/update-price.component';
|
||||
|
||||
@ -298,7 +299,7 @@ export class SupplyManagementBulkComponent implements OnInit {
|
||||
},
|
||||
{
|
||||
text: '重新指派',
|
||||
click: (_record) => this.delOne(_record),
|
||||
click: (_record) => this.assignedCar(_record),
|
||||
iif: item => item.auditStatus == 2,
|
||||
},
|
||||
],
|
||||
@ -310,6 +311,26 @@ export class SupplyManagementBulkComponent implements OnInit {
|
||||
// .createStatic(FormEditComponent, { i: { id: 0 } })
|
||||
// .subscribe(() => this.st.reload());
|
||||
}
|
||||
/**
|
||||
* 重新指派
|
||||
*/
|
||||
assignedCar(item: any) {
|
||||
const modalRef = this.modal.create({
|
||||
nzTitle: '指派熟车',
|
||||
nzWidth: '1500px',
|
||||
nzContent: SupplyManagementBulkAssignedCarComponent,
|
||||
nzComponentParams: {
|
||||
i: item
|
||||
},
|
||||
nzFooter: null,
|
||||
|
||||
});
|
||||
modalRef.afterClose.subscribe((result) => {
|
||||
if (result) {
|
||||
this.st.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 查询字段个数
|
||||
*/
|
||||
|
||||
@ -1,65 +1,62 @@
|
||||
<button nz-button nzType="primary" style="margin-bottom: 24px" (click)="add()"><i nz-icon nzType="plus"></i>添加司机</button>
|
||||
<!--
|
||||
* @Author: your name
|
||||
* @Date: 2021-12-06 15:17:52
|
||||
* @LastEditTime: 2022-01-06 16:42:37
|
||||
* @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\components\choose-famifiar\choose-famifiar.component.html
|
||||
-->
|
||||
<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-col [nzSpan]="12">
|
||||
<div nz-row nzGutter="8">
|
||||
<div nz-col [nzSpan]="18">
|
||||
<sf #sf [ui]="ui" [schema]="schema" [button]="'none'"></sf>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="6">
|
||||
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st.load(1)">查询</button>
|
||||
<button nz-button (click)="resetSF()">重置</button>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="12">
|
||||
<div nz-row nzGutter="8">
|
||||
<div nz-col [nzSpan]="18">
|
||||
<sf #sf [ui]="ui" [schema]="schema" [button]="'none'"></sf>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="6">
|
||||
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st.load(1)">查询</button>
|
||||
<button nz-button (click)="resetSF()">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div nz-row nzGutter="8">
|
||||
<div nz-col [nzSpan]="12">
|
||||
<!-- 数据列表 -->
|
||||
<st
|
||||
#st
|
||||
[bordered]="true"
|
||||
[data]="dataInfo"
|
||||
[columns]="columns"
|
||||
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams, process: reqProcess }"
|
||||
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
|
||||
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
|
||||
[loadingDelay]="500"
|
||||
[loading]="service.http.loading"
|
||||
[widthMode]="{ type: 'strict' }"
|
||||
[scroll]="{ x: '600px' }"
|
||||
>
|
||||
<ng-template st-row="name3" let-item let-index="index">
|
||||
<nz-select ngModel="lucy" (ngModelChange)="carChange($event,item)">
|
||||
<nz-option nzValue="jack" nzLabel="Jack"></nz-option>
|
||||
<nz-option nzValue="lucy" nzLabel="Lucy"></nz-option>
|
||||
</nz-select>
|
||||
</ng-template>
|
||||
</st>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="12">
|
||||
<!-- 选中列表 -->
|
||||
<st
|
||||
#st2
|
||||
[bordered]="true"
|
||||
[data]="st2Data"
|
||||
[columns]="columns2"
|
||||
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams, process: reqProcess }"
|
||||
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
|
||||
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
|
||||
[loadingDelay]="500"
|
||||
[loading]="service.http.loading"
|
||||
[widthMode]="{ type: 'strict' }"
|
||||
[scroll]="{ x: '600px' }"
|
||||
>
|
||||
<ng-template st-row="name3" let-item let-index="index">
|
||||
<span>{{ item.name3 }} {{ item.name4 }}</span>
|
||||
<a (click)="setCaptain(item)">设置</a>
|
||||
</ng-template>
|
||||
</st>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="12">
|
||||
<!-- 数据列表 -->
|
||||
<st #st [bordered]="true" [data]="service.$api_getList_card" [columns]="columns" size="small"
|
||||
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
|
||||
[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] }"
|
||||
[loadingDelay]="500" [loading]="service.http.loading" [widthMode]="{ type: 'strict' }" [scroll]="{ x: '600px' }"
|
||||
style="margin-top: 22px;">
|
||||
<ng-template st-row="userCarLicenseDesensitizationVOList" let-item let-index="index">
|
||||
<nz-select [(ngModel)]="item.default" (ngModelChange)="carChange($event, item)" style="width: 100%;">
|
||||
<nz-option nzValue="" nzLabel="不限"></nz-option>
|
||||
<nz-option [nzValue]="cart" [nzLabel]="cart.carNo"
|
||||
*ngFor="let cart of item.userCarLicenseDesensitizationVOList">
|
||||
</nz-option>
|
||||
</nz-select>
|
||||
</ng-template>
|
||||
</st>
|
||||
</div>
|
||||
<div nz-col [nzSpan]="12">
|
||||
<!-- 选中列表 -->
|
||||
<div>已选择{{ st2Data.length }}位司机</div>
|
||||
<st #st2 [bordered]="true" [data]="st2Data" [columns]="columns2" size="small"
|
||||
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
|
||||
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
|
||||
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
|
||||
[loadingDelay]="500" [loading]="service.http.loading" [widthMode]="{ type: 'strict' }" [scroll]="{ x: '600px' }">
|
||||
<ng-template st-row="captain" let-item let-index="index">
|
||||
<span>{{ item.captainName }} {{ item.captainPhone }}</span>
|
||||
<a (click)="setCaptain(item,index)">设置</a>
|
||||
</ng-template>
|
||||
</st>
|
||||
</div>
|
||||
</div>
|
||||
<div *nzModalFooter>
|
||||
<button nz-button nzType="default" (click)="cancel()">取消</button>
|
||||
<button nz-button nzType="primary" (click)="ok()">发布并指派给司机</button>
|
||||
<button nz-button nzType="default" (click)="cancel()">取消</button>
|
||||
<button nz-button nzType="primary" (click)="ok()">发布并指派给司机</button>
|
||||
</div>
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
||||
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 { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer';
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { SupplyManagementAddDriversComponent } from 'src/app/routes/supply-management/components/add-drivers/add-drivers.component';
|
||||
|
||||
import { SupplyManagementService } from '../../services/supply-management.service';
|
||||
import { CarAddmodalComponent } from '../addmodal/addmodal.component';
|
||||
import { PublishchooseFamifiarAddComponent } from './add/add.component';
|
||||
import { PublishchooseFamifiarSetCaptainComponent } from './set-captain/set-captain.component';
|
||||
|
||||
@ -18,6 +20,7 @@ import { PublishchooseFamifiarSetCaptainComponent } from './set-captain/set-capt
|
||||
export class PublishGoodsChooseFamifiarComponent implements OnInit {
|
||||
schema: SFSchema = {};
|
||||
columns!: STColumn[];
|
||||
i: any;
|
||||
ui!: SFUISchema;
|
||||
sfExpand = false;
|
||||
@ViewChild('st', { static: false })
|
||||
@ -30,45 +33,22 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
|
||||
columns2!: STColumn[];
|
||||
st2Data: STData[] = [];
|
||||
|
||||
@Input()
|
||||
submitUrl = '';
|
||||
|
||||
@Input()
|
||||
submitParams = {};
|
||||
|
||||
constructor(
|
||||
private modal: NzModalService,
|
||||
private modal: NzModalRef,
|
||||
public router: Router,
|
||||
public ar: ActivatedRoute,
|
||||
private drawerService: NzDrawerService,
|
||||
public service: SupplyManagementService,
|
||||
private modalService: NzModalService
|
||||
private modalService: NzModalService,
|
||||
private modalHelper: ModalHelper
|
||||
) {}
|
||||
|
||||
dataInfo: STData[] = [
|
||||
{
|
||||
id: '1',
|
||||
name1: '1111',
|
||||
name2: '2222',
|
||||
name3: '3333',
|
||||
name4: '4444',
|
||||
name5: '5555',
|
||||
name6: '6666',
|
||||
name7: '7777',
|
||||
name8: '8888',
|
||||
name9: '9999',
|
||||
name10: '1010',
|
||||
name11: '1012',
|
||||
name12: '1013'
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
name1: '9999',
|
||||
name2: '8888',
|
||||
name3: '7777',
|
||||
name4: '6666',
|
||||
name5: '5555',
|
||||
name6: '4444',
|
||||
name7: '3333',
|
||||
name8: '2222',
|
||||
name9: '1111'
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
* 查询参数
|
||||
*/
|
||||
@ -78,10 +58,6 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
|
||||
isManage: 0
|
||||
};
|
||||
}
|
||||
|
||||
get selectedRows() {
|
||||
return this.st?.list.filter(item => item.checked) || [];
|
||||
}
|
||||
ngOnInit() {
|
||||
this.initSF();
|
||||
this.initST();
|
||||
@ -118,21 +94,28 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
|
||||
this.columns = [
|
||||
{
|
||||
title: '司机姓名',
|
||||
index: 'name1'
|
||||
index: 'name'
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
index: 'name2'
|
||||
index: 'telephone'
|
||||
},
|
||||
{
|
||||
title: '指定车辆',
|
||||
index: 'name3',
|
||||
render: 'name3',
|
||||
width: '180px'
|
||||
width: 130,
|
||||
render: 'userCarLicenseDesensitizationVOList'
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
index: 'name4'
|
||||
className: 'text-center',
|
||||
index: 'certificationStatus',
|
||||
type: 'badge',
|
||||
badge: {
|
||||
'-1': { text: '未提交', color: 'default' },
|
||||
0: { text: '待审核', color: 'processing' },
|
||||
1: { text: '已认证', color: 'success' },
|
||||
2: { text: '未认证', color: 'error' }
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
@ -140,8 +123,9 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
|
||||
buttons: [
|
||||
{
|
||||
text: '选择',
|
||||
iif: item => item.showChoose !== 'false',
|
||||
click: (_record, _modal, _instance) => this.choose(_record)
|
||||
iif: item => item.showChoose != false,
|
||||
click: (_record, _modal, _instance) => this.choose(_record),
|
||||
iifBehavior: 'disabled'
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -152,21 +136,22 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
|
||||
this.columns2 = [
|
||||
{
|
||||
title: '司机姓名',
|
||||
index: 'name1'
|
||||
index: 'name'
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
index: 'name2'
|
||||
index: 'telephone',
|
||||
width: '120px'
|
||||
},
|
||||
{
|
||||
title: '车队长',
|
||||
index: 'name3',
|
||||
render: 'name3',
|
||||
width: '180px'
|
||||
render: 'captain',
|
||||
width: '200px'
|
||||
},
|
||||
{
|
||||
title: '指定车辆',
|
||||
index: 'name4'
|
||||
index: 'carNo',
|
||||
width: '130px'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
@ -183,36 +168,42 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
|
||||
|
||||
// 选择
|
||||
choose(record: STData) {
|
||||
this.st2Data.push({ ...record });
|
||||
this.st2.load();
|
||||
this.st.setRow(record, { showChoose: 'false' });
|
||||
this.st2Data = [...this.st2Data, ...[record]];
|
||||
this.st.setRow(record, { showChoose: false });
|
||||
}
|
||||
// 移除
|
||||
remove(record: STData, value1: any, value2: any) {
|
||||
this.st.setRow(record, { showChoose: 'true' });
|
||||
let index = (this.st2Data || []).findIndex(obj => obj.id === record.id);
|
||||
this.st2Data.splice(index, 1);
|
||||
this.st2.load();
|
||||
|
||||
const stData = this.st.data;
|
||||
let index2 = (stData as any).findIndex((obj: any) => obj.id === record.id);
|
||||
this.st.setRow(index2, { showChoose: 'true' });
|
||||
remove(record: STData, value1: any, comp: any) {
|
||||
const index = this.st?.list.findIndex((obj: any) => obj.appUserId === record.appUserId);
|
||||
if (index >= 0) {
|
||||
comp!.removeRow(record);
|
||||
this.st2Data = this.st2Data.filter(item => item.appUserId !== record.appUserId);
|
||||
this.st.setRow(index, { showChoose: true });
|
||||
}
|
||||
}
|
||||
|
||||
//添加司机
|
||||
add() {
|
||||
this.modalService.create({
|
||||
nzTitle: '添加司机',
|
||||
nzContent: PublishchooseFamifiarAddComponent
|
||||
this.modalHelper.create(CarAddmodalComponent, {}, { size: 900, modalOptions: { nzMaskClosable: false } }).subscribe(res => {
|
||||
if (res) this.st.reload();
|
||||
});
|
||||
}
|
||||
|
||||
//设置车队长
|
||||
setCaptain(record: STData) {
|
||||
this.modalService.create({
|
||||
nzTitle: '设置车队长',
|
||||
nzContent: PublishchooseFamifiarSetCaptainComponent
|
||||
});
|
||||
setCaptain(record: STData, index: any) {
|
||||
this.modalHelper
|
||||
.create(
|
||||
SupplyManagementAddDriversComponent,
|
||||
{ dirvierInfo: record },
|
||||
{
|
||||
size: 900,
|
||||
modalOptions: { nzMaskClosable: false, nzTitle: '设置' }
|
||||
}
|
||||
)
|
||||
.subscribe(res => {
|
||||
if (res) {
|
||||
this.st2.setRow(index, { captainName: res.name, captainPhone: res.mobile, captainAppUserId: res.appUserId });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -229,16 +220,35 @@ export class PublishGoodsChooseFamifiarComponent implements OnInit {
|
||||
this.sf?.setValue('/_expand', this.sfExpand);
|
||||
}
|
||||
|
||||
// 排序
|
||||
reqProcess(requestOptions: STRequestOptions): STRequestOptions {
|
||||
return processSingleSort(requestOptions);
|
||||
// 熟车请求数据处理
|
||||
reqProcess(data: STData[]): STData[] {
|
||||
return data.map((i, index) => {
|
||||
const defaultCart = i.userCarLicenseDesensitizationVOList.find((cart: any) => cart.isDefault);
|
||||
return { ...i, default: defaultCart || '' };
|
||||
});
|
||||
}
|
||||
|
||||
cancel() {}
|
||||
|
||||
ok() {}
|
||||
|
||||
carChange(event: any, item: STData) {
|
||||
this.st.setRow(item, { name3: event });
|
||||
cancel() {
|
||||
this.modal.destroy();
|
||||
}
|
||||
|
||||
ok() {
|
||||
if (this.st2._data?.length <= 0) {
|
||||
this.service.msgSrv.warning('请选择熟车');
|
||||
return;
|
||||
}
|
||||
const data = this.st2._data.map(item => ({
|
||||
driverId: item.appUserId,
|
||||
carId: item.default?.carId || null,
|
||||
carCaptainId: item.captainAppUserId
|
||||
}));
|
||||
this.service.request(this.submitUrl, { ...this.submitParams, carDriverIds: data }).subscribe((rs: any) => {
|
||||
if (rs) {
|
||||
this.service.msgSrv.success('指派成功');
|
||||
this.modal.destroy(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
carChange(event: any, item: STData) {}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* @Author: your name
|
||||
* @Date: 2021-12-03 11:10:14
|
||||
* @LastEditTime: 2022-01-06 15:32:50
|
||||
* @LastEditTime: 2022-01-06 16:38:52
|
||||
* @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\services\supply-management.service.ts
|
||||
@ -80,6 +80,11 @@ export class SupplyManagementService extends BaseService {
|
||||
$api_deletebatch = `/api/mdc/cuc/enterpriseVehicle/deletebatch`;
|
||||
// 熟车详情
|
||||
$api_getMyDriverUserDetail = `/api/mdc/cuc/enterpriseVehicle/getMyDriverUserDetail`;
|
||||
|
||||
// 获取指派熟车列表
|
||||
$api_getList_card = '/api/mdc/cuc/enterpriseVehicle/getPracticeCarList';
|
||||
|
||||
|
||||
// 根据地区code查询列表
|
||||
$api_getRegionByCode = '/api/mdc/pbc/region/getRegionByCode';
|
||||
// 识别身份证
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* @Author: your name
|
||||
* @Date: 2021-12-03 11:10:14
|
||||
* @LastEditTime: 2022-01-06 15:01:57
|
||||
* @LastEditTime: 2022-01-06 16:19:21
|
||||
* @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
|
||||
@ -32,6 +32,7 @@ import { SupplyManagementBulkDetailComponent } from './components/bulk-detail/bu
|
||||
import { SupplyManagementReleasePublishComponent } from './components/release-publish/release-publish.component';
|
||||
import { SupplyManagementBulkReleasePublishComponent } from './components/bulk-release-publish/bulk-release-publish.component';
|
||||
import { TranAgreementComponent } from './components/tran-agreement/tran-agreement.component';
|
||||
import { SupplyManagementBulkAssignedCarComponent } from './components/assigned-car-bulk/assigned-car-bulk.component';
|
||||
|
||||
|
||||
const COMPONENTS: Type<void>[] = [
|
||||
@ -57,7 +58,8 @@ const COMPONENTS: Type<void>[] = [
|
||||
SupplyManagementBulkDetailComponent,
|
||||
SupplyManagementReleasePublishComponent,
|
||||
SupplyManagementBulkReleasePublishComponent,
|
||||
TranAgreementComponent
|
||||
TranAgreementComponent,
|
||||
SupplyManagementBulkAssignedCarComponent
|
||||
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user