import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {AlarmService} from '../../alarm.service';

@Component({
    selector: 'smart-find-user',
    templateUrl: './find-user.component.html',
    styles: []
})
export class FindUserComponent implements OnInit {
    @Output() set = new EventEmitter<any>();

    isVisible = false;
    objList;

    constructor(private alarmSer: AlarmService) {
    }

    ngOnInit() {
        this.getZabbixObj();
    }

    //获取发送对象 zabbix
    getZabbixObj() {
        this.alarmSer.zUserFind({}).subscribe(
            (res) => {
                if (res.errCode == 10000) {
                    this.objList = res.data;
                }
            }
        );
    }

    showModal() {
        this.isVisible = true;
    }

    setUser(item) {
        this.isVisible = false;
        this.set.emit(item);
    }

    handleKeyCancel(){
        this.isVisible = false;
    }

}
