Newer
Older
import { Component, OnInit } from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
@Component({
selector: 'smart-group-modal',
templateUrl: './group-modal.component.html',
styles: []
})
export class GroupModalComponent implements OnInit {
title = '新增部门';
isVisible = false;
validateForm:FormGroup;
constructor(private fb:FormBuilder,
private systemSer:SystemService) {
}
ngOnInit() :void{
this.validateForm = this.fb.group({
name:[null,[Validators.required,Validators.maxLength(15)]],
parentId:[null,[Validators.required]],
});
}
this.isVisible = true;
}
handleCancel(){
this.isVisible = false;
}
handleOk(){
this.isVisible = true;
for(const i in this.validateForm.controls){
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
}
this.systemSer.createOrg(this.validateForm.value).subscribe(
(res)=>{
}
)