main.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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/system/config";
  15. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
  16. import Pagination from "@/components/Pagination";
  17. // 自定义表格工具扩展
  18. import RightToolbar from "@/components/RightToolbar"
  19. //自定义列表组件
  20. import listComponent from '@/combination/listComponent'
  21. Vue.component('listComponent', listComponent)
  22. import MainForm from '@/combination/MainForm'
  23. Vue.component('MainForm', MainForm)
  24. import formComponent from '@/combination/formComponent'
  25. Vue.component('formComponent', formComponent)
  26. import draggable from "vuedraggable";
  27. Vue.component('draggable', draggable)
  28. import Print from '@/combination/plugs/print'
  29. Vue.use(Print) // 注册
  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.msgSuccess = function (msg) {
  41. this.$message({ showClose: true, message: msg, type: "success" });
  42. }
  43. Vue.prototype.msgError = function (msg) {
  44. this.$message({ showClose: true, message: msg, type: "error" });
  45. }
  46. Vue.prototype.msgInfo = function (msg) {
  47. this.$message.info(msg);
  48. }
  49. // 全局组件挂载
  50. Vue.component('Pagination', Pagination)
  51. Vue.component('RightToolbar', RightToolbar)
  52. Vue.use(permission)
  53. /**
  54. * If you don't want to use mock-server
  55. * you want to use MockJs for mock api
  56. * you can execute: mockXHR()
  57. *
  58. * Currently MockJs will be used in the production environment,
  59. * please remove it before going online! ! !
  60. */
  61. Vue.use(Element, {
  62. size: Cookies.get('size') || 'medium' // set element-ui default size
  63. })
  64. Vue.config.productionTip = false
  65. new Vue({
  66. el: '#app',
  67. router,
  68. store,
  69. render: h => h(App)
  70. })