| | |
| | | ) {} |
| | | |
| | | ngOnInit() { |
| | | const alarmUser = this.alarmUser; |
| | | this.validateForm = this.formBuilder.group({ |
| | | name: [this.alarmUser.name], |
| | | mobile: [this.alarmUser.mobile, [Validators.pattern("^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$")]], |
| | | email: [this.alarmUser.email,[Validators.email]], |
| | | weixin: [this.alarmUser.weixin], |
| | | organizationId: [this.alarmUser.organizationId], |
| | | expireTime: [this.alarmUser.expireTime], |
| | | id: [this.alarmUser.id] |
| | | name: [alarmUser.name], |
| | | mobile: [alarmUser.mobile, [Validators.pattern('^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$')]], |
| | | email: [alarmUser.email, [Validators.email]], |
| | | weixin: [alarmUser.weixin], |
| | | organizationId: [alarmUser.organizationId], |
| | | expireTime: [alarmUser.expireTime], |
| | | id: [alarmUser.id] |
| | | }); |
| | | this.searchOptions = this.alarmUser.organization ? [this.alarmUser.organization] : []; |
| | | this.searchOptions = alarmUser.organization ? [alarmUser.organization] : []; |
| | | } |
| | | |
| | | save() { |
| | | if (this.validateForm.valid) { |
| | | for (const i in this.validateForm.controls) { |
| | | this.validateForm.controls[i].disable(); |
| | | const validateForm = this.validateForm; |
| | | const controls = validateForm.controls; |
| | | if (validateForm.valid) { |
| | | for (const i in controls) { |
| | | controls[i].disable(); |
| | | } |
| | | this.http.post(environment.SERVER_BASH_URL + '/alarmUser/alarmUser', this.validateForm.value).subscribe(() => { |
| | | this.http.post(environment.SERVER_BASH_URL + '/alarmUser/alarmUser', validateForm.value).subscribe(() => { |
| | | this.subject.next('true'); |
| | | this.close(); |
| | | }); |
| | | } else { |
| | | for (const i in this.validateForm.controls) { |
| | | this.validateForm.controls[i].markAsDirty(); |
| | | for (const i in controls) { |
| | | controls[i].markAsDirty(); |
| | | } |
| | | } |
| | | } |