import { Component, OnInit, AfterViewInit } from "@angular/core";
import { Location } from '@angular/common';

@Component({
  selector: "app-other-config",
  templateUrl: "./other-config.component.html",
  styleUrls: ["./other-config.component.less"],
})
export class OtherConfigComponent implements OnInit, AfterViewInit {
  constructor(
    private _location: Location,
  ){}

  // tab
  tagList:any = [
    // { id: 1, name: '呼叫中心',},
    // { id: 2, name: '微信配置',},
    // { id: 3, name: '数据字典',},
  ];

  // 数据字典
  dictionaryKeyList:any[] = [
    { id: 1, name: '呼叫中心分机号', key: "hjzx_cornet"},
  ]

  ngOnInit(): void {}

  ngAfterViewInit(){
    setTimeout(() => {
      let menus = JSON.parse(localStorage.getItem("menu"));
      let otherConfig = menus.find(item => item.link == 'otherConfig');
      this.tagList = otherConfig ? (otherConfig.childrens || []) : [];
      this.tagList.length && this.clickTag(this.tagList[0]);
    }, 0)
  }

  // 点击tab
  activeTagLink:any = 1;
  clickTag(tag){
    this.activeTagLink = tag.link;
  }

  // 返回
  goBack(){
    this._location.back();
  }
}
