main.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import Vue from 'vue'
  2. import 'normalize.css/normalize.css' // 用于加载页面时上面的加载动画条。
  3. import Element from 'element-ui'
  4. import 'element-ui/lib/theme-chalk/index.css';
  5. import '@/styles/index.scss'
  6. import moment from 'moment' // 时间库
  7. import App from './App'
  8. import router from './router'
  9. import store from './store'
  10. import {getDept,openUrl, getToken, getTyps, getTypsName, supremeAuthority, getUserData, getEmployeeMap,getEmployeeMapAll,getEmployeeMapItem,getIsIdentity,getCache,setCache,removeCache,returnDeptName,getIsAdministrator} from '@/utils/auth'
  11. import './performanceSet' // 绩效系统相关配置
  12. import {onFilePreView } from '@/okr/utils/auth';
  13. import { VueOkrTree } from "vue-okr-tree";
  14. import "vue-okr-tree/dist/vue-okr-tree.css";
  15. import 'shepherd.js/dist/css/shepherd.css';
  16. import './icons'
  17. import './permission'
  18. import * as filters from '@/utils/filters'
  19. import axiosKq from '@/utils/axiosKq'
  20. import axiosUser from '@/utils/axiosUser'
  21. import axios from '@/utils/axios'
  22. import axiosKc from '@/utils/axiosKc'
  23. import * as socketApi from './api/websocket'
  24. import * as socketApiTow from './api/websocketTow'
  25. import ECharts from 'echarts';
  26. // 头像
  27. import UserImage from '@/components/UserImage'
  28. import noData from '@/components/noData'
  29. import BrawerBox from '@/performance/components/public/BrawerBox';
  30. import TaskItem from '@/okr/components/public/TaskItem'; //任务内容
  31. Vue.component('userImage', UserImage)
  32. Vue.component('NoData', noData)
  33. Vue.component('BrawerBox', BrawerBox)
  34. Vue.component('TaskItem', TaskItem)
  35. Vue.component('VueOkrTree', VueOkrTree)
  36. Vue.use(Element, {
  37. size: 'medium',
  38. })
  39. Vue.prototype.$echarts = ECharts
  40. Vue.prototype.$axios = axios
  41. Vue.prototype.$axiosUser = axiosUser
  42. Vue.prototype.$axiosKq = axiosKq
  43. Vue.prototype.$axiosKc = axiosKc
  44. Vue.prototype.$moment = moment
  45. Vue.prototype.$getToken = getToken
  46. Vue.prototype.$serveAd = process.env.SERVE_AD
  47. Vue.prototype.$serverdomain= process.env.BASE_API
  48. Vue.prototype.$getIsIdentity = getIsIdentity //在积分系统里 判断是否具备某项权限
  49. Vue.prototype.$supremeAuthority = supremeAuthority //返回积分系统的最高权限
  50. Vue.prototype.$getIsAdministrator = getIsAdministrator //最高权限 平台管理者
  51. Vue.prototype.$getTypsName = getTypsName
  52. Vue.prototype.$getTyps = getTyps
  53. Vue.prototype.$userInfo = getUserData
  54. Vue.prototype.$getEmployeeMap = getEmployeeMap //人员列表
  55. Vue.prototype.$getEmployeeMapAll = getEmployeeMapAll //人员列表(包含已删除的)
  56. Vue.prototype.$getEmployeeMapItem = getEmployeeMapItem //查询人员信息(包含已删除的)
  57. Vue.prototype.$getCache = getCache
  58. Vue.prototype.$setCache = setCache
  59. Vue.prototype.$removeCache = removeCache
  60. Vue.prototype.$socketApi = socketApi //长连接
  61. Vue.prototype.$socketApiTow = socketApiTow //长连接
  62. Vue.prototype.$returnDeptName = returnDeptName
  63. Vue.prototype.$openUrl = openUrl
  64. Vue.prototype.$getDept = getDept
  65. // okr
  66. Vue.prototype.$onFilePreView = onFilePreView
  67. // 上传相关
  68. Vue.prototype.$action = 'https://integralsys.oss-cn-shenzhen.aliyuncs.com'
  69. Vue.prototype.$acceptImg = 'image/jpeg,image/png'
  70. Vue.prototype.$acceptFile = 'application/pdf,application/vnd.ms-excel,application/msword,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document'
  71. Vue.prototype.$acceptImgFile='image/jpeg,image/png,application/pdf,application/vnd.ms-excel,application/msword,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document'
  72. Vue.prototype.$xtoken={ 'X-Token': getToken() };
  73. Vue.directive('dragscroll', function (el) {
  74. el.onmousedown = function (ev) {
  75. const disX = ev.clientX
  76. const disY = ev.clientY
  77. const originalScrollLeft = el.scrollLeft
  78. const originalScrollTop = el.scrollTop
  79. const originalScrollBehavior = el.style['scroll-behavior']
  80. const originalPointerEvents = el.style['pointer-events']
  81. // auto: 默认值,表示滚动框立即滚动到指定位置。
  82. el.style['scroll-behavior'] = 'auto'
  83. el.style['cursor'] = 'grabbing'
  84. // 鼠标移动事件是监听的整个document,这样可以使鼠标能够在元素外部移动的时候也能实现拖动
  85. document.onmousemove = function (ev) {
  86. ev.preventDefault()
  87. // 计算拖拽的偏移距离
  88. const distanceX = ev.clientX - disX
  89. const distanceY = ev.clientY - disY
  90. el.scrollTo(originalScrollLeft - distanceX, originalScrollTop - distanceY)
  91. // 在鼠标拖动的时候将点击事件屏蔽掉
  92. // el.style['pointer-events'] = 'none'
  93. // document.body.style['cursor'] = 'grabbing'
  94. }
  95. document.onmouseup = function () {
  96. // el.style['scroll-behavior'] = originalScrollBehavior
  97. // el.style['pointer-events'] = originalPointerEvents
  98. // el.style['cursor'] = 'grab'
  99. document.onmousemove = null
  100. document.onmouseup = null
  101. }
  102. }
  103. })
  104. Object.keys(filters).forEach(key => {
  105. Vue.filter(key, filters[key])
  106. })
  107. Vue.config.productionTip = false
  108. new Vue({
  109. el: '#app',
  110. router,
  111. store,
  112. render: h => h(App)
  113. })