main.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. import Vue from 'vue'
  2. import Element from 'element-ui'
  3. import './assets/styles/element-variables.scss'
  4. import '@/assets/styles/index.scss' // global css
  5. import '@/assets/styles/ruoyi.scss' // ruoyi css
  6. import App from './App'
  7. import store from './store'
  8. import router from './router'
  9. import directive from './directive' // directive
  10. import plugins from './plugins' // plugins
  11. import { download } from '@/utils/request'
  12. import './assets/icons' // icon
  13. import './permission' // permission control
  14. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  15. import { getDicts } from "@/api/system/dict/data";
  16. import { getConfigKey } from "@/api/system/config";
  17. import {
  18. parseTime,
  19. resetForm,
  20. addDateRange,
  21. selectDictLabel,
  22. selectDictLabels,
  23. handleTree,
  24. formatTime, imageUrl
  25. } from "@/utils/ruoyi";
  26. // 分页组件
  27. import Pagination from "@/components/Pagination";
  28. // 自定义表格工具组件
  29. import RightToolbar from "@/components/RightToolbar"
  30. // 富文本组件
  31. import Editor from "@/components/Editor"
  32. // 文件上传组件
  33. import FileUpload from "@/components/FileUpload"
  34. // 图片上传组件
  35. import ImageUpload from "@/components/ImageUpload"
  36. // 图片预览组件
  37. import ImagePreview from "@/components/ImagePreview"
  38. // 图片预览组件
  39. import ImageListPreview from "@/components/ImageListPreview"
  40. // 字典标签组件
  41. import DictTag from '@/components/DictTag'
  42. // 头部标签组件
  43. import VueMeta from 'vue-meta'
  44. // 字典数据组件
  45. import DictData from '@/components/DictData'
  46. // 下拉tree组件
  47. import TreeSelect from "@riophae/vue-treeselect";
  48. // elementui Dialog组件
  49. import DialogCom from '@/components/elDialog/dialog.vue'
  50. //布局容器
  51. import layoutCom from '@/components/layoutContainer/index.vue'
  52. // 全局方法挂载
  53. Vue.prototype.getDicts = getDicts
  54. //根据参数键名查询参数值
  55. Vue.prototype.getConfigKey = getConfigKey
  56. //格式化时间
  57. Vue.prototype.parseTime = parseTime
  58. //格式化时间
  59. Vue.prototype.formatTime = formatTime
  60. //重置表单
  61. Vue.prototype.resetForm = resetForm
  62. //添加日期范围
  63. Vue.prototype.addDateRange = addDateRange
  64. //回显数据字典
  65. Vue.prototype.selectDictLabel = selectDictLabel
  66. // 回显数据字典(字符串、数组)
  67. Vue.prototype.selectDictLabels = selectDictLabels
  68. Vue.prototype.download = download
  69. Vue.prototype.handleTree = handleTree
  70. Vue.prototype.imageUrl = imageUrl
  71. // 全局组件挂载
  72. Vue.component('DictTag', DictTag)
  73. Vue.component('Pagination', Pagination)
  74. Vue.component('RightToolbar', RightToolbar)
  75. Vue.component('Editor', Editor)
  76. Vue.component('FileUpload', FileUpload)
  77. Vue.component('ImageUpload', ImageUpload)
  78. Vue.component('ImagePreview', ImagePreview)
  79. Vue.component('ImageListPreview', ImageListPreview)
  80. Vue.component('TreeSelect', TreeSelect)
  81. Vue.component('DialogCom', DialogCom)
  82. Vue.component('layoutCom', layoutCom)
  83. Vue.use(directive)
  84. Vue.use(plugins)
  85. Vue.use(VueMeta)
  86. DictData.install()
  87. /**
  88. * If you don't want to use mock-server
  89. * you want to use MockJs for mock api
  90. * you can execute: mockXHR()
  91. *
  92. * Currently MockJs will be used in the production environment,
  93. * please remove it before going online! ! !
  94. */
  95. Vue.use(Element, {
  96. size: sessionStorage.getItem('size') || 'medium' // set element-ui default size
  97. })
  98. Vue.config.productionTip = false
  99. new Vue({
  100. el: '#app',
  101. router,
  102. store,
  103. render: h => h(App)
  104. })