main.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. import officeConvert from '@/utils/officeConvert.js' //全局预览方法
  27. //import { Loading } from 'element-ui'; //全局loading
  28. // 按需引入vue-awesome图标
  29. import Icon from 'vue-awesome/components/Icon';
  30. import 'vue-awesome/icons/chart-bar.js';
  31. import 'vue-awesome/icons/chart-area.js';
  32. import 'vue-awesome/icons/chart-pie.js';
  33. import 'vue-awesome/icons/chart-line.js';
  34. import 'vue-awesome/icons/align-left.js';
  35. import '@/assets/iconfont/iconfont.css'
  36. import '@/assets/iconfont/iconfont.js'
  37. // 适配flex
  38. import { UTable, UTableColumn } from 'umy-ui';
  39. // 字典标签组件
  40. import DictTag from '@/components/DictTag'
  41. // 字典数据组件
  42. import DictData from '@/components/DictData'
  43. // 函数节流
  44. import throttle from "@/utils/throttle";
  45. import {download2} from "@/utils/request";
  46. Vue.prototype.$throttle = throttle;
  47. // 全局注册图标
  48. Vue.component('icon', Icon);
  49. // 全局方法挂载
  50. Vue.prototype.bus = new Vue()
  51. Vue.prototype.getDicts = getDicts
  52. Vue.prototype.getConfigKey = getConfigKey
  53. Vue.prototype.parseTime = parseTime
  54. Vue.prototype.resetForm = resetForm
  55. Vue.prototype.addDateRange = addDateRange
  56. Vue.prototype.selectDictLabel = selectDictLabel
  57. Vue.prototype.selectDictLabels = selectDictLabels
  58. Vue.prototype.download = download
  59. Vue.prototype.download2 = download2
  60. Vue.prototype.handleTree = handleTree
  61. Vue.prototype.echarts = echarts
  62. Vue.prototype.officeConvert = officeConvert
  63. Vue.prototype.msgSuccess = function (msg) {
  64. this.$message({ showClose: true, message: msg, type: "success" });
  65. }
  66. Vue.prototype.msgError = function (msg) {
  67. this.$message({ showClose: true, message: msg, type: "error" });
  68. }
  69. Vue.prototype.msgInfo = function (msg) {
  70. this.$message.info(msg);
  71. }
  72. // 全局组件挂载
  73. Vue.component('DictTag', DictTag)
  74. Vue.component('Pagination', Pagination)
  75. Vue.component('RightToolbar', RightToolbar)
  76. Vue.use(permission)
  77. Vue.use(dataV)
  78. Vue.use(UTable)
  79. Vue.use(UTableColumn)
  80. DictData.install()
  81. /**
  82. * If you don't want to use mock-server
  83. * you want to use MockJs for mock api
  84. * you can execute: mockXHR()
  85. *
  86. * Currently MockJs will be used in the production environment,
  87. * please remove it before going online! ! !
  88. */
  89. Vue.use(Element, {
  90. size: 'mini', // set element-ui default size
  91. i18n: (key, value) => i18n.t(key, value)
  92. })
  93. Vue.config.productionTip = false
  94. new Vue({
  95. el: '#app',
  96. router,
  97. store,
  98. i18n,
  99. render: h => h(App)
  100. })