diff --git a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts index a1e6d848..00a3875f 100644 --- a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts +++ b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts @@ -41,7 +41,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { maxPiece: 99999, maxDays: 999, intervalDays: 999, - maxTimes: 999 + maxTimes: 5 }; sf1data: any; // 货源单设置回显 sf3data: any; // 货源单设置回显 @@ -746,7 +746,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { }); } addStartInfo() { - if (this.startInfo.length < 5) { + if (this.startInfo.length < this.limitValues.maxTimes) { const controlId = this.startInfo.length; this.startInfo.push({ detailedAddress: '', @@ -800,7 +800,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit { this.validateForm1.removeControl(`loadPhone${index}`); } addEndInfo() { - if (this.endInfo.length < 5) { + if (this.endInfo.length < this.limitValues.maxTimes) { const controlId = this.endInfo.length; this.endInfo.push({ detailedAddress: '', diff --git a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts index a8290682..cb2b4c40 100644 --- a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts +++ b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts @@ -109,7 +109,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { maxPiece: 99999, maxDays: 999, intervalDays: 999, - maxTimes: 999 + maxTimes: 5 }; formatterRmb = (value: number): string => { @@ -767,7 +767,10 @@ export class SupplyManagementReleasePublishComponent implements OnInit { } // 添加 删除发货卸货地址 addStartInfo() { - if (this.startInfo.length < 5) { + console.log(this.startInfo.length); + console.log(this.limitValues.maxTimes); + + if (this.startInfo.length < this.limitValues.maxTimes) { const controlId = this.startInfo.length; this.startInfo.push({ detailedAddress: '', @@ -782,11 +785,11 @@ export class SupplyManagementReleasePublishComponent implements OnInit { }); this.validateForm1.addControl(`loadAddress${controlId}`, new FormControl(null, Validators.required)); this.validateForm1.addControl(`loadName${controlId}`, new FormControl(null, Validators.required)); - this.validateForm1.addControl(`loadPhone${controlId}`, new FormControl(null, Validators.required)); + this.validateForm1.addControl(`loadPhone${controlId}`, new FormControl(null, [Validators.required, Validators.pattern('^[0-9]*$')])); } } // 添加 删除发货卸货地址 - subStartInfo(_event: any, index: number) { + subStartInfo(event: any, index: number) { this.startInfo.splice(index, 1); this.validateForm1.removeControl(`loadAddress${index}`); this.validateForm1.removeControl(`loadName${index}`); @@ -794,7 +797,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { } // 添加 删除发货卸货地址 addEndInfo() { - if (this.addEndInfo.length < 5) { + if (this.endInfo.length < this.limitValues.maxTimes) { const controlId = this.endInfo.length; this.endInfo.push({ detailedAddress: '', @@ -809,11 +812,14 @@ export class SupplyManagementReleasePublishComponent implements OnInit { }); this.validateForm1.addControl(`unloadAddress${controlId}`, new FormControl(null, Validators.required)); this.validateForm1.addControl(`unloadName${controlId}`, new FormControl(null, Validators.required)); - this.validateForm1.addControl(`unloadPhone${controlId}`, new FormControl(null, Validators.required)); + this.validateForm1.addControl( + `unloadPhone${controlId}`, + new FormControl(null, [Validators.required, Validators.pattern('^[0-9]*$')]) + ); } } // 添加 删除发货卸货地址 - subEndInfo(_event: any, index: number) { + subEndInfo(event: any, index: number) { this.endInfo.splice(index, 1); this.validateForm1.removeControl(`unloadAddress${index}`); this.validateForm1.removeControl(`unloadName${index}`);