main.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 plugins from './plugins' // plugins
  12. import { download } from '@/utils/request'
  13. import './assets/icons' // icon
  14. import './permission' // permission control
  15. import { getDicts } from "@/api/system/dict/data";
  16. import { getConfigKey, updateConfigByKey } from "@/api/system/config";
  17. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree,addDateRangeAvue } from "@/utils/ruoyi";
  18. // 分页组件
  19. import Pagination from "@/components/Pagination";
  20. // 自定义表格工具组件
  21. import RightToolbar from "@/components/RightToolbar"
  22. // 富文本组件
  23. import Editor from "@/components/Editor"
  24. // 文件上传组件
  25. import FileUpload from "@/components/FileUpload"
  26. // 图片上传组件
  27. import ImageUpload from "@/components/ImageUpload"
  28. import ObsImageUpload from "@/components/ObsImageUpload/index.vue"
  29. import ObsFileUpload from "@/components/ObsImageUpload/indexFile.vue"
  30. // 图片预览组件
  31. import ImagePreview from "@/components/ImagePreview"
  32. // 字典标签组件
  33. import DictTag from '@/components/DictTag'
  34. // 头部标签组件
  35. import VueMeta from 'vue-meta'
  36. // 字典数据组件
  37. import DictData from '@/components/DictData'
  38. import Avue from '@smallwei/avue';
  39. import '@smallwei/avue/lib/index.css';
  40. // 全局方法挂载
  41. Vue.prototype.getDicts = getDicts
  42. Vue.prototype.getConfigKey = getConfigKey
  43. Vue.prototype.updateConfigByKey = updateConfigByKey
  44. Vue.prototype.parseTime = parseTime
  45. Vue.prototype.resetForm = resetForm
  46. Vue.prototype.addDateRange = addDateRange
  47. Vue.prototype.addDateRangeAvue = addDateRangeAvue
  48. Vue.prototype.selectDictLabel = selectDictLabel
  49. Vue.prototype.selectDictLabels = selectDictLabels
  50. Vue.prototype.download = download
  51. Vue.prototype.handleTree = handleTree
  52. // 全局组件挂载
  53. Vue.component('DictTag', DictTag)
  54. Vue.component('Pagination', Pagination)
  55. Vue.component('RightToolbar', RightToolbar)
  56. Vue.component('Editor', Editor)
  57. Vue.component('FileUpload', FileUpload)
  58. Vue.component('ObsFileUpload', ObsFileUpload)
  59. Vue.component('ImageUpload', ImageUpload)
  60. Vue.component('ObsImageUpload', ObsImageUpload)
  61. Vue.component('ImagePreview', ImagePreview)
  62. Vue.use(directive)
  63. Vue.use(plugins)
  64. Vue.use(VueMeta)
  65. Vue.use(Avue);
  66. DictData.install()
  67. /**
  68. * If you don't want to use mock-server
  69. * you want to use MockJs for mock api
  70. * you can execute: mockXHR()
  71. *
  72. * Currently MockJs will be used in the production environment,
  73. * please remove it before going online! ! !
  74. */
  75. // 修改 el-dialog 默认点击遮照为不关闭
  76. Element.Dialog.props.closeOnClickModal.default = false
  77. Vue.use(Element, {
  78. size: Cookies.get('size') || 'medium' // set element-ui default size
  79. })
  80. Vue.config.productionTip = false
  81. new Vue({
  82. el: '#app',
  83. router,
  84. store,
  85. render: h => h(App)
  86. })