fix bug
This commit is contained in:
		| @ -341,6 +341,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { | ||||
|             params: { dictKey: 'car:model' }, | ||||
|             mode: 'multiple', | ||||
|             placeholder: '请选择车型', | ||||
|             maxMultipleCount:3, | ||||
|             errors: { required: '请选择车型' } | ||||
|           } | ||||
|         }, | ||||
| @ -352,6 +353,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { | ||||
|             params: { dictKey: 'car:length' }, | ||||
|             mode: 'multiple', | ||||
|             placeholder: '请选择车长', | ||||
|             maxMultipleCount:3, | ||||
|             errors: { required: '请选择车长' } | ||||
|           } | ||||
|         } | ||||
| @ -972,4 +974,42 @@ export class SupplyManagementReleasePublishComponent implements OnInit { | ||||
|   goBack() { | ||||
|     window.history.go(-1); | ||||
|   } | ||||
|     // 装卸货地址互换 | ||||
|     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; | ||||
|         }); | ||||
|       } | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user