import App from './App.vue'


// import "hi-ui/lib/hi-ui.css";
//設置script引入全局的ELEMENT 配置
Vue.prototype.$ELEMENT = { size: 'mini', zIndex: 3000 };


import Message from './components/vue-m-message'
Vue.use(Message) // will mount `Vue.prototype.$message`
import './assets/icon/iconfont.css';
import './styles/index.css'
import "hi-taskcenter/hi-taskcenter.css"
import hitaskcenter from 'hi-taskcenter';
Vue.use(hitaskcenter);
// import 'zhc-flowchart/lib/zhc-flowchart.css'
// import zhcflowchart from "zhc-flowchart";
// Vue.use(zhcflowchart)
import UmyUi from 'umy-ui' 
// import 'umy-ui/lib/theme-chalk/index.css';
import 'umy-ui/lib/theme-chalk/ux-grid.css';

import ZhcBirtCmps from 'zhc-birt-cmps'
Vue.use(ZhcBirtCmps)
Vue.use(UmyUi)
// import window.HIVUI_SETTING from './window.HIVUI_SETTING'
// import { $HCBIRT } from "@birt/funclib/HCBIRT"
import Cookies from 'js-cookie'
import {
  setToken,
} from "./utils/auth.js";
Vue.use(ELEMENT)
console.log('token', Cookies.get('EAP-Token'))
setToken(Cookies.get('EAP-Token') || '')

import axios from "./funclib/AxiosUtil";

import pinyin from 'js-pinyin'
Vue.prototype.Pinyin = pinyin
import md5 from 'js-md5'
Vue.prototype.Md5 = md5

// import { Loading } from 'element-ui';
// Vue.prototype.Loading = Loading

import * as XLSX from 'xlsx'
// import * as echarts from "echarts"
Vue.prototype.XLSX = XLSX;
// Vue.prototype.$echarts = echarts;
// Vue.prototype.$HCBIRT = $HCBIRT;

// import i18n from './lang'
console.log(
  '%c zhc-birt-cmps  %c v'.concat(ZhcBirtCmps.Package && ZhcBirtCmps.Package.version, ' '),
  'padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #5584ff; font-weight: bold;',
  'padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;',
);

function getFullUrl(url1, url2){
  return url2 && url2.includes(url1) ? url2 : url1 + url2
}

Vue.prototype.$HI = {
  projectName: window.HIVUI_SETTING.projectName,
  serverUrl: window.HIVUI_SETTING.serverUrl,
  serverName: window.HIVUI_SETTING.serverName,
  request: axios,
  queryOperate: 'like',
  pageSize: 20,
  saveUrl: getFullUrl(window.HIVUI_SETTING.serverUrl, window.HIVUI_SETTING.saveUrl),
  queryUrl: getFullUrl(window.HIVUI_SETTING.serverUrl, window.HIVUI_SETTING.queryUrl),
  querysUrl: window.HIVUI_SETTING.serverUrl + "/data/querys",
  policyUrl: window.HIVUI_SETTING.policyUrl,
  enumsUrl: window.HIVUI_SETTING.serverUrl + "/platf/xtgn/enums/fgroupid/",
  upload: getFullUrl(window.HIVUI_SETTING.serverUrl, window.HIVUI_SETTING.upload),
  download: getFullUrl(window.HIVUI_SETTING.serverUrl, window.HIVUI_SETTING.download),
  preview: getFullUrl(window.HIVUI_SETTING.serverUrl, window.HIVUI_SETTING.preview || window.HIVUI_SETTING.review),
  getFlowInfo: getFullUrl(window.HIVUI_SETTING.serverUrl, window.HIVUI_SETTING.getFlowInfo),
  getApprovalInfo: getFullUrl(window.HIVUI_SETTING.serverUrl, window.HIVUI_SETTING.getApprovalInfo),
  processFlow: getFullUrl(window.HIVUI_SETTING.serverUrl, window.HIVUI_SETTING.processFlow),
  queryTask: getFullUrl(window.HIVUI_SETTING.serverUrl, window.HIVUI_SETTING.queryTask),
  withdrawtask: getFullUrl(window.HIVUI_SETTING.serverUrl, window.HIVUI_SETTING.withdrawtask),
  taskDiagram: getFullUrl(window.HIVUI_SETTING.serverUrl, window.HIVUI_SETTING.taskDiagram),
  openOrdernumber: getFullUrl(window.HIVUI_SETTING.serverUrl, window.HIVUI_SETTING.openOrdernumber),
  birtModel: window.HIVUI_SETTING.serverUrl + "/birt/model1",
  getProcessInfo: window.HIVUI_SETTING.serverUrl + '/flow/getProcessInfo',
  exportUrl: window.HIVUI_SETTING.serverUrl + "/export/dataexcelnew",
  langUrl: window.HIVUI_SETTING.serverUrl + "/lang/systable",
  isLang: window.HIVUI_SETTING.isLang || false,
  tableFixed: window.HIVUI_SETTING.tableFixed
};
window.BIRT_SETTING = Vue.prototype.$HI;

new Vue({
  // i18n,
  render: h => h(App),
}).$mount('#app')
