main.js 2.3 KB

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