This commit is contained in:
Taric Xin
2022-01-06 19:33:52 +08:00
parent f38bca116c
commit 024d7ff39d
2 changed files with 50 additions and 127 deletions

View File

@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { FormBuilder, FormControl, FormGroup, NgForm, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import {
SFArrayWidgetSchema,
@ -31,7 +31,9 @@ import { PublishSuccessComponent } from '../onecar-publish/publish-success/publi
styleUrls: ['./bulk-release-publish.component.less']
})
export class SupplyManagementBulkReleasePublishComponent implements OnInit {
validateForm1: FormGroup;
@ViewChild('ngForm')
ngForm!: NgForm;
sf1data: any; // 货源单设置回显
sf3data: any; // 货源单设置回显
sf4data: any; // 货源单设置回显
@ -59,7 +61,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
ruleOptions: any;
constructor(
private http: _HttpClient,
fb: FormBuilder,
private modalService: NzModalService,
private settingSrv: SettingsService,
private service: SupplyManagementService,
@ -67,16 +68,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
private route: ActivatedRoute,
private amapService: AmapService,
public shipperSrv: ShipperBaseService
) {
this.validateForm1 = fb.group({
loadAddress0: [null, [Validators.required]],
loadName0: [null, [Validators.required]],
loadPhone0: [null, [Validators.required]],
unloadAddress0: [null, [Validators.required]],
unloadName0: [null, [Validators.required]],
unloadPhone0: [null, [Validators.required]]
});
}
) {}
@ViewChild('sf1', { static: false }) sf1!: SFComponent;
schema1: SFSchema = {};
@ -151,9 +143,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
},
change: (q: any) => {
this.getRegionCode(q);
},
visibleIf: {
_$expand: (value: boolean) => value
}
} as SFSelectWidgetSchema
},
@ -180,9 +169,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: {
_$expand: (value: boolean) => value
},
allowClear: true,
asyncData: () => this.shipperSrv.getNetworkFreightForwarder()
}
@ -481,17 +467,17 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
});
}
submit(submitType: string): void {
// Object.keys(this.validateForm1.controls).forEach(key => {
// this.validateForm1.controls[key].markAsDirty();
// this.validateForm1.controls[key].updateValueAndValidity();
// });
// this.sf1.validator({ emitError: true });
// this.sf3.validator({ emitError: true });
// this.sf4.validator({ emitError: true });
// this.sf6.validator({ emitError: true });
// if (this.validateForm1.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) {
// return;
// }
Object.keys(this.ngForm.form.controls).forEach(key => {
this.ngForm.form.controls[key].markAsDirty();
this.ngForm.form.controls[key].updateValueAndValidity();
});
this.sf1.validator({ emitError: true });
this.sf3.validator({ emitError: true });
this.sf4.validator({ emitError: true });
this.sf6.validator({ emitError: true });
if (this.ngForm.form.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) {
return;
}
// //装卸货信息
const LoadingList = this.startInfo.concat(this.endInfo);