set default value is modified

This commit is contained in:
병준 박 2019-11-15 11:21:42 +09:00
parent 5f5269c15b
commit aba846cce7
2 changed files with 20 additions and 17 deletions

View File

@ -12,11 +12,13 @@
</div> </div>
<div class="oraganization-tab"> <div class="oraganization-tab">
<div class="oraganization-tab-tree"> <div class="oraganization-tab-tree">
<perfect-scrollbar>
<ucap-organization-tree <ucap-organization-tree
[oraganizationList]="departmentInfoList$ | async" [oraganizationList]="departmentInfoList$ | async"
[loginRes]="loginRes" [loginRes]="loginRes"
(selected)="onSelectedOrganization($event)" (selected)="onSelectedOrganization($event)"
></ucap-organization-tree> ></ucap-organization-tree>
</perfect-scrollbar>
</div> </div>
<div class="select-list"> <div class="select-list">
<dl class="select-dept text-accent-color"> <dl class="select-dept text-accent-color">

View File

@ -5,7 +5,8 @@ import {
Output, Output,
EventEmitter, EventEmitter,
ViewChild, ViewChild,
ElementRef ElementRef,
ChangeDetectorRef
} from '@angular/core'; } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { Company } from '@ucap-webmessenger/api-external'; import { Company } from '@ucap-webmessenger/api-external';
@ -40,6 +41,7 @@ export class LoginComponent implements OnInit {
constructor( constructor(
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private changeDetectorRef: ChangeDetectorRef,
private localStorageService: LocalStorageService private localStorageService: LocalStorageService
) {} ) {}
@ -47,21 +49,20 @@ export class LoginComponent implements OnInit {
const loginInfo: LoginInfo = this.localStorageService.get<LoginInfo>( const loginInfo: LoginInfo = this.localStorageService.get<LoginInfo>(
KEY_LOGIN_INFO 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({ this.loginForm = this.formBuilder.group({
companyCode: [companyCode, [Validators.required]], companyCode: ['', [Validators.required]],
loginId: [loginId, [Validators.required]], loginId: ['', [Validators.required]],
loginPw: ['', 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) { if (!this.loginBtnText || this.loginBtnText.trim().length === 0) {
this.loginBtnText = 'LOGIN'; this.loginBtnText = 'LOGIN';
} }