main.js 3.35 KB
import Vue from 'vue'

import Cookies from 'js-cookie'

import 'normalize.css/normalize.css' // a modern alternative to CSS resets

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

import '@/assets/styles/index.scss' // global css
import '@/assets/styles/huaheng.scss' // huaheng css
import App from './App'
import store from './store'
import router from './router'
import permission from './directive/permission'
import {
  download
} from '@/utils/request'
import i18n from './lang' // internationalization
import './assets/icons' // icon
import './permission' // permission control
import {
  getDicts
} from "@/api/system/dict/data";
import {
  getConfigKey
} from "@/api/system/config";

import Print from '@/utils/print'

import dfilters from '@/utils/dfilter';
for (let key in dfilters) {
  Vue.filter(key, dfilters[key]);
}

import VueBarcode from 'vue-barcode';

import QrcodeVue from "qrcode.vue";

import draggable from 'vuedraggable'

import printTaskDialog from "@/views/task/taskHeader/dialog/printTaskDialog.vue";

import {
  resetForm,
  addDateRange,
  addDateRange2,
  selectDictLabel,
  selectDictLabels,
  selectCommonLabel,
  selectRuleLabel,
  selectlocatingRuleLabel,
  handleTree,
  reduceDays,
  changeDate,
  fitCondition,
  parseTime as formatTime
} from "@/utils/huaheng";

import {formatDate as parseTime} from "@/utils";

import Pagination from "@/components/Pagination";
//自定义表格工具扩展
import RightToolbar from "@/components/RightToolbar"

// 全局方法挂载
Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.addDateRange2 = addDateRange2
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.selectCommonLabel = selectCommonLabel
Vue.prototype.selectRuleLabel = selectRuleLabel
Vue.prototype.selectlocatingRuleLabel = selectlocatingRuleLabel
Vue.prototype.reduceDays = reduceDays
Vue.prototype.changeDate = changeDate
Vue.prototype.download = download
Vue.prototype.fitCondition = fitCondition
Vue.prototype.handleTree = handleTree
Vue.prototype.formatTime = formatTime

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.msgInfo = function (msg) {
  this.$message.info(msg);
}

//全局变量挂载
Vue.prototype.$colData

// 全局组件挂载
Vue.component('barcode', VueBarcode);
Vue.component('QrcodeVue', QrcodeVue);
Vue.component('printTaskDialog', printTaskDialog);
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
Vue.component('draggable', draggable)

Vue.use(permission)
Vue.use(Print)


/**
 * 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: Cookies.get('size') || 'medium', // set element-ui default size
  i18n: (key, value) => i18n.t(key, value)
})

Vue.config.productionTip = false

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