main.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 permission from './directive/permission'
  11. import './assets/icons' // icon
  12. import './permission' // permission control
  13. import { getDicts } from "@/api/system/dict/data";
  14. import { getConfigKey } from "@/api/infra/config";
  15. import {
  16. parseTime,
  17. resetForm,
  18. addDateRange,
  19. addBeginAndEndTime,
  20. selectDictLabel,
  21. download,
  22. handleTree,
  23. downloadExcel,
  24. downloadZip
  25. } from "@/utils/ruoyi";
  26. import Pagination from "@/components/Pagination";
  27. // 自定义表格工具扩展
  28. import RightToolbar from "@/components/RightToolbar"
  29. // 代码高亮插件
  30. // import hljs from 'highlight.js'
  31. // import 'highlight.js/styles/github-gist.css'
  32. import {DICT_TYPE, getDictDataLabel, getDictDatas} from "@/utils/dict";
  33. // 全局方法挂载
  34. Vue.prototype.getDicts = getDicts
  35. Vue.prototype.getConfigKey = getConfigKey
  36. Vue.prototype.parseTime = parseTime
  37. Vue.prototype.resetForm = resetForm
  38. Vue.prototype.addDateRange = addDateRange
  39. Vue.prototype.addBeginAndEndTime = addBeginAndEndTime
  40. Vue.prototype.selectDictLabel = selectDictLabel
  41. Vue.prototype.getDictDatas = getDictDatas
  42. Vue.prototype.getDictDataLabel = getDictDataLabel
  43. Vue.prototype.DICT_TYPE = DICT_TYPE
  44. Vue.prototype.download = download
  45. Vue.prototype.downloadExcel = downloadExcel
  46. Vue.prototype.downloadZip = downloadZip
  47. Vue.prototype.handleTree = handleTree
  48. Vue.prototype.msgSuccess = function (msg) {
  49. this.$message({ showClose: true, message: msg, type: "success" });
  50. }
  51. Vue.prototype.msgError = function (msg) {
  52. this.$message({ showClose: true, message: msg, type: "error" });
  53. }
  54. Vue.prototype.msgInfo = function (msg) {
  55. this.$message.info(msg);
  56. }
  57. // 全局组件挂载
  58. Vue.component('Pagination', Pagination)
  59. Vue.component('RightToolbar', RightToolbar)
  60. Vue.use(permission)
  61. // Vue.use(hljs.vuePlugin);
  62. /**
  63. * If you don't want to use mock-server
  64. * you want to use MockJs for mock api
  65. * you can execute: mockXHR()
  66. *
  67. * Currently MockJs will be used in the production environment,
  68. * please remove it before going online! ! !
  69. */
  70. Vue.use(Element, {
  71. size: Cookies.get('size') || 'medium' // set element-ui default size
  72. })
  73. Vue.config.productionTip = false
  74. new Vue({
  75. el: '#app',
  76. router,
  77. store,
  78. render: h => h(App)
  79. })