This commit is contained in:
wangshiming
2022-02-16 13:54:15 +08:00
parent 2b97ad5bb5
commit 5b49aeae04
12 changed files with 326 additions and 128 deletions

View File

@ -325,6 +325,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
params: { dictKey: 'car:model' },
mode: 'multiple',
placeholder: '请选择车型',
maxMultipleCount:3,
errors: { required: '请选择车型' }
}
},
@ -336,6 +337,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
params: { dictKey: 'car:length' },
mode: 'multiple',
placeholder: '请选择车长',
maxMultipleCount:3,
errors: { required: '请选择车长' }
}
}
@ -1223,4 +1225,42 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
}
}
// 装卸货地址互换
swapAddress(){
this.startInfo.forEach((element:any, index:any) => {
this.validateForm1.removeControl(`loadAddress${index}`);
this.validateForm1.removeControl(`loadName${index}`);
this.validateForm1.removeControl(`loadPhone${index}`);
});
this.endInfo.forEach((element:any, index:any) => {
this.validateForm1.removeControl(`unloadAddress${index}`);
this.validateForm1.removeControl(`unloadName${index}`);
this.validateForm1.removeControl(`unloadPhone${index}`);
});
let item = this.startInfo;
this.startInfo = this.endInfo;
this.endInfo = item;
this.startInfo.forEach((element:any,index:any) => {
element.type = '1';
this.validateForm1.addControl(`loadAddress${index}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`loadName${index}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`loadPhone${index}`, new FormControl(null, [Validators.required, Validators.pattern('^[0-9]*$')]));
});
this.endInfo.forEach((element:any,index:any) => {
element.type = '2';
this.validateForm1.addControl(`unloadAddress${index}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`unloadName${index}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`unloadPhone${index}`, new FormControl(null, [Validators.required, Validators.pattern('^[0-9]*$')]));
});
// 计算里程,时间
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;
});
}
}
}