This commit is contained in:
wangshiming
2022-03-04 13:34:13 +08:00
parent 3b884de222
commit a98a0592ea
5 changed files with 233 additions and 280 deletions

View File

@ -4,7 +4,7 @@
* @Author : Shiming
* @Date : 2021-12-24 16:58:02
* @LastEditors : Shiming
* @LastEditTime : 2022-02-28 12:01:57
* @LastEditTime : 2022-03-04 13:26:50
* @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\components\\bulk-detail-change\\bulk-detail-change.component.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
@ -438,7 +438,13 @@ loadTime: any; // 货源单设置回显
this.loadTime = res.loadTime
this.unloadTime = res.unloadTime
this.dirvingMessage = res.billExpenseDetails;
// 计算里程,时间
if (this.startInfo[0]?.area && this.endInfo[0]?.area) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
});
}
}
})
}
@ -516,6 +522,7 @@ loadTime: any; // 货源单设置回显
// -------------------装卸货信息处理
// 打开地图
// 打开地图
// 打开地图
openMap(type: string, index: number) {
const modalRef = this.modalService.create({
nzTitle: '',
@ -523,30 +530,32 @@ loadTime: any; // 货源单设置回显
nzWidth: 900,
nzOnOk: item => {
const poi = item.poi;
const locList = poi.pois;
const locList = poi.location.toString().split(',');
switch (type) {
case 'start':
this.startInfo[index].detailedAddress = poi.formattedAddress;
this.startInfo[index].detailedAddress = poi.district + poi.name;
this.startInfo[index].longitude = locList[0];
this.startInfo[index].latitude = locList[1];
this.startInfo[index].province = poi.addressComponent.province;
this.startInfo[index].city = poi.addressComponent.city;
this.startInfo[index].area = poi.addressComponent.district;
this.startInfo[index].province = poi.cityInfo.province;
this.startInfo[index].city = poi.cityInfo.city;
this.startInfo[index].area = poi.cityInfo.district;
this.startInfo[index].address = poi.name;
break;
case 'end':
this.endInfo[index].detailedAddress = poi.formattedAddress;
this.endInfo[index].detailedAddress = poi.district + poi.name;
this.endInfo[index].longitude = locList[0];
this.endInfo[index].latitude = locList[1];
this.endInfo[index].province = poi.addressComponent.province;
this.endInfo[index].city = poi.addressComponent.city;
this.endInfo[index].area = poi.addressComponent.district;
this.endInfo[index].province = poi.cityInfo.province;
this.endInfo[index].city = poi.cityInfo.city;
this.endInfo[index].area = poi.cityInfo.district;
this.endInfo[index].address = poi.name;
break;
default:
break;
}
if (this.startInfo[0]?.area && this.endInfo[0]?.area) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe((res: any) => {
this.totalDistance = res.distance;
this.totalTime = res.time;
});
@ -554,7 +563,6 @@ loadTime: any; // 货源单设置回显
}
});
}
initSF3() {
this.schema3 = {
properties: {
@ -631,94 +639,6 @@ loadTime: any; // 货源单设置回显
}
};
}
initSF4() {
this.schema4 = {
properties: {
weight: {
type: 'string',
title: '货物数量',
ui: {
widget: 'custom',
placeholder: '请输入',
errors: { required: '必填项' }
}
},
volume: {
type: 'string',
title: '',
ui: {
widget: 'custom',
placeholder: '请输入'
}
},
number: {
type: 'string',
title: '',
ui: {
widget: 'custom',
placeholder: '请输入'
}
},
carModel: {
type: 'string',
title: '车型/车长',
ui: {
widget: 'select',
mode: 'multiple',
maxMultipleCount:3,
placeholder: '请选择车型',
errors: { required: '请选择车型' },
asyncData: () => this.service.getDictOptions({ dictKey: 'car:model' }),
change:(tag:any , org:any)=>{
if(tag.includes("999")){
this.sf4.setValue('/carModel',["999"]);
}
}
}
},
carLength: {
type: 'string',
title: '',
ui: {
widget: 'select',
mode: 'multiple',
maxMultipleCount:3,
placeholder: '请选择车长',
errors: { required: '请选择车长' },
asyncData: () => this.service.getDictOptions({ dictKey: 'car:length' }),
change:(tag:any , org:any)=>{
if(tag.includes("999")){
this.sf4.setValue('/carModel',["999"]);
}
}
}
},
},
required: ['weight', 'carModel', 'carLength']
};
this.ui4 = {
'*': {
spanLabelFixed: 90,
grid: { span: 24 }
},
$weight: {
grid: { lg: 8, md: 12, sm: 12, xs: 24 }
},
$volume: {
grid: { lg: 8, md: 12, sm: 12, xs: 24 }
},
$number: {
grid: { lg: 8, md: 12, sm: 12, xs: 24 }
},
$carModel: {
spanLabelFixed: 100,
grid: { span: 8 }
},
$carLength: {
grid: { span: 8 }
}
};
}
changeGoodsType(value: string, data: any) {
if (data.label === '其它') return;
const params = {
@ -745,165 +665,143 @@ changeGoodsType(value: string, data: any) {
}
});
}
// initSF4() {
// this.schema4 = {
// properties: {
// weight: {
// type: 'string',
// title: '货物数量',
// ui: {
// widget: 'custom',
// placeholder: '请输入',
// errors: { required: '必填项' }
// }
// },
// volume: {
// type: 'string',
// title: '',
// ui: {
// widget: 'custom',
// placeholder: '请输入'
// }
// },
// number: {
// type: 'string',
// title: '',
// ui: {
// widget: 'custom',
// placeholder: '请输入'
// }
// },
// carmand: {
// type: 'string',
// title: '用车需求',
// ui: {
// widget: 'custom',
// placeholder: '请输入'
// }
// },
// drivers: {
// type: 'string',
// title: '承运司机',
// ui: {
// widget: 'custom',
// placeholder: '请输入'
// }
// },
// weightModel: {
// type: 'string',
// title: '车型车长承重',
// ui: {
// widget: 'custom',
// placeholder: '请输入'
// }
// },
// loadTime: {
// type: 'string',
// title: '发车时间',
// ui: {
// widget: 'custom',
// placeholder: '请输入'
// }
// },
// unloadTime: {
// type: 'string',
// title: '到车时间',
// ui: {
// widget: 'custom',
// placeholder: '请输入'
// }
// },
// acceptWeight: {
// type: 'number',
// title: '装货重量',
// minimum:0,
// maximum:99999,
// ui: {
// unit: '吨',
// placeholder: '请输入',
// grid: {
// span: 12
// },
// hideStep: true,
// } as SFNumberWidgetSchema
// },
// acceptVolume: {
// type: 'number',
// title: '装货体积',
// minimum:0,
// maximum:99999,
// ui: {
// unit: '吨',
// placeholder: '请输入',
// grid: {
// span: 12
// },
// hideStep: true,
// } as SFNumberWidgetSchema
// },
// settlementWeight: {
// type: 'number',
// title: '卸货重量',
// minimum:0,
// maximum:99999,
// ui: {
// unit: '吨',
// placeholder: '请输入',
// grid: {
// span: 12
// },
// hideStep: true,
// } as SFNumberWidgetSchema
// },
// settlementVolume: {
// type: 'number',
// title: '卸货体积',
// minimum:0,
// maximum:99999,
// ui: {
// unit: '吨',
// placeholder: '请输入',
// grid: {
// span: 12
// },
// hideStep: true,
// } as SFNumberWidgetSchema
// }
// },
// required: ['weight','loadTime','unloadTime']
// };
// this.ui4 = {
// '*': {
// spanLabelFixed: 90,
// grid: { span: 24 }
// },
// $weight: {
// grid: { span: 8 }
// },
// $volume: {
// grid: { span: 8 }
// },
// $number: {
// grid: { span: 8 }
// },
// $carmand: {
// grid: { span: 24 }
// },
// $weightModel: {
// spanLabelFixed: 120,
// grid: { span: 12 }
// },
// $drivers: {
// grid: { span: 12 }
// },
// $loadTime: {
// grid: { span: 12 }
// },
// $unloadTime: {
// grid: { span: 12 }
// },
// };
// }
initSF4() {
this.schema4 = {
properties: {
weight: {
type: 'string',
title: '货物数量',
ui: {
widget: 'custom',
placeholder: '请输入',
errors: { required: '必填项' }
}
},
carmand: {
type: 'string',
title: '用车需求',
ui: {
widget: 'custom',
placeholder: '请输入'
}
},
drivers: {
type: 'string',
title: '承运司机',
ui: {
widget: 'custom',
placeholder: '请输入'
}
},
weightModel: {
type: 'string',
title: '车型车长承重',
ui: {
widget: 'custom',
placeholder: '请输入'
}
},
loadTime: {
type: 'string',
title: '发车时间',
ui: {
widget: 'custom',
placeholder: '请输入'
}
},
unloadTime: {
type: 'string',
title: '到车时间',
ui: {
widget: 'custom',
placeholder: '请输入'
}
},
acceptWeight: {
type: 'number',
title: '装货重量',
minimum:0,
maximum:99999,
ui: {
unit: '吨',
placeholder: '请输入',
grid: {
span: 12
},
hideStep: true,
} as SFNumberWidgetSchema
},
acceptVolume: {
type: 'number',
title: '装货体积',
minimum:0,
maximum:99999,
ui: {
unit: '吨',
placeholder: '请输入',
grid: {
span: 12
},
hideStep: true,
} as SFNumberWidgetSchema
},
settlementWeight: {
type: 'number',
title: '卸货重量',
minimum:0,
maximum:99999,
ui: {
unit: '吨',
placeholder: '请输入',
grid: {
span: 12
},
hideStep: true,
} as SFNumberWidgetSchema
},
settlementVolume: {
type: 'number',
title: '卸货体积',
minimum:0,
maximum:99999,
ui: {
unit: '吨',
placeholder: '请输入',
grid: {
span: 12
},
hideStep: true,
} as SFNumberWidgetSchema
}
},
required: ['loadTime','unloadTime']
};
this.ui4 = {
'*': {
spanLabelFixed: 90,
grid: { span: 24 }
},
$weight: {
grid: { span: 24 }
},
$carmand: {
grid: { span: 24 }
},
$weightModel: {
spanLabelFixed: 120,
grid: { span: 12 }
},
$drivers: {
grid: { span: 12 }
},
$loadTime: {
grid: { span: 12 }
},
$unloadTime: {
grid: { span: 12 }
},
};
}
// 处理上传图片
handlePreview1 = async (file: NzUploadFile) => {
if (!file.url && !file.preview) {
@ -970,4 +868,25 @@ goDistance(elf: NzCardComponent) {
elf['elementRef'].nativeElement.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'start' });
}
}
// 装卸货地址互换
swapAddress() {
let item = this.startInfo;
this.startInfo = this.endInfo;
this.endInfo = item;
this.startInfo.forEach((element: any) => {
element.type = '1';
});
this.endInfo.forEach((element: any) => {
element.type = '2';
});
// 计算里程,时间
if (this.startInfo[0]?.area && this.endInfo[0]?.area) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
});
}
}
}