Browse Source

[完善]编辑预案弹窗无法关闭

beijing
邵佳豪 2 years ago
parent
commit
b0ccea0ac0
  1. 8
      src/app/pages/left-domain/left-domain.component.html
  2. 16
      src/app/pages/left-domain/left-domain.component.ts

8
src/app/pages/left-domain/left-domain.component.html

@ -343,19 +343,19 @@
</nz-modal>
<nz-modal [(nzVisible)]="editSelectDisposal" nzTitle="编辑预案名称">
<ng-container *nzModalContent>
<form nz-form #editForm='ngForm'>
<ng-container>
<form nz-form #editForm='ngForm' *nzModalContent [formGroup]="validateForm3">
<nz-form-item>
<nz-form-label [nzSpan]="6">预案名称</nz-form-label>
<nz-form-control [nzSpan]="18" nzErrorTip="请输入必填项">
<input nz-input #name='ngModel' [(ngModel)]="editDisposalName" name="name" required />
<input formControlName="name" nz-input [(ngModel)]="editDisposalName" name="name" required />
</nz-form-control>
</nz-form-item>
</form>
<div *nzModalFooter>
<button nz-button nzType="primary" (click)="saveMould()" *ngIf="userMode">保存为模板</button>
<button nz-button nzType="default" (click)="editSelectDisposal = null;">取消</button>
<button nz-button nzType="primary" (click)="editDisposal(editForm.value)">确定</button>
<button nz-button nzType="primary" (click)="editDisposal()">确定</button>
</div>
</ng-container>
</nz-modal>

16
src/app/pages/left-domain/left-domain.component.ts

@ -29,6 +29,7 @@ export class LeftDomainComponent implements OnInit {
constructor(private message: NzMessageService, private element: ElementRef, private http: HttpClient, private cd: ChangeDetectorRef, private fb: FormBuilder) { }
validateForm!: FormGroup;
validateForm2!: FormGroup;
validateForm3!: FormGroup;
ngOnInit(): void {
this.validateForm = this.fb.group({
name: [null, [Validators.required]],
@ -41,6 +42,10 @@ export class LeftDomainComponent implements OnInit {
node: [null, [Validators.required]]
});
this.validateForm3 = this.fb.group({
name: [null, [Validators.required]]
});
this.editMode = PlanComponent.instance.editMode
this.initComponent()
}
@ -402,7 +407,16 @@ export class LeftDomainComponent implements OnInit {
}
//编辑预案名称
editDisposal(e) {
editDisposal() {
if (!this.validateForm3.valid) {
this.message.create('warning', '请填写完整!');
return
}
let e = this.validateForm3.value
this.editSelectDisposal.name = e.name
this.editSelectDisposal = null
}

Loading…
Cancel
Save