main.js 5.3 KB

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