main.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. import { queryPageStatus } from "@/utils/pageStatus";
  22. // 全局方法挂载
  23. Vue.prototype.getDicts = getDicts
  24. Vue.prototype.getConfigKey = getConfigKey
  25. Vue.prototype.parseTime = parseTime
  26. Vue.prototype.resetForm = resetForm
  27. Vue.prototype.addDateRange = addDateRange
  28. Vue.prototype.selectDictLabel = selectDictLabel
  29. Vue.prototype.selectDictLabels = selectDictLabels
  30. Vue.prototype.download = download
  31. Vue.prototype.handleTree = handleTree
  32. Vue.prototype.msgSuccess = function (msg) {
  33. this.$message({ showClose: true, message: msg, type: "success" });
  34. }
  35. Vue.prototype.msgError = function (msg) {
  36. this.$message({ showClose: true, message: msg, type: "error" });
  37. }
  38. Vue.prototype.msgInfo = function (msg) {
  39. this.$message.info(msg);
  40. }
  41. Vue.prototype.queryPageStatus = queryPageStatus
  42. // 全局组件挂载
  43. Vue.component('Pagination', Pagination)
  44. Vue.component('RightToolbar', RightToolbar)
  45. Vue.use(permission)
  46. /**
  47. * If you don't want to use mock-server
  48. * you want to use MockJs for mock api
  49. * you can execute: mockXHR()
  50. *
  51. * Currently MockJs will be used in the production environment,
  52. * please remove it before going online! ! !
  53. */
  54. Vue.use(Element, {
  55. size: Cookies.get('size') || 'medium' // set element-ui default size
  56. })
  57. Vue.use(AFTableColumn)
  58. Vue.mixin({
  59. computed:{
  60. jiBie:()=>{
  61. return store.state.user.jiBie
  62. },
  63. deptId:()=>{
  64. return store.state.user.deptId
  65. },
  66. }
  67. })
  68. Vue.config.productionTip = false
  69. new Vue({
  70. el: '#app',
  71. router,
  72. store,
  73. render: h => h(App)
  74. })