main.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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/ruoyi.scss' // ruoyi css
  7. import App from './App'
  8. import store from './store'
  9. import router from './router'
  10. import directive from './directive' //directive
  11. import echarts from 'echarts'
  12. import './assets/icons' // icon
  13. import './permission' // permission control
  14. import { getDicts } from "@/api/system/dict/data";
  15. import { getConfigKey } from "@/api/system/config";
  16. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
  17. import Pagination from "@/components/Pagination";
  18. // 自定义表格工具组件
  19. import RightToolbar from "@/components/RightToolbar"
  20. // 富文本组件
  21. import Editor from "@/components/Editor"
  22. // 文件上传组件
  23. import FileUpload from "@/components/FileUpload"
  24. // 图片上传组件
  25. import ImageUpload from "@/components/ImageUpload"
  26. // 字典标签组件
  27. import DictTag from '@/components/DictTag'
  28. // 头部标签组件
  29. import VueMeta from 'vue-meta'
  30. // 全局方法挂载
  31. Vue.prototype.getDicts = getDicts
  32. Vue.prototype.getConfigKey = getConfigKey
  33. Vue.prototype.parseTime = parseTime
  34. Vue.prototype.resetForm = resetForm
  35. Vue.prototype.addDateRange = addDateRange
  36. Vue.prototype.selectDictLabel = selectDictLabel
  37. Vue.prototype.selectDictLabels = selectDictLabels
  38. Vue.prototype.download = download
  39. Vue.prototype.handleTree = handleTree
  40. Vue.prototype.$echarts = echarts
  41. Vue.prototype.msgSuccess = function (msg) {
  42. this.$message({ showClose: true, message: msg, type: "success" });
  43. }
  44. Vue.prototype.msgError = function (msg) {
  45. this.$message({ showClose: true, message: msg, type: "error" });
  46. }
  47. Vue.prototype.msgInfo = function (msg) {
  48. this.$message.info(msg);
  49. }
  50. // 全局组件挂载
  51. Vue.component('DictTag', DictTag)
  52. Vue.component('Pagination', Pagination)
  53. Vue.component('RightToolbar', RightToolbar)
  54. Vue.component('Editor', Editor)
  55. Vue.component('FileUpload', FileUpload)
  56. Vue.component('ImageUpload', ImageUpload)
  57. Vue.use(directive)
  58. Vue.use(VueMeta)
  59. /**
  60. * If you don't want to use mock-server
  61. * you want to use MockJs for mock api
  62. * you can execute: mockXHR()
  63. *
  64. * Currently MockJs will be used in the production environment,
  65. * please remove it before going online! ! !
  66. */
  67. Vue.use(Element, {
  68. size: Cookies.get('size') || 'medium' // set element-ui default size
  69. })
  70. Vue.config.productionTip = false
  71. new Vue({
  72. el: '#app',
  73. router,
  74. store,
  75. render: h => h(App)
  76. })