main.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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/supervision.scss' // supervision 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 './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 ,getNowWeek} from "@/utils/supervision";
  17. // 分页组件
  18. import Pagination from "@/components/Pagination";
  19. // 自定义表格工具组件
  20. import RightToolbar from "@/components/RightToolbar"
  21. // 富文本组件
  22. import Editor from "@/components/Editor"
  23. // 文件上传组件
  24. import FileUpload from "@/components/FileUpload"
  25. // 图片上传组件
  26. import ImageUpload from "@/components/ImageUpload"
  27. // 字典标签组件
  28. import DictTag from '@/components/DictTag'
  29. // 头部标签组件
  30. import VueMeta from 'vue-meta'
  31. // 字典数据组件
  32. import DictData from '@/components/DictData'
  33. // 公共样式
  34. import '@/assets/styles/global.css'
  35. // 全局挂载 VueQuillEditor
  36. import VueQuillEditor from 'vue-quill-editor'
  37. import 'quill/dist/quill.core.css'
  38. import 'quill/dist/quill.snow.css'
  39. import 'quill/dist/quill.bubble.css'
  40. import '@/utils/lodJs.js'
  41. // 全局方法挂载
  42. Vue.prototype.getDicts = getDicts
  43. Vue.prototype.getConfigKey = getConfigKey
  44. Vue.prototype.parseTime = parseTime
  45. Vue.prototype.resetForm = resetForm
  46. Vue.prototype.addDateRange = addDateRange
  47. Vue.prototype.selectDictLabel = selectDictLabel
  48. Vue.prototype.selectDictLabels = selectDictLabels
  49. Vue.prototype.handleTree = handleTree
  50. Vue.prototype.getNowWeek = getNowWeek
  51. // originVal 后台返回的中国标准时间
  52. Vue.filter('dataFormat', originVal => {
  53. const dt = new Date(originVal)
  54. if(originVal) {
  55. const y = dt.getFullYear()
  56. const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  57. const d = (dt.getDate() + '').padStart(2, '0')
  58. return `${y}-${m}-${d}`
  59. }
  60. })
  61. // 全局组件挂载
  62. Vue.component('DictTag', DictTag)
  63. Vue.component('Pagination', Pagination)
  64. Vue.component('RightToolbar', RightToolbar)
  65. Vue.component('Editor', Editor)
  66. Vue.component('FileUpload', FileUpload)
  67. Vue.component('ImageUpload', ImageUpload)
  68. Vue.use(directive)
  69. Vue.use(plugins)
  70. Vue.use(VueMeta)
  71. Vue.use(VueQuillEditor)
  72. DictData.install()
  73. /**
  74. * If you don't want to use mock-server
  75. * you want to use MockJs for mock api
  76. * you can execute: mockXHR()
  77. *
  78. * Currently MockJs will be used in the production environment,
  79. * please remove it before going online! ! !
  80. */
  81. Vue.use(Element, {
  82. size: Cookies.get('size') || 'medium' // set element-ui default size
  83. })
  84. Vue.config.productionTip = false
  85. new Vue({
  86. el: '#app',
  87. router,
  88. store,
  89. render: h => h(App)
  90. })