main.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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/huyi.scss' // huyi css
  7. import App from './App'
  8. import store from './store'
  9. import router from './router'
  10. import permission from './directive/permission'
  11. import { download } from '@/utils/request'
  12. import './assets/icons' // icon
  13. import './permission' // permission control
  14. import { getDicts } from "@/api/system/dict/data";
  15. import { getConfigKey } from "@/api/system/config";
  16. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/huyi";
  17. import Pagination from "@/components/Pagination";
  18. //自定义表格工具扩展
  19. import RightToolbar from "@/components/RightToolbar"
  20. // 全局方法挂载
  21. Vue.prototype.getDicts = getDicts
  22. Vue.prototype.getConfigKey = getConfigKey
  23. Vue.prototype.parseTime = parseTime
  24. Vue.prototype.resetForm = resetForm
  25. Vue.prototype.addDateRange = addDateRange
  26. Vue.prototype.selectDictLabel = selectDictLabel
  27. Vue.prototype.selectDictLabels = selectDictLabels
  28. Vue.prototype.download = download
  29. Vue.prototype.handleTree = handleTree
  30. Vue.prototype.msgSuccess = function (msg) {
  31. this.$message({ showClose: true, message: msg, type: "success" });
  32. }
  33. Vue.prototype.msgError = function (msg) {
  34. this.$message({ showClose: true, message: msg, type: "error" });
  35. }
  36. Vue.prototype.msgInfo = function (msg) {
  37. this.$message.info(msg);
  38. }
  39. // 全局组件挂载
  40. Vue.component('Pagination', Pagination)
  41. Vue.component('RightToolbar', RightToolbar)
  42. Vue.use(permission)
  43. //拖拽
  44. import VueI18n from 'vue-i18n'
  45. import enLocale from 'element-ui/lib/locale/lang/en'
  46. import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
  47. Vue.use(VueI18n)
  48. Vue.locale('en-US', {...enLocale })
  49. Vue.locale('zh-CN', {...zhLocale })
  50. Vue.config.lang = 'zh-CN'
  51. import FormMaking from './index'
  52. import CustomComponent from './views/tool/model/CustomComponent.vue'
  53. Vue.use(FormMaking, {
  54. components: [{
  55. name: 'custom-width-height',
  56. component: CustomComponent
  57. }]
  58. })
  59. //阿里icon图标
  60. import './assets/icon/iconfont.css'
  61. //echarts图表
  62. import echarts from 'echarts'
  63. Vue.prototype.$echarts = echarts;
  64. /**
  65. * If you don't want to use mock-server
  66. * you want to use MockJs for mock api
  67. * you can execute: mockXHR()
  68. *
  69. * Currently MockJs will be used in the production environment,
  70. * please remove it before going online! ! !
  71. */
  72. Vue.use(Element, {
  73. size: Cookies.get('size') || 'medium' // set element-ui default size
  74. })
  75. Vue.config.productionTip = false
  76. new Vue({
  77. el: '#app',
  78. router,
  79. store,
  80. render: h => h(App)
  81. })