main.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. import Element from 'element-ui'
  4. import './assets/styles/element-variables.scss'
  5. import '@/assets/styles/index.scss' // global css
  6. import '@/assets/styles/elf.scss' // elf css
  7. import App from './App'
  8. import store from './store'
  9. import router from './router'
  10. import directive from './directive' // directive
  11. import plugins from './plugins' // plugins
  12. import {download} from '@/utils/request'
  13. import './assets/icons' // icon
  14. import './permission' // permission control
  15. import {getDicts} from "@/api/system/dict/data";
  16. import {getConfigKey} from "@/api/system/config";
  17. import {parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree} from "@/utils/elf";
  18. // 分页组件
  19. import Pagination from "@/components/Pagination";
  20. // 自定义表格工具组件
  21. import RightToolbar from "@/components/RightToolbar"
  22. // 富文本组件
  23. import Editor from "@/components/Editor"
  24. // 文件上传组件
  25. import FileUpload from "@/components/FileUpload"
  26. // 图片上传组件
  27. import ImageUpload from "@/components/ImageUpload"
  28. // 图片预览组件
  29. import ImagePreview from "@/components/ImagePreview"
  30. // 字典标签组件
  31. import DictTag from '@/components/DictTag'
  32. // 头部标签组件
  33. import VueMeta from 'vue-meta'
  34. // 字典数据组件
  35. import DictData from '@/components/DictData'
  36. // 将自动注册所有组件为全局组件
  37. import dataV from '@jiaminghi/data-view'
  38. import * as echarts from 'echarts';
  39. //页面转PDF
  40. import htmlToPdf from '@/utils/htmlToPdf'
  41. Vue.use(htmlToPdf)
  42. Vue.use(dataV)
  43. // 全局方法挂载
  44. Vue.prototype.getDicts = getDicts
  45. Vue.prototype.getConfigKey = getConfigKey
  46. Vue.prototype.parseTime = parseTime
  47. Vue.prototype.resetForm = resetForm
  48. Vue.prototype.addDateRange = addDateRange
  49. Vue.prototype.selectDictLabel = selectDictLabel
  50. Vue.prototype.selectDictLabels = selectDictLabels
  51. Vue.prototype.download = download
  52. Vue.prototype.handleTree = handleTree
  53. Vue.prototype.$echarts = echarts
  54. // 全局组件挂载
  55. Vue.component('DictTag', DictTag)
  56. Vue.component('Pagination', Pagination)
  57. Vue.component('RightToolbar', RightToolbar)
  58. Vue.component('Editor', Editor)
  59. Vue.component('FileUpload', FileUpload)
  60. Vue.component('ImageUpload', ImageUpload)
  61. Vue.component('ImagePreview', ImagePreview)
  62. Vue.use(directive)
  63. Vue.use(plugins)
  64. Vue.use(VueMeta)
  65. DictData.install()
  66. /**
  67. * If you don't want to use mock-server
  68. * you want to use MockJs for mock api
  69. * you can execute: mockXHR()
  70. *
  71. * Currently MockJs will be used in the production environment,
  72. * please remove it before going online! ! !
  73. */
  74. Vue.use(Element, {
  75. size: Cookies.get('size') || 'medium' // set element-ui default size
  76. })
  77. Vue.config.productionTip = false
  78. new Vue({
  79. el: '#app',
  80. router,
  81. store,
  82. render: h => h(App)
  83. })