main.js 5.69 KB
import Vue from 'vue'

import Element from 'element-ui'
import './assets/styles/element-variables.scss'

import '@/assets/styles/index.scss' // global css
import '@/assets/styles/iClearExp.scss' // iClearExp css
import '@/assets/styles/variables.scss'
import '@/assets/styles/fedex.scss'
import App from './App'
import store from './store'
import router from './router'
import i18n from '@/assets/languages'
import permission from './directive/permission'

import './assets/icons' // icon
import './permission' // permission control
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree, hscodeElementInfo, elementTostring, numberRound, detailUnitConversion, setDict, sendNotificationHandler, promptMessage, upDateTokenTime, sreachEntryLock, tableFixedTypeChange, getDownLoadFileStatus, approvalPortType, getSystemOption, currencySystemDisableType, imageTaskStatusShowType } from "@/utils/iClearExp";
import { formatDate, debounce, alertWarningMsg, alertSuccessMsg, alertErrorMsg, alertInfoMsg, toHead, compare, createRandom, ctho, base64ConvertFile } from "@/utils/index";
import * as fileDownload from '@/utils/zipdownload.js'
import * as filters from '@/utils/filters.js'
import regExp from '@/utils/regExp.js'
import Pagination from "@/components/Pagination";
// 自定义表格工具扩展
import RightToolbar from "@/components/RightToolbar"
import Table from "@/components/Table"
import Formitem from "@/components/Formitem"
import EditStep from "@/components/EditStep"
import FedexAlert from "@/components/FedexAlert"
import FedexEdit from "@/components/FedexEdit"
import Tooltip from "@/components/Tooltip"
import InputNodes from '@/components/InputNodes'
import AlterDialog from '@/components/AlterDialog'
import CustomTransfer from '@/components/CustomTransfer'
import CustomForm from '@/components/CustomForm'
import CustomTable from '@/components/CustomTable'
import EditTag from '@/components/EditTag'
(function () {
  if (typeof EventTarget !== "undefined") {
    let func = EventTarget.prototype.addEventListener;
    EventTarget.prototype.addEventListener = function (type, fn, capture) {
      this.func = func;
      if (typeof capture !== "boolean") {
        capture = capture || {};
        capture.passive = false;
      }
      this.func(type, fn, capture);
    };
  };
}());

// 全局方法挂载
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
Vue.prototype.hscodeElementInfo = hscodeElementInfo
Vue.prototype.elementTostring = elementTostring
Vue.prototype.formatDate = formatDate
Vue.prototype.debounce = debounce
Vue.prototype.regExp = regExp
Vue.prototype.numberRound = numberRound
Vue.prototype.detailUnitConversion = detailUnitConversion
Vue.prototype.fileDownload = fileDownload
Vue.prototype.alertWarningMsg = alertWarningMsg
Vue.prototype.alertSuccessMsg = alertSuccessMsg
Vue.prototype.alertErrorMsg = alertErrorMsg
Vue.prototype.alertInfoMsg = alertInfoMsg
Vue.prototype.toHead = toHead
Vue.prototype.setDict = setDict
Vue.prototype.compare = compare
Vue.prototype.sendNotificationHandler = sendNotificationHandler
Vue.prototype.promptMessage = promptMessage
Vue.prototype.createRandom = createRandom
Vue.prototype.upDateTokenTime = upDateTokenTime
Vue.prototype.sreachEntryLock = sreachEntryLock
Vue.prototype.tableFixedTypeChange = tableFixedTypeChange
Vue.prototype.ctho = ctho
Vue.prototype.getDownLoadFileStatus = getDownLoadFileStatus
Vue.prototype.base64ConvertFile = base64ConvertFile
Vue.prototype.approvalPortType = approvalPortType
Vue.prototype.getSystemOption = getSystemOption
Vue.prototype.currencySystemDisableType = currencySystemDisableType
Vue.prototype.imageTaskStatusShowType = imageTaskStatusShowType

Vue.prototype.msgSuccess = function (msg) {
  this.$message({ showClose: true, message: msg, type: "success" });
}

Vue.prototype.msgError = function (msg) {
  this.$message({ showClose: true, message: msg, type: "error" });
}

Vue.prototype.msgWarning = function (msg) {
  this.$message({ showClose: true, message: msg, type: "warning" });
}

Vue.prototype.msgInfo = function (msg) {
  this.$message.info(msg);
}

// 全局组件挂载
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
Vue.component('InputNodes', InputNodes)
Vue.component('Table', Table)
Vue.component('Formitem', Formitem)
Vue.component('EditStep', EditStep)
Vue.component('FedexAlert', FedexAlert)
Vue.component('FedexEdit', FedexEdit)
Vue.component('Tooltip', Tooltip)
Vue.component('AlterDialog', AlterDialog)
Vue.component('CustomTransfer', CustomTransfer)
Vue.component('CustomForm', CustomForm)
Vue.component('CustomTable', CustomTable)
Vue.component('EditTag', EditTag)

Vue.use(permission)


Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})



// window.addEventListener('resize', () => {
//   // 获取当前的缩放级别
//   const currentScale = window.devicePixelRatio;

//   // 如果缩放发生变化,输出变化信息
//   if (currentScale !== previousScale) {
//     console.log(`Zoom changed from ${previousScale} to ${currentScale}`);
//     previousScale = currentScale;
//   }
// });

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online! ! !
 */

Vue.use(Element, {
  size: localStorage.getItem('size') || 'medium' // set element-ui default size
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})