This commit is contained in:
wangshiming
2021-12-09 19:21:22 +08:00
parent d4a4b45194
commit b513099359
11 changed files with 177 additions and 160 deletions

View File

@ -30,6 +30,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
sf7data: any; // 货源单设置回显
creatTime: any; // 货源单设置回显
modifyTime: any; // 货源单设置回显
totalFees: any; // 总数信息
id = this.route.snapshot.params.id;
// // 单位
unit1 = '吨';
@ -44,7 +45,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
modifyTime: [null, []],
});
}
@ViewChild('sf1', { static: false }) sf1!: SFComponent;
schema1: SFSchema = {};
ui1!: SFUISchema;
@ -81,25 +81,26 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.initSF6();
this.initSF7();
this.initdata();
console.log( this.route.snapshot?.queryParams)
}
initSF1() {
this.schema1 = {
properties: {
shipperAppUserNmae: {
type: 'string',
title: '货主',
maxLength: 30,
ui: {
placeholder: '请输入'
}
},
// shipperAppUserName: {
// type: 'string',
// title: '货主',
// maxLength: 30,
// ui: {
// placeholder: '请输入'
// }
// },
enterpriseProjectName: {
type: 'string',
title: '项目',
enum: [
{ label: '1', value: '1' },
{ label: '2', value: '2' }
{ label: '项目1', value: '1' },
{ label: '项目2', value: '2' }
],
ui: {
widget: 'select',
@ -131,12 +132,12 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
placeholder: '请输入'
}
},
dispatchName2: {
dispatchId: {
type: 'string',
title: '调度员',
enum: [
{ label: '1', value: '1' },
{ label: '2', value: '2' }
{ label: '调度员1', value: '1' },
{ label: '调度员2', value: '2' }
],
ui: {
widget: 'select',
@ -190,8 +191,9 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
type: 'string',
title: '货物名称',
enum: [
{ label: '1', value: '1' },
{ label: '2', value: '2' }
{ label: '真实货物', value: '1' },
{ label: '远程货物', value: '2' },
{ label: '其他', value: '3' }
],
ui: {
widget: 'select',
@ -207,12 +209,12 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
// change: (i) => this.updateCategory(i, '/categoryId2'),
} as SFSelectWidgetSchema
},
name2: {
qita: {
type: 'string',
title: '',
ui: {
visibleIf: {
name1: value => value === '1'
goodsNameId: value => value === '3'
}
}
}
@ -223,10 +225,10 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
spanLabelFixed: 90,
grid: { span: 12 }
},
$name1: {
$goodsNameId: {
grid: { span: 12 }
},
$name2: {
$qita: {
grid: { span: 12 }
}
};
@ -377,14 +379,24 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
};
}
changeValue() {
this.totalFees = this.sf7?.value?.appendFee + this.sf7?.value?.oilCardPay + this.sf7?.value?.prePay +this.sf7?.value?.receiptPay + this.sf7?.value?.toPay
}
initSF7() {
this.schema7 = {
properties: {
prePay: { type: 'number', title: '预付', default: 0, ui: { prefix: '¥' } as SFNumberWidgetSchema },
toPay: { type: 'number', title: '到付', default: 0, ui: { prefix: '¥' } as SFNumberWidgetSchema },
oilCardPay: { type: 'number', title: '油卡', default: 0, ui: { prefix: '¥' } as SFNumberWidgetSchema },
receiptPay: { type: 'number', title: '回单付', default: 0, ui: { prefix: '¥' } as SFNumberWidgetSchema },
prePay: { type: 'number', title: '预付', default: 0, ui: { prefix: '¥', change: ()=> {
this.changeValue();
} } as SFNumberWidgetSchema },
toPay: { type: 'number', title: '付', default: 0, ui: { prefix: '¥',change: ()=> {
this.changeValue();
} } as SFNumberWidgetSchema },
oilCardPay: { type: 'number', title: '油卡', default: 0, ui: { prefix: '¥',change: ()=> {
this.changeValue();
} } as SFNumberWidgetSchema },
receiptPay: { type: 'number', title: '回单付', default: 0, ui: { prefix: '¥',change: ()=> {
this.changeValue();
} } as SFNumberWidgetSchema },
oilCardPay2: {
type: 'string',
title: '小计',
@ -431,7 +443,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.startInfo.push({
detailedAddress: '',
appUserName: '',
contractTelephone: ''
contractTelephone: '',
type: 1
});
}
subStartInfo(event: any, index: number) {
@ -442,7 +455,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.endInfo.push({
detailedAddress: '',
appUserName: '',
contractTelephone: ''
contractTelephone: '',
type: 2
});
}
subEndInfo(event: any, index: number) {
@ -463,13 +477,34 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.validateForm1.controls[key].updateValueAndValidity();
});
console.log(this.validateForm1);
var d = new Date(this.validateForm1.value.createTime);
console.log(d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds())
if(typeof(this.validateForm1.value.modifyTime) !== 'string' ) {
var c = new Date(this.validateForm1.value.modifyTime);
this.validateForm1.value.modifyTime = c.getFullYear() + '-' + (c.getMonth() + 1) + '-' + c.getDate() + ' ' + c.getHours() + ':' + c.getMinutes() + ':' + c.getSeconds()
}
if(typeof(this.validateForm1.value.createTime) !== 'string' ) {
var c = new Date(this.validateForm1.value.createTime);
this.validateForm1.value.createTime = c.getFullYear() + '-' + (c.getMonth() + 1) + '-' + c.getDate() + ' ' + c.getHours() + ':' + c.getMinutes() + ':' + c.getSeconds()
}
console.log(typeof(this.validateForm1.value.createTime) === 'string')
if (this.validateForm1.invalid) {
return;
}
console.log(this.sf1.value)
console.log({...this.sf4.value, ...this.sf3.value})
this.startInfo.createTime = this.validateForm1.value.createTime
this.startInfo.modifyTime = this.validateForm1.value.modifyTime
const params = {
...this.sf1.value,
...this.sf5.value,
shippingInformationDTO: {
...this.sf7.value
},
unLoadingPlaceList: [...this.startInfo, ...this.endInfo,],
goodsInfoList: [
{...this.sf4.value, ...this.sf3.value}
]
}
console.log(params)
console.log(this.startInfo)
console.log(this.endInfo)
console.log(this.validateForm1.value)
@ -478,22 +513,35 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
console.log(this.sf5.value)
console.log(this.sf6.value)
console.log(this.sf7.value)
// const data = this.form.value;
// this.http.post('/register', data).subscribe(() => {
// this.router.navigateByUrl('/passport/register-result', {
// // queryParams: { email: data.mail },
// });
// });
// this.router.navigateByUrl('/passport/register-result', {
// // queryParams: { email: data.mail },
// });
this.service.request(this.service.$api_set_saveAnotherWholeOrder, params).subscribe((res: any) => {
console.log(res)
})
}
openMap() {
this.modalService.create({
openMap(type: string, index: number) {
const modalRef = this.modalService.create({
nzTitle: '',
nzContent: AmapPoiPickerComponent,
nzWidth: 848
nzWidth: 900,
nzOnOk: item => {
const poi = item.poi;
console.log(item)
const locList = poi.location.toString().split(',');
switch (type) {
case 'start':
this.startInfo[index].detailedAddress = poi.district + poi.name;
this.startInfo[index].longitude = locList[0];
this.startInfo[index].latitude = locList[1];
break;
case 'end':
this.endInfo[index].detailedAddress = poi.district + poi.name;
this.endInfo[index].longitude = locList[0];
this.endInfo[index].latitude = locList[1];
break;
default:
break;
}
}
});
}
goBack() {
@ -502,12 +550,11 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
// 初始化信息
initdata() {
console.log(this.id)
// this.service.request(`${this.service.$api_get_getCompleteVehicleDetail}`, {id:this.id}).subscribe((res) => {
this.service.request(`${this.service.$api_get_getBulkDetail}`, {id:this.id}).subscribe((res) => {
this.service.request(`${this.service.$api_get_getCompleteVehicleDetail}`, {id:this.id}).subscribe((res) => {
console.log(res)
// this.dataList = res;
this.sf1data = {
shipperAppUserNmae: res?.shipperAppUserNmae || '',
// shipperAppUserName: res?.shipperAppUserName || '',
enterpriseProjectName: res?.enterpriseProjectName || '',
enterpriseInfoName: res?.enterpriseInfoName || '',
externalResourceCode: res?.externalResourceCode || '',
@ -515,43 +562,52 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
res.unLoadingPlaceList.forEach((element: any) => {
if(element.type === 1) {
this.startInfo.push({
detailedAddress: element.detailedAddress,
appUserName: element.appUserName,
contractTelephone: element.contractTelephone,
})
console.log(element)
if(this.id) {
this.startInfo.push({
detailedAddress: element.detailedAddress,
appUserName: element.appUserName,
contractTelephone: element.contractTelephone,
type: element.type
})
} else {
this.startInfo.push({
detailedAddress: element.detailedAddress,
appUserName: element.appUserName,
contractTelephone: element.contractTelephone,
type: element.type,
id: element.id
})
}
if(element.createTime) {
this.creatTime = element.createTime
this.creatTime = element.modifyTime
this.creatTime = element?.createTime
this.modifyTime = element?.modifyTime
}
} else if(element.type === 2) {
this.endInfo.push({
detailedAddress: element.detailedAddress,
appUserName: element.appUserName,
contractTelephone: element.contractTelephone,
detailedAddress: element?.detailedAddress,
appUserName: element?.appUserName,
contractTelephone: element?.contractTelephone,
type: element.type
})
}
});
this.sf3data = {
goodsNameId: res?.goodsInfoList.goodsNameId || '',
weight: res?.goodsInfoList.weight || '',
volume: res?.goodsInfoList.volume || '',
externalResourceCode: res?.goodsInfoList.goodsNameId || '',
goodsNameId: res?.goodsInfoList[0]?.goodsNameId || '',
}
this.sf4data = {
goodsNameId: res?.goodsInfoList.goodsNameId || '',
weight: res?.goodsInfoList.weight || '',
volume: res?.goodsInfoList.volume || '',
externalResourceCode: res?.goodsInfoList.goodsNameId || '',
weight: res?.goodsInfoList[0]?.weight || '',
volume: res?.goodsInfoList[0]?.volume || '',
vehicleDemand: res?.goodsInfoList[0]?.vehicleDemand || '',
}
this.sf5data = {
goodsValue: res?.goodsValue || '',
}
this.sf6data = {
stateReceipt: res?.supplementaryInformationVO.stateReceipt || '',
remarks: res?.supplementaryInformationVO.remarks || '',
stateReceipt: res?.supplementaryInformationVO?.stateReceipt || '',
remarks: res?.supplementaryInformationVO?.remarks || '',
}
console.log('99999')
console.log(res?.shippingInformationVO)
this.sf7data = {
prePay: res?.shippingInformationVO?.prePay || '',
toPay: res?.shippingInformationVO?.toPay || '',
@ -559,9 +615,9 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
receiptPay: res?.shippingInformationVO?.receiptPay || '',
oilCardPay2: res?.shippingInformationVO?.oilCardPay || '',
appendFee: res?.shippingInformationVO?.appendFee || '',
totalFee: res?.shippingInformationVO?.totalFee || '',
name8: res?.shippingInformationVO?.appendFee || '',
}
this.totalFees = res?.shippingInformationVO?.totalFee || '0';
// <p>预付:{{dataList?.shippingInformationVO?.prePay | currency: '¥' }}</p>
// <p>油卡:{{dataList?.shippingInformationVO?.oilCardPay | currency: '¥'}}</p>
// <p>到付:{{dataList?.shippingInformationVO?.toPay | currency: '¥'}}</p>
@ -579,4 +635,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
})
}
asds(i: any) {
console.log(i)
}
// const data =
}