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

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

  // tab
  tagList:any = [
    // { id: 1, name: '标本',},
  ];

  // 数据字典
  dictionaryKeyList:any[] = [
    { id: 1, name: '检查类型', key: "inspect_check_item"},
		{ id: 2, name: 'ABO血型', key: "abo_type"},
		{ id: 3, name: 'RH血型', key: "rh_type"},
		{ id: 4, name: '单位', key: "blood_unit"},
		{ id: 5, name: '血液类型', key: "blood_trans_type"},
  ]

  ngOnInit(): void {}

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

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

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