main.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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/ruoyi.scss' // ruoyi css
  7. import App from './App'
  8. import store from './store'
  9. import router from './router'
  10. import directive from './directive' // directive
  11. import plugins from './plugins' // plugins
  12. import { download,downloadJson } from '@/utils/request'
  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, handleTree } from "@/utils/ruoyi";
  18. // 分页组件
  19. import Pagination from "@/components/Pagination";
  20. import Page from "@/components/Page";
  21. // 自定义表格工具组件
  22. import RightToolbar from "@/components/RightToolbar"
  23. // 富文本组件
  24. import Editor from "@/components/Editor"
  25. // 文件上传组件
  26. import FileUpload from "@/components/FileUpload"
  27. // 图片上传组件
  28. import ImageUpload from "@/components/ImageUpload"
  29. // 图片预览组件
  30. import ImagePreview from "@/components/ImagePreview"
  31. // 字典标签组件
  32. import DictTag from '@/components/DictTag'
  33. // 头部标签组件
  34. import VueMeta from 'vue-meta'
  35. // 字典数据组件
  36. import DictData from '@/components/DictData'
  37. import {getUserInfo} from "@/utils/auth";
  38. import {
  39. getUrlParam,
  40. isEmpty,
  41. collectClothPrinter,
  42. sendClothPrinter,
  43. labelPrinter,
  44. barCodePrinter,
  45. laundryPrinter,
  46. goodsPrinter,
  47. formatDate
  48. } from "@/utils";
  49. // 全局方法挂载
  50. Vue.prototype.getUserInfo = getUserInfo
  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.downloadJson = downloadJson
  60. Vue.prototype.handleTree = handleTree
  61. Vue.prototype.getUrlParam = getUrlParam
  62. Vue.prototype.isEmpty = isEmpty
  63. Vue.prototype.collectClothPrinter = collectClothPrinter
  64. Vue.prototype.sendClothPrinter = sendClothPrinter
  65. Vue.prototype.labelPrinter = labelPrinter
  66. Vue.prototype.barCodePrinter = barCodePrinter
  67. Vue.prototype.laundryPrinter = laundryPrinter
  68. Vue.prototype.goodsPrinter = goodsPrinter
  69. Vue.prototype.formatDates = formatDate
  70. // 全局组件挂载
  71. Vue.component('DictTag', DictTag)
  72. Vue.component('Pagination', Pagination)
  73. Vue.component('Page', Page)
  74. Vue.component('RightToolbar', RightToolbar)
  75. Vue.component('Editor', Editor)
  76. Vue.component('FileUpload', FileUpload)
  77. Vue.component('ImageUpload', ImageUpload)
  78. Vue.component('ImagePreview', ImagePreview)
  79. Vue.use(directive)
  80. Vue.use(plugins)
  81. Vue.use(VueMeta)
  82. DictData.install()
  83. /**
  84. * If you don't want to use mock-server
  85. * you want to use MockJs for mock api
  86. * you can execute: mockXHR()
  87. *
  88. * Currently MockJs will be used in the production environment,
  89. * please remove it before going online! ! !
  90. */
  91. Vue.use(Element, {
  92. size: Cookies.get('size') || 'medium' // set element-ui default size
  93. })
  94. Vue.config.productionTip = false
  95. new Vue({
  96. el: '#app',
  97. router,
  98. store,
  99. render: h => h(App)
  100. })