补全表单缺失项

This commit is contained in:
禾几海
2020-08-07 21:45:39 +08:00
parent 58d11c4fa8
commit 398716e3ff
2 changed files with 28 additions and 13 deletions

View File

@@ -22,6 +22,8 @@ export class AdminLinkComponent implements OnInit {
name: new FormControl(null, [Validators.required]),
url: new FormControl(null, [Validators.required, Validators.pattern(/^(https:\/\/|http:\/\/|)([\w-]+\.)+[\w-]+(\/[\w-./?%&=]*)?$/)]),
open: new FormControl(null, [Validators.required]),
desc: new FormControl(null, [Validators.maxLength(255)]),
iconPath: new FormControl(null, [Validators.pattern(/^(https:\/\/|http:\/\/|)([\w-]+\.)+[\w-]+(\/[\w-./?%&=]*)?$/)]),
oper: new FormControl(null)
})
}
@@ -83,13 +85,7 @@ export class AdminLinkComponent implements OnInit {
modalConfirm() {
this.modalVisible = false;
const linkReq: Link = new Link();
linkReq.name = this.formGroup.value.name;
linkReq.url = this.formGroup.value.url;
linkReq.open = this.formGroup.value.open;
// 暂时设置未空
linkReq.desc = '';
linkReq.iconPath = '';
const linkReq: Link = this.formGroup.value
const oper = this.formGroup.value.oper;
let observable: Observable<Response<Link>>;
if (oper === 'edit') {