main.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. import materialLibrary from '@/components/materialLibrary'
  4. import Element from 'element-ui'
  5. import './assets/styles/element-variables.scss'
  6. import '@/assets/styles/index.scss' // global css
  7. import '@/assets/styles/ruoyi.scss' // css
  8. import App from './App'
  9. import store from './store'
  10. import user from './store/modules/user'
  11. console.log(user)
  12. import router from './router'
  13. import permission from './directive/permission'
  14. import httpRequest from './utils/request'
  15. import './assets/icons' // icon
  16. import './permission' // permission control
  17. import { getDicts } from "@/api/system/dict/data";
  18. import { getConfigKey } from "@/api/system/config";
  19. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
  20. import Pagination from "@/components/Pagination";
  21. // 自定义表格工具扩展
  22. import RightToolbar from "@/components/RightToolbar"
  23. // 引入echarts 图表可视化处理
  24. import echarts from 'echarts';
  25. Vue.prototype.$echarts = echarts;
  26. // 全局方法挂载
  27. Vue.prototype.$http = httpRequest // ajax请求方法
  28. Vue.prototype.getDicts = getDicts
  29. Vue.prototype.getConfigKey = getConfigKey
  30. Vue.prototype.parseTime = parseTime
  31. Vue.prototype.resetForm = resetForm
  32. Vue.prototype.addDateRange = addDateRange
  33. Vue.prototype.selectDictLabel = selectDictLabel
  34. Vue.prototype.selectDictLabels = selectDictLabels
  35. Vue.prototype.download = download
  36. Vue.prototype.handleTree = handleTree
  37. Vue.prototype.sysUser = user.actions.getSysUser()
  38. Vue.prototype.msgSuccess = function (msg) {
  39. this.$message({ showClose: true, message: msg, type: "success" });
  40. }
  41. Vue.prototype.msgError = function (msg) {
  42. this.$message({ showClose: true, message: msg, type: "error" });
  43. }
  44. Vue.prototype.msgInfo = function (msg) {
  45. this.$message.info(msg);
  46. }
  47. // 全局组件挂载
  48. Vue.component('Pagination', Pagination)
  49. Vue.component('RightToolbar', RightToolbar)
  50. Vue.use(permission)
  51. /**
  52. * If you don't want to use mock-server
  53. * you want to use MockJs for mock api
  54. * you can execute: mockXHR()
  55. *
  56. * Currently MockJs will be used in the production environment,
  57. * please remove it before going online! ! !
  58. */
  59. Vue.use(Element, {
  60. size: Cookies.get('size') || 'medium' // set element-ui default size
  61. })
  62. Vue.config.productionTip = false
  63. new Vue({
  64. el: '#app',
  65. router,
  66. store,
  67. render: h => h(App)
  68. })
  69. Vue.component(
  70. 'materialLibrary', materialLibrary
  71. )