import {Component, OnInit} from '@angular/core';
import {FramePageComponent} from "../../core/page/frame.page";
import {BsModalService} from "ngx-bootstrap/modal";
import {FrameDictDetailComponent} from "../frame-dict-detail/frame-dict-detail.component";
import {MsgService} from "../../../../core/service/msg.service";
import {AjaxService} from "../../../../core/service/ajax.service";

@Component({
  selector: 'app-frame-dict-page',
  templateUrl: './frame-dict-page.component.html',
  styleUrls: ['./frame-dict-page.component.scss']
})
export class FrameDictPageComponent extends FramePageComponent implements OnInit {

  constructor(private modalService: BsModalService) {
    super(modalService);
    this.modalComponent = FrameDictDetailComponent;
  }

  ngOnInit() {
  }

  reloadDict() {
    MsgService.confirmAlert(`确定要重新加载系统字典吗？如果字典较多，该操作可能需要比较长的时间，请谨慎使用该功能!`, () => {
      AjaxService.request('frame/dict/reload.htm', {}, () => {
        MsgService.successAlert(`字典加载成功，后台字典已经生效，前端字典需重新登录！`);
      }, {RequestWithLoading: true});
    });
  }


}

