-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fixbug] required field check #2022
Changes from 6 commits
ebebac6
f8eb972
526b17d
6bc4d42
88063d7
89ee415
a377713
c47723d
54388dd
92713d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,8 @@ | |
* under the License. | ||
*/ | ||
|
||
import { Component, Inject, OnInit } from '@angular/core'; | ||
import { Component, Inject, OnInit, ViewChild } from '@angular/core'; | ||
import { NgForm } from '@angular/forms'; | ||
import { I18NService } from '@core'; | ||
import { ALAIN_I18N_TOKEN } from '@delon/theme'; | ||
import { NzModalService } from 'ng-zorro-antd/modal'; | ||
|
@@ -69,6 +70,10 @@ export class AlertNoticeComponent implements OnInit { | |
tagsOption: any[] = []; | ||
filterTags: string[] = []; | ||
isLimit: boolean = false; | ||
@ViewChild('receiverForm', { static: false }) receiverForm: NgForm | undefined; | ||
@ViewChild('templateForm', { static: false }) templateForm: NgForm | undefined; | ||
@ViewChild('ruleForm', { static: false }) ruleForm: NgForm | undefined; | ||
|
||
dayCheckOptions = [ | ||
{ label: this.i18nSvc.fanyi('common.week.7'), value: 7, checked: true }, | ||
{ label: this.i18nSvc.fanyi('common.week.1'), value: 1, checked: true }, | ||
|
@@ -348,6 +353,17 @@ export class AlertNoticeComponent implements OnInit { | |
} | ||
|
||
onManageReceiverModalOk() { | ||
// @ts-ignore | ||
if (this.receiverForm.invalid) { | ||
// @ts-ignore | ||
Object.values(this.receiverForm.controls).forEach(control => { | ||
if (control.invalid) { | ||
control.markAsDirty(); | ||
control.updateValueAndValidity({ onlySelf: true }); | ||
} | ||
}); | ||
return; | ||
} | ||
this.isManageReceiverModalOkLoading = true; | ||
if (this.isManageReceiverModalAdd) { | ||
const modalOk$ = this.noticeReceiverSvc | ||
|
@@ -691,6 +707,17 @@ export class AlertNoticeComponent implements OnInit { | |
} | ||
|
||
onManageRuleModalOk() { | ||
// @ts-ignore | ||
if (this.ruleForm.invalid) { | ||
// @ts-ignore | ||
Object.values(this.ruleForm.controls).forEach(control => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hi, no suggest use the @ts-ignore to ignore warning, how about this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you are right, I will optimize it, thanks for the reminder |
||
if (control.invalid) { | ||
control.markAsDirty(); | ||
control.updateValueAndValidity({ onlySelf: true }); | ||
} | ||
}); | ||
return; | ||
} | ||
this.rule.receiverName = []; | ||
this.receiversOption.forEach(option => { | ||
this.rule.receiverId.forEach(id => { | ||
|
@@ -777,6 +804,17 @@ export class AlertNoticeComponent implements OnInit { | |
} | ||
|
||
onManageTemplateModalOk() { | ||
// @ts-ignore | ||
if (this.templateForm.invalid) { | ||
// @ts-ignore | ||
Object.values(this.templateForm.controls).forEach(control => { | ||
if (control.invalid) { | ||
control.markAsDirty(); | ||
control.updateValueAndValidity({ onlySelf: true }); | ||
} | ||
}); | ||
return; | ||
} | ||
this.isManageTemplateModalOkLoading = true; | ||
if (this.isManageTemplateModalAdd) { | ||
this.template.preset = false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi how about here
@ts-ignore
and belowThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forgot to change some parts, I have changed them