import {
  addDateRange,
  addDateRange2,
  addDateRange3,
  getHiddenDetailAddress,
  getHiddenName,
  getPhon,
  handleTree,
  parseTime,
  resetForm,
  selectDictLabel,
  selectDictLabels
} from '@/utils/ruoyi';
import { getConfigKey, updateConfigByKey } from '@/api/system/config';
import { getDictionaryByKey, useDict } from '@/utils/dict';

import { App } from 'vue';
// 预设动画
import animate from '@/animate';
import auth from './auth';
import cache from './cache';
import { download as dl } from '@/utils/request';
import download from './download';
import { getEmulistLabelById } from '@/utils';
import modal from './modal';
import tab from './tab';

export default function installPlugin(app: App) {
  // 页签操作
  app.config.globalProperties.$tab = tab;

  // 模态框对象
  app.config.globalProperties.$modal = modal;

  // 缓存对象
  app.config.globalProperties.$cache = cache;

  // 下载文件
  app.config.globalProperties.$download = download;

  // 认证对象
  app.config.globalProperties.$auth = auth;

  // 全局方法挂载
  app.config.globalProperties.useDict = useDict;
  app.config.globalProperties.getConfigKey = getConfigKey;
  app.config.globalProperties.updateConfigByKey = updateConfigByKey;
  app.config.globalProperties.download = dl;
  app.config.globalProperties.parseTime = parseTime;
  app.config.globalProperties.handleTree = handleTree;
  app.config.globalProperties.addDateRange = addDateRange;
  app.config.globalProperties.selectDictLabel = selectDictLabel;
  app.config.globalProperties.selectDictLabels = selectDictLabels;
  app.config.globalProperties.animate = animate;
  app.config.globalProperties.getPhon = getPhon;
  app.config.globalProperties.addDateRange3 = addDateRange3;
  app.config.globalProperties.resetForm = resetForm;
  app.config.globalProperties.addDateRange2 = addDateRange2;
  app.config.globalProperties.getHiddenName = getHiddenName;
  app.config.globalProperties.getHiddenDetailAddress = getHiddenDetailAddress;
  app.config.globalProperties.getDictionaryByKey = getDictionaryByKey;
  app.config.globalProperties.getEmulistLabelById = getEmulistLabelById; // 根据枚举key和枚举获取枚举中文label
}
