set default value is modified
This commit is contained in:
parent
5f5269c15b
commit
aba846cce7
|
@ -12,11 +12,13 @@
|
|||
</div>
|
||||
<div class="oraganization-tab">
|
||||
<div class="oraganization-tab-tree">
|
||||
<perfect-scrollbar>
|
||||
<ucap-organization-tree
|
||||
[oraganizationList]="departmentInfoList$ | async"
|
||||
[loginRes]="loginRes"
|
||||
(selected)="onSelectedOrganization($event)"
|
||||
></ucap-organization-tree>
|
||||
</perfect-scrollbar>
|
||||
</div>
|
||||
<div class="select-list">
|
||||
<dl class="select-dept text-accent-color">
|
||||
|
|
|
@ -5,7 +5,8 @@ import {
|
|||
Output,
|
||||
EventEmitter,
|
||||
ViewChild,
|
||||
ElementRef
|
||||
ElementRef,
|
||||
ChangeDetectorRef
|
||||
} from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
import { Company } from '@ucap-webmessenger/api-external';
|
||||
|
@ -40,6 +41,7 @@ export class LoginComponent implements OnInit {
|
|||
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private localStorageService: LocalStorageService
|
||||
) {}
|
||||
|
||||
|
@ -47,21 +49,20 @@ export class LoginComponent implements OnInit {
|
|||
const loginInfo: LoginInfo = this.localStorageService.get<LoginInfo>(
|
||||
KEY_LOGIN_INFO
|
||||
);
|
||||
let companyCode = '';
|
||||
let loginId = '';
|
||||
let remember = false;
|
||||
if (loginInfo && loginInfo.companyCode && loginInfo.loginId) {
|
||||
companyCode = loginInfo.companyCode;
|
||||
loginId = loginInfo.loginId;
|
||||
remember = true;
|
||||
}
|
||||
this.loginForm = this.formBuilder.group({
|
||||
companyCode: [companyCode, [Validators.required]],
|
||||
loginId: [loginId, [Validators.required]],
|
||||
companyCode: ['', [Validators.required]],
|
||||
loginId: ['', [Validators.required]],
|
||||
loginPw: ['', Validators.required],
|
||||
remember: [remember]
|
||||
remember: [false]
|
||||
});
|
||||
|
||||
if (loginInfo && loginInfo.companyCode && loginInfo.loginId) {
|
||||
this.loginForm.get('companyCode').setValue(loginInfo.companyCode);
|
||||
this.loginForm.get('loginId').setValue(loginInfo.loginId);
|
||||
this.loginForm.get('remember').setValue(true);
|
||||
this.changeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
if (!this.loginBtnText || this.loginBtnText.trim().length === 0) {
|
||||
this.loginBtnText = 'LOGIN';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user