车辆对接
This commit is contained in:
@ -2,7 +2,7 @@ import { ViewChild } from '@angular/core';
|
||||
/*
|
||||
* @Author: your name
|
||||
* @Date: 2021-12-03 15:31:52
|
||||
* @LastEditTime: 2021-12-23 16:34:02
|
||||
* @LastEditTime: 2021-12-24 13:15:50
|
||||
* @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\order-management\components\vehicle-detail\vehicle-detail.component.ts
|
||||
@ -11,13 +11,14 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { STColumn, STComponent } from '@delon/abc/st';
|
||||
import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
|
||||
import { SFComponent, SFSchema, SFSelectWidgetSchema, SFUISchema, SFUploadWidgetSchema } from '@delon/form';
|
||||
import { _HttpClient } from '@delon/theme';
|
||||
import { AmapPoiPickerComponent, AmapService, ShipperBaseService } from '@shared';
|
||||
import { AmapPoiPickerComponent, AmapService, EAEnvironmentService, ShipperBaseService } from '@shared';
|
||||
import { NzMessageService } from 'ng-zorro-antd/message';
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { NzUploadChangeParam, NzUploadFile } from 'ng-zorro-antd/upload';
|
||||
import { Observable, Observer } from 'rxjs';
|
||||
import { apiConf } from '@conf/api.conf';
|
||||
import { OrderManagementService } from '../../services/order-management.service';
|
||||
function getBase64(file: File): Promise<string | ArrayBuffer | null> {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -49,12 +50,9 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
dirverPhone: any; // 货源单设置回显
|
||||
dirverBankCard: any; // 货源单设置回显
|
||||
listImagUrls: any[] = []; // 货源单设置回显
|
||||
listImagUrls2: any[] = []; // 货源单设置回显
|
||||
imges: any;
|
||||
previewImage1 = '';
|
||||
previewVisible1 = false;
|
||||
previewImage2 = '';
|
||||
previewVisible2 = false;
|
||||
@ViewChild('sf3', { static: false }) sf3!: SFComponent;
|
||||
schema3: SFSchema = {};
|
||||
ui3!: SFUISchema;
|
||||
@ -63,6 +61,10 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
schema4: SFSchema = {};
|
||||
isVisible = false;
|
||||
ui4!: SFUISchema;
|
||||
formData: any;
|
||||
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
||||
schema: SFSchema = {};
|
||||
ui: SFUISchema = {};
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private msgSrv: NzMessageService,
|
||||
@ -71,6 +73,7 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
private amapService: AmapService,
|
||||
public service2: ShipperBaseService,
|
||||
fb: FormBuilder,
|
||||
private envSrv: EAEnvironmentService,
|
||||
) {
|
||||
this.validateForm1 = fb.group({
|
||||
loadingTime: [null, []],
|
||||
@ -81,11 +84,207 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
ngOnInit(): void {
|
||||
console.log(this.id)
|
||||
this.initST();
|
||||
this.initSF();
|
||||
this.initSF3();
|
||||
this.initSF4();
|
||||
this.initData()
|
||||
}
|
||||
|
||||
initSF() {
|
||||
this.schema = {
|
||||
properties: {
|
||||
imgUrl3: {
|
||||
type: 'string',
|
||||
title: '装货凭证',
|
||||
readOnly: true,
|
||||
ui: {
|
||||
widget: 'upload',
|
||||
action: apiConf.fileUpload,
|
||||
fileType: 'image/png,image/jpeg,image/jpg,image/gif',
|
||||
limit: 1,
|
||||
limitFileCount: 1,
|
||||
resReName: 'data.fullFileWatermarkPath',
|
||||
urlReName: 'data.fullFileWatermarkPath',
|
||||
descriptionI18n: '提货单',
|
||||
data: {
|
||||
appId: this.envSrv.env.appId,
|
||||
},
|
||||
name: 'multipartFile',
|
||||
beforeUpload: (file: any, fileList: any) => {
|
||||
return new Observable((observer: Observer<boolean>) => {
|
||||
const isLt1M = file.size / 1024 / 1024 < 5;
|
||||
const fileType = 'image/png,image/jpeg';
|
||||
if (fileType.indexOf(file.type) === -1) {
|
||||
this.service.msgSrv.warning('图片格式不正确!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
if (!isLt1M) {
|
||||
this.service.msgSrv.warning('图片大小超过5M!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
observer.next(isLt1M);
|
||||
observer.complete();
|
||||
});
|
||||
},
|
||||
multiple: false,
|
||||
listType: 'picture-card',
|
||||
} as SFUploadWidgetSchema,
|
||||
},
|
||||
imgUrl4: {
|
||||
type: 'string',
|
||||
title: '',
|
||||
readOnly: true,
|
||||
ui: {
|
||||
widget: 'upload',
|
||||
action: apiConf.fileUpload,
|
||||
fileType: 'image/png,image/jpeg,image/jpg,image/gif',
|
||||
limit: 1,
|
||||
limitFileCount: 1,
|
||||
resReName: 'data.fullFileWatermarkPath',
|
||||
urlReName: 'data.fullFileWatermarkPath',
|
||||
descriptionI18n: '人车货照片',
|
||||
data: {
|
||||
appId: this.envSrv.env.appId,
|
||||
},
|
||||
name: 'multipartFile',
|
||||
beforeUpload: (file: any, fileList: any) => {
|
||||
return new Observable((observer: Observer<boolean>) => {
|
||||
const isLt1M = file.size / 1024 / 1024 < 5;
|
||||
const fileType = 'image/png,image/jpeg';
|
||||
if (fileType.indexOf(file.type) === -1) {
|
||||
this.service.msgSrv.warning('图片格式不正确!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
if (!isLt1M) {
|
||||
this.service.msgSrv.warning('图片大小超过5M!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
observer.next(isLt1M);
|
||||
observer.complete();
|
||||
});
|
||||
},
|
||||
multiple: false,
|
||||
listType: 'picture-card',
|
||||
} as SFUploadWidgetSchema,
|
||||
},
|
||||
no4: {
|
||||
type: 'string',
|
||||
title: '',
|
||||
ui: {
|
||||
widget: 'text',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
imgUrl1: {
|
||||
type: 'string',
|
||||
title: '卸货凭证',
|
||||
ui: {
|
||||
widget: 'upload',
|
||||
action: apiConf.fileUpload,
|
||||
fileType: 'image/png,image/jpeg,image/jpg,image/gif',
|
||||
limit: 1,
|
||||
limitFileCount: 1,
|
||||
resReName: 'data.fullFileWatermarkPath',
|
||||
urlReName: 'data.fullFileWatermarkPath',
|
||||
descriptionI18n: '提货单',
|
||||
data: {
|
||||
appId: this.envSrv.env.appId,
|
||||
},
|
||||
name: 'multipartFile',
|
||||
beforeUpload: (file: any, fileList: any) => {
|
||||
return new Observable((observer: Observer<boolean>) => {
|
||||
const isLt1M = file.size / 1024 / 1024 < 5;
|
||||
const fileType = 'image/png,image/jpeg';
|
||||
if (fileType.indexOf(file.type) === -1) {
|
||||
this.service.msgSrv.warning('图片格式不正确!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
if (!isLt1M) {
|
||||
this.service.msgSrv.warning('图片大小超过5M!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
observer.next(isLt1M);
|
||||
observer.complete();
|
||||
});
|
||||
},
|
||||
multiple: false,
|
||||
listType: 'picture-card',
|
||||
} as SFUploadWidgetSchema,
|
||||
},
|
||||
imgUrl2: {
|
||||
type: 'string',
|
||||
title: '',
|
||||
ui: {
|
||||
widget: 'upload',
|
||||
action: apiConf.fileUpload,
|
||||
fileType: 'image/png,image/jpeg,image/jpg,image/gif',
|
||||
limit: 1,
|
||||
limitFileCount: 1,
|
||||
resReName: 'data.fullFileWatermarkPath',
|
||||
urlReName: 'data.fullFileWatermarkPath',
|
||||
descriptionI18n: '人车货照片',
|
||||
data: {
|
||||
appId: this.envSrv.env.appId,
|
||||
},
|
||||
name: 'multipartFile',
|
||||
beforeUpload: (file: any, fileList: any) => {
|
||||
return new Observable((observer: Observer<boolean>) => {
|
||||
const isLt1M = file.size / 1024 / 1024 < 5;
|
||||
const fileType = 'image/png,image/jpeg';
|
||||
if (fileType.indexOf(file.type) === -1) {
|
||||
this.service.msgSrv.warning('图片格式不正确!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
if (!isLt1M) {
|
||||
this.service.msgSrv.warning('图片大小超过5M!');
|
||||
observer.complete();
|
||||
return;
|
||||
}
|
||||
observer.next(isLt1M);
|
||||
observer.complete();
|
||||
});
|
||||
},
|
||||
multiple: false,
|
||||
listType: 'picture-card',
|
||||
} as SFUploadWidgetSchema,
|
||||
},
|
||||
no5: {
|
||||
type: 'string',
|
||||
title: '',
|
||||
ui: {
|
||||
widget: 'text',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
no6: {
|
||||
type: 'string',
|
||||
title: '',
|
||||
ui: {
|
||||
widget: 'text',
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
required: ['imgUrl3','imgUrl1']
|
||||
};
|
||||
this.ui = {
|
||||
'*': {
|
||||
spanLabelFixed: 100,
|
||||
grid: { span: 20 }
|
||||
},
|
||||
$imgUrl1: { grid: { span: 12} },
|
||||
$imgUrl2: { grid: { span: 12} },
|
||||
$imgUrl3: { grid: { span: 12} },
|
||||
$imgUrl4: { grid: { span: 12} },
|
||||
$no5: { grid: { span: 24} },
|
||||
};
|
||||
}
|
||||
initData() {
|
||||
this.service.request(this.service.$api_get_getWholeBillDetail, {id: this.id}).subscribe(res => {
|
||||
console.log(res)
|
||||
@ -93,7 +292,7 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
this.i = res;
|
||||
// 对装货凭证进行初始化
|
||||
let arr : any= []
|
||||
res.filePathList.forEach((element: any, index: any) => {
|
||||
res?.receiptFilePath.forEach((element: any, index: any) => {
|
||||
console.log(index)
|
||||
arr.push( {
|
||||
url: element,
|
||||
@ -102,15 +301,6 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
})
|
||||
});
|
||||
this.listImagUrls = arr;
|
||||
let arr2 : any= []
|
||||
res.filePathList.forEach((element: any, index: any) => {
|
||||
arr2.push( {
|
||||
url: element,
|
||||
status: 'done',
|
||||
uid: index
|
||||
})
|
||||
});
|
||||
this.listImagUrls2 = arr2;
|
||||
|
||||
// 对装卸货信息进行初始化
|
||||
res?.unLoadingPlaceList.forEach((element: any) => {
|
||||
@ -150,6 +340,33 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
this.validateForm1.addControl(`unloadPhone${controlId}`, new FormControl(null, Validators.required));
|
||||
}
|
||||
});
|
||||
// 对装货凭证进行初始化
|
||||
if (res.imgUrl1) {
|
||||
this.formData = {
|
||||
imgUrl3: [
|
||||
{
|
||||
uid: 'logo',
|
||||
name: 'LOGO',
|
||||
status: 'done',
|
||||
url: res.imgUrl1,
|
||||
response: {
|
||||
url: res.imgUrl1,
|
||||
},
|
||||
},
|
||||
],
|
||||
imgUrl4: [
|
||||
{
|
||||
uid: 'logo',
|
||||
name: 'LOGO',
|
||||
status: 'done',
|
||||
url: res.imgUrl2,
|
||||
response: {
|
||||
url: res.imgUrl2,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -171,24 +388,17 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
}
|
||||
// 保存修改
|
||||
save() {
|
||||
console.log(this.sf.value)
|
||||
let imgList : any= [];
|
||||
if(this.listImagUrls.length > 0) {
|
||||
this.listImagUrls.forEach((res :any) => {
|
||||
this.listImagUrls?.forEach((res :any) => {
|
||||
if(res.url) {
|
||||
imgList.push(res.url)
|
||||
}
|
||||
})
|
||||
}
|
||||
console.log(imgList)
|
||||
let imgList2 : any= [];
|
||||
if(this.listImagUrls2.length > 0) {
|
||||
this.listImagUrls2.forEach((res :any) => {
|
||||
if(res.url) {
|
||||
imgList2.push(res.url)
|
||||
}
|
||||
})
|
||||
}
|
||||
console.log(imgList2)
|
||||
|
||||
if(typeof(this.validateForm1.value.unloadingTime) !== 'string' ) {
|
||||
var c = new Date(this.validateForm1.value.unloadingTime);
|
||||
this.validateForm1.value.unloadingTime = c.getFullYear() + '-' + this.addPreZero(c.getMonth() + 1) + '-' + this.addPreZero(c.getDate()) + ' ' + this.addPreZero(c.getHours()) + ':' + this.addPreZero(c.getMinutes()) + ':' + this.addPreZero(c.getSeconds())
|
||||
@ -197,6 +407,42 @@ export class OrderManagementVehicleDetailChangeComponent implements OnInit {
|
||||
var c = new Date(this.validateForm1.value.loadingTime);
|
||||
this.validateForm1.value.loadingTime = c.getFullYear() + '-' + this.addPreZero(c.getMonth() + 1) + '-' + this.addPreZero(c.getDate()) + ' ' + this.addPreZero(c.getHours()) + ':' + this.addPreZero(c.getMinutes()) + ':' + this.addPreZero(c.getSeconds())
|
||||
}
|
||||
console.log(this.sf3.value)
|
||||
console.log(this.sf4.value)
|
||||
const params = {
|
||||
id: this.id,
|
||||
unLoadingPlaceList: [...this.startInfo, ...this.endInfo,],
|
||||
goodsResource: [{
|
||||
id: '',
|
||||
enterpriseInfoId: 'xxx',
|
||||
|
||||
}],
|
||||
receiptFilePath: imgList,
|
||||
goodsInfoList: [{
|
||||
id: '',
|
||||
goodsName: 'xxx',
|
||||
weight: '',
|
||||
volume: '',
|
||||
number: '',
|
||||
}],
|
||||
// 运费信息
|
||||
expenseList: this.i?.i?.billExpenseDetails,
|
||||
// 收款人
|
||||
payeeId: '',
|
||||
银行卡: '',
|
||||
// 发车时间
|
||||
loadPlanTime: '',
|
||||
// 到车时间
|
||||
unloadPlanTime: '',
|
||||
loadingLadingBillFilePath: '',
|
||||
loadingPeopleVehiclesGoodsFilePath: '',
|
||||
unloadingLadingBillFilePath: '',
|
||||
unloadingPeopleVehiclesGoodsFilePath: '',
|
||||
}
|
||||
console.log(params)
|
||||
// this.service.request(this.service.$api_set_getWholeOrderDetail, params).subscribe((res: any) => {
|
||||
// console.log(res)
|
||||
// })
|
||||
}
|
||||
addPreZero(num: any){
|
||||
if(num<10){
|
||||
@ -496,13 +742,7 @@ handlePreview1 = async (file: NzUploadFile) => {
|
||||
this.previewImage1 = file.url || file.preview;
|
||||
this.previewVisible1 = true;
|
||||
};
|
||||
handlePreview2 = async (file: NzUploadFile) => {
|
||||
if (!file.url && !file.preview) {
|
||||
file.preview = await getBase64(file.originFileObj!);
|
||||
}
|
||||
this.previewImage2 = file.url || file.preview;
|
||||
this.previewVisible2 = true;
|
||||
};
|
||||
|
||||
handleChange1(info: NzUploadChangeParam): void {
|
||||
switch (info.file.status) {
|
||||
case 'uploading':
|
||||
|
||||
Reference in New Issue
Block a user