main.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 './assets/styles/element-variables.scss'
  6. import '@/assets/styles/index.scss' // global css
  7. import '@/assets/styles/ruoyi.scss' // ruoyi css
  8. import App from './App'
  9. import store from './store'
  10. import router from './router'
  11. import permission from './directive/permission'
  12. import '@/style/common.scss'
  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. import i18n from './lang'
  20. import "@/components/dialogdrag.js"
  21. import dataV from '@jiaminghi/data-view';
  22. //自定义表格工具扩展
  23. import RightToolbar from "@/components/RightToolbar"
  24. //echarts
  25. import echarts from '@/api/cpms/echarts.min.js'
  26. // 按需引入vue-awesome图标
  27. import Icon from 'vue-awesome/components/Icon';
  28. import 'vue-awesome/icons/chart-bar.js';
  29. import 'vue-awesome/icons/chart-area.js';
  30. import 'vue-awesome/icons/chart-pie.js';
  31. import 'vue-awesome/icons/chart-line.js';
  32. import 'vue-awesome/icons/align-left.js';
  33. // 适配flex
  34. // 全局注册图标
  35. Vue.component('icon', Icon);
  36. // 全局方法挂载
  37. Vue.prototype.getDicts = getDicts
  38. Vue.prototype.getConfigKey = getConfigKey
  39. Vue.prototype.parseTime = parseTime
  40. Vue.prototype.resetForm = resetForm
  41. Vue.prototype.addDateRange = addDateRange
  42. Vue.prototype.selectDictLabel = selectDictLabel
  43. Vue.prototype.selectDictLabels = selectDictLabels
  44. Vue.prototype.download = download
  45. Vue.prototype.handleTree = handleTree
  46. Vue.prototype.echarts = echarts
  47. Vue.prototype.msgSuccess = function (msg) {
  48. this.$message({ showClose: true, message: msg, type: "success" });
  49. }
  50. Vue.prototype.msgError = function (msg) {
  51. this.$message({ showClose: true, message: msg, type: "error" });
  52. }
  53. Vue.prototype.msgInfo = function (msg) {
  54. this.$message.info(msg);
  55. }
  56. // 全局组件挂载
  57. Vue.component('Pagination', Pagination)
  58. Vue.component('RightToolbar', RightToolbar)
  59. Vue.use(permission)
  60. Vue.use(dataV)
  61. /**
  62. * If you don't want to use mock-server
  63. * you want to use MockJs for mock api
  64. * you can execute: mockXHR()
  65. *
  66. * Currently MockJs will be used in the production environment,
  67. * please remove it before going online! ! !
  68. */
  69. Vue.use(Element, {
  70. size: 'mini', // set element-ui default size
  71. i18n: (key, value) => i18n.t(key, value)
  72. })
  73. Vue.config.productionTip = false
  74. new Vue({
  75. el: '#app',
  76. router,
  77. store,
  78. i18n,
  79. render: h => h(App)
  80. })