This commit is contained in:
潘晓云
2022-04-12 19:45:37 +08:00
parent 1a5a6473c7
commit 9422e97eb6
4 changed files with 126 additions and 92 deletions

View File

@ -271,6 +271,9 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
errors: { required: '请填写货物名称' },
visibleIf: {
goodsTypeName: (value: any) => value && value === '其它'
},
blur: (value: any) => {
this.checkGoodsName();
}
}
}
@ -583,7 +586,7 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
}
subStartInfo(event: any, index: number, id?: any) {
if (id) {
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => {});
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => { });
}
this.startInfo.splice(index, 1);
this.validateForm1.removeControl(`loadAddress${index}`);
@ -611,7 +614,7 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
}
subEndInfo(event: any, index: number, id?: any) {
if (id) {
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => {});
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => { });
}
this.endInfo.splice(index, 1);
this.validateForm1.removeControl(`unloadAddress${index}`);
@ -838,43 +841,43 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
nzContent: AmapPoiPickerComponent,
nzWidth: 900,
nzOnOk: item => {
if(item?.poi) {
const poi = item.poi;
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];
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.district + poi.name;
this.endInfo[index].longitude = locList[0];
this.endInfo[index].latitude = locList[1];
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 (item?.poi) {
const poi = item.poi;
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];
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.district + poi.name;
this.endInfo[index].longitude = locList[0];
this.endInfo[index].latitude = locList[1];
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: any) => {
this.totalDistance = res.distance;
this.totalTime = res.time;
});
if (this.startInfo[0]?.area && this.endInfo[0]?.area) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe((res: any) => {
this.totalDistance = res.distance;
this.totalTime = res.time;
});
}
return true
} else {
this.service.msgSrv.warning('请重新手动选择地址!')
return false
}
return true
} else {
this.service.msgSrv.warning('请重新手动选择地址!')
return false
}
}
});
}
@ -1127,4 +1130,16 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
};
});
}
checkGoodsName() {
this.service.request(this.service.$api_checkGoodsName, this.sf3.value.goodsName1).subscribe(res => {
if (res === false) {
const modalRef = this.modalService.error({
nzTitle: '货物名称含有违禁词,请重新输入!',
});
modalRef.afterClose.subscribe(result => {
// this.sf3.setValue('/goodsName1', null);
});
}
});
}
}