main.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. import Vue from 'vue'
  2. import axios from './router/axios'
  3. import VueAxios from 'vue-axios'
  4. import App from './App'
  5. import router from './router/router'
  6. import Pagination from './components/Pagination'
  7. import './permission' // 权限
  8. import './error' // 日志
  9. import './cache' //页面缓存
  10. import store from './store'
  11. import { loadStyle, getFormatDate, exportFile } from './util/util'
  12. import * as urls from '@/config/env'
  13. import Element from 'element-ui'
  14. import { iconfontUrl, iconfontVersion } from '@/config/env'
  15. import i18n from './lang' // Internationalization
  16. import './styles/common.scss'
  17. import './styles/index.scss'
  18. import basicBlock from './components/basic-block/main'
  19. import basicContainer from './components/basic-container/main'
  20. import thirdRegister from './components/third-register/main'
  21. import avueUeditor from 'avue-plugin-ueditor'
  22. import website from '@/config/website'
  23. import crudCommon from '@/mixins/crud'
  24. import { currencyGainSymbol } from '@/api/currencyType/currency'
  25. import md5 from 'js-md5'
  26. import {
  27. selectDictLabel,
  28. getDictToLabel,
  29. selectConstantLabel,
  30. resetForm,
  31. moneyFormat,
  32. sort,
  33. getFileType,
  34. handleTree,
  35. selectConstantsLabel,
  36. selectConstantsLabelRemark,
  37. selectTenantLabel,
  38. accordingToValueShowLabel,
  39. feedbackLabel,
  40. onPreview,
  41. } from '@/util/saas'
  42. // import { getDays, getNearDays, dateFormat } from '@/util/date'
  43. import { getDays, getNearDays, pickerOptions } from '@/util/date'
  44. import Prevent from '@/plugs/preventRepeatClick'
  45. import Print from '@/plugs/print.js' //打印功能
  46. import 'echarts-gl'
  47. import './world.js'
  48. import './icons'
  49. import animate from 'animate.css' //动画
  50. import VueLazyload from 'vue-lazyload' //图片懒加载
  51. import Contextmenu from 'vue-contextmenujs' //右击菜单
  52. import ViewUI from 'view-design'
  53. import VueWechatTitle from 'vue-wechat-title'
  54. import './util/table2excel' // global table2excel
  55. // import 'view-design/dist/styles/iview.css';
  56. import VueBarcode from 'vue-barcode'
  57. import htmlToPdf from "@/util/htmlToPdf"
  58. Vue.prototype.selectConstantsLabel = selectConstantsLabel
  59. Vue.prototype.selectConstantsLabelRemark = selectConstantsLabelRemark
  60. Vue.prototype.selectTenantLabel = selectTenantLabel
  61. Vue.prototype.feedbackLabel = feedbackLabel
  62. Vue.prototype.onPreview = onPreview
  63. // 全局方法挂载,树型
  64. Vue.prototype.handleTree = handleTree
  65. //全局方法挂载,前缀货币计算
  66. Vue.prototype.currencyGainSymbol = currencyGainSymbol
  67. Vue.prototype.selectDictLabel = selectDictLabel
  68. Vue.prototype.selectConstantLabel = selectConstantLabel
  69. Vue.prototype.getDictToLabel = getDictToLabel
  70. Vue.prototype.getFormatDate = getFormatDate
  71. Vue.prototype.exportFile = exportFile
  72. Vue.prototype.website = website
  73. Vue.prototype.resetForm = resetForm
  74. Vue.prototype.moneyFormat = moneyFormat
  75. Vue.prototype.sort = sort
  76. Vue.prototype.getFileType = getFileType
  77. Vue.prototype.accordingToValueShowLabel = accordingToValueShowLabel
  78. // Vue.prototype.dateFormat = dateFormat 会与element底层处理日期的函数命名冲突
  79. Vue.prototype.getDays = getDays
  80. Vue.prototype.getNearDays = getNearDays
  81. Vue.prototype.pickerOptions = pickerOptions
  82. //全局引入md5加密
  83. Vue.prototype.$md5 = md5
  84. // 注册全局crud驱动
  85. window.$crudCommon = crudCommon
  86. // 加载Vue拓展
  87. Vue.use(router)
  88. Vue.use(VueAxios, axios)
  89. Vue.use(Pagination)
  90. Vue.use(Print)
  91. Vue.use(Prevent)
  92. Vue.use(animate)
  93. Vue.use(Contextmenu)
  94. Vue.use(ViewUI)
  95. Vue.use(VueWechatTitle)
  96. Vue.use(htmlToPdf)
  97. const errImg = require('./assets/images/empty.png')
  98. // const loadingImg = require('./assets/images/loading-spin.svg')
  99. Vue.use(VueLazyload, {
  100. preLoad: 1.3,
  101. error: errImg,
  102. // loading: loadingImg,
  103. attempt: 1,
  104. listenEvents: ['scroll'],
  105. })
  106. Element.Select.props.filterable = {
  107. type: Boolean,
  108. default: true,
  109. }
  110. Element.Select.props.clearable = {
  111. type: Boolean,
  112. default: true,
  113. }
  114. Element.Dialog.props.closeOnClickModal.default = false
  115. Vue.use(Element, {
  116. i18n: (key, value) => i18n.t(key, value),
  117. })
  118. Vue.use(window.AVUE, {
  119. size: 'small',
  120. tableSize: 'small',
  121. calcHeight: 65,
  122. i18n: (key, value) => i18n.t(key, value),
  123. })
  124. // 注册全局容器
  125. Vue.component('basicContainer', basicContainer)
  126. Vue.component('basicBlock', basicBlock)
  127. Vue.component('thirdRegister', thirdRegister)
  128. Vue.component('avueUeditor', avueUeditor)
  129. Vue.component('Pagination', Pagination)
  130. Vue.component('barcode', VueBarcode)
  131. // 加载相关url地址
  132. Object.keys(urls).forEach((key) => {
  133. Vue.prototype[key] = urls[key]
  134. })
  135. // 动态加载阿里云字体库
  136. iconfontVersion.forEach((ele) => {
  137. loadStyle(iconfontUrl.replace('$key', ele))
  138. })
  139. Vue.prototype.msgSuccess = function (msg) {
  140. this.$message({ showClose: true, message: msg, type: 'success' })
  141. }
  142. Vue.prototype.msgError = function (msg) {
  143. this.$message({ showClose: true, message: msg, type: 'error' })
  144. }
  145. Vue.prototype.msgWarning = function (msg) {
  146. this.$message({ showClose: true, message: msg, type: 'warning' })
  147. }
  148. Vue.prototype.msgInfo = function (msg) {
  149. this.$message.info(msg)
  150. }
  151. Vue.config.productionTip = false
  152. new Vue({
  153. router,
  154. store,
  155. i18n,
  156. data: function () {
  157. return {
  158. search: '',
  159. mailbox: '',
  160. mailRefresh: '',
  161. busiId: '',
  162. mailHost: '',
  163. formPath: '',
  164. }
  165. },
  166. render: (h) => h(App),
  167. }).$mount('#app')