RightContent.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div :class="wrpCls" style="margin-right:16px">
  3. <a-space size="middle">
  4. <!-- <a-tooltip>
  5. <a-dropdown>
  6. <a class="ant-dropdown-link" style="color:#fff;">
  7. 切换工作台
  8. <a-icon type="down" />
  9. </a>
  10. <a-menu slot="overlay" class="setUl" style="left:-10px;top:12px; width:200px">
  11. <a-menu-item
  12. :key="item.id"
  13. v-for="(item) in portalConfigs"
  14. :style="{'background-color': defaultPortal.id === item.id ? '#f0f5ff' : '' }"
  15. style="position: relative;">
  16. <a-icon
  17. v-if="defaultPortal.id === item.id"
  18. style="left: 10px;"
  19. type="check"
  20. :style="{'color': defaultPortal.id === item.id ? '#2f54eb' : '#999999' }" />
  21. <a class="homeTit" target="_blank" @click="toIndex(item)">{{ item.name }}</a>
  22. <a-icon style="right: 8px;" type="delete" target="_blank" @click="toDesignIndex(item,'delete')"/>
  23. <a-icon style="right: 28px;" type="edit" target="_blank" @click="toDesignIndex(item)" />
  24. </a-menu-item>
  25. <a-menu-divider />
  26. <a-menu-item class="menu-operation" key="3" v-if="portalConfigs.length <=15">
  27. <a target="_blank" @click="toDesignIndex()"><a-icon type="plus" />添加工作台</a>
  28. </a-menu-item>
  29. </a-menu>
  30. </a-dropdown>
  31. </a-tooltip>-->
  32. <!-- <a-tooltip v-if="userType === '1'">
  33. <template slot="title">
  34. 控制台
  35. </template>
  36. <a-icon type="desktop" @click="toConsole" :style="{ fontSize: '18px'}" />
  37. </a-tooltip>-->
  38. <a-tooltip @click="toNotice" style="cursor:pointer">
  39. <template slot="title">
  40. 消息
  41. </template>
  42. <a-badge :count="msgCount">
  43. <a-icon type="sound" :style="{ fontSize: '18px'}" />
  44. </a-badge>
  45. </a-tooltip>
  46. <a-tooltip>
  47. <template slot="title">
  48. 换肤
  49. </template>
  50. <a-icon type="setting" @click="showColorSetting()" :style="{ fontSize: '18px'}" />
  51. </a-tooltip>
  52. <a-tooltip>
  53. <template slot="title">
  54. {{ fullScreen ? '退出全屏' : '切为全屏' }}
  55. </template>
  56. <a-icon
  57. :type="fullScreen ? 'fullscreen-exit' : 'fullscreen'"
  58. @click="toggleFullScreen"
  59. :style="{ fontSize: '18px'}" />
  60. </a-tooltip>
  61. <avatar-dropdown :menu="showMenu" :current-user="currentUser" :class="prefixCls" />
  62. <!-- 暂只支持中文,国际化可自行扩展 -->
  63. <!-- <select-lang :class="prefixCls" /> -->
  64. </a-space>
  65. <platform-version
  66. v-if="modalVisible"
  67. ref="platformVersionModal"
  68. @close="modalVisible = false"
  69. />
  70. </div>
  71. </template>
  72. <script>
  73. import AvatarDropdown from './AvatarDropdown'
  74. import SelectLang from '@/components/SelectLang'
  75. import PlatformVersion from './PlatformVersion'
  76. import {
  77. mapGetters
  78. } from 'vuex'
  79. export default {
  80. name: 'RightContent',
  81. components: {
  82. AvatarDropdown,
  83. SelectLang,
  84. PlatformVersion
  85. },
  86. props: {
  87. prefixCls: {
  88. type: String,
  89. default: 'ant-pro-global-header-index-action'
  90. },
  91. isMobile: {
  92. type: Boolean,
  93. default: () => false
  94. },
  95. topMenu: {
  96. type: Boolean,
  97. required: true
  98. },
  99. theme: {
  100. type: String,
  101. required: true
  102. }
  103. },
  104. data () {
  105. return {
  106. modalVisible: false,
  107. showMenu: true,
  108. showPortalDefined: false,
  109. currentUser: {},
  110. fullScreen: false,
  111. msgCount: 0,
  112. docUrl: 'https://docs.geekera.cn/AiDex-Antdv/',
  113. githubUrl: 'https://github.com/fuzui/AiDex-Antdv'
  114. }
  115. },
  116. computed: {
  117. wrpCls () {
  118. return {
  119. 'ant-pro-global-header-index-right': true,
  120. [`ant-pro-global-header-index-${(this.isMobile || !this.topMenu) ? 'light' : this.theme}`]: true
  121. }
  122. },
  123. ...mapGetters([
  124. 'userType',
  125. 'portalConfigs',
  126. 'defaultPortal',
  127. 'sysNoticeList',
  128. 'sysAlarmSize'
  129. ])
  130. },
  131. mounted () {
  132. setTimeout(() => {
  133. this.currentUser = {
  134. name: 'RuoYi'
  135. }
  136. }, 1500)
  137. this.msgCount = this.sysAlarmSize
  138. },
  139. methods: {
  140. showColorSetting () {
  141. this.$emit('showSetting')
  142. },
  143. toConsole () {
  144. this.$message.success(
  145. '尚未实现',
  146. 3
  147. )
  148. },
  149. toNotice () {
  150. this.$router.push({
  151. path: '/alarm/sysAlarm'
  152. })
  153. // this.msgCount = 0
  154. },
  155. toIndex (item) {
  156. this.$router.push({
  157. name: 'index',
  158. params: {
  159. key: item.id
  160. }
  161. })
  162. if (item.applicationRange === 'U') {
  163. // 当选中小页时用户自定义时,修改选中小页为默认小页
  164. this.defaultPortal.id = item.id
  165. }
  166. this.$emit('reloadTab', item)
  167. },
  168. toDesignIndex (item, type) {
  169. this.$message.success(
  170. '尚未实现',
  171. 3
  172. )
  173. },
  174. // 全屏切换
  175. toggleFullScreen () {
  176. if (!document.fullscreenElement) {
  177. document.documentElement.requestFullscreen()
  178. } else {
  179. if (document.exitFullscreen) {
  180. document.exitFullscreen()
  181. }
  182. }
  183. this.fullScreen = !this.fullScreen
  184. },
  185. versionInfo () {
  186. this.modalVisible = true
  187. this.$nextTick(() => (
  188. this.$refs.platformVersionModal.showVersion()
  189. ))
  190. }
  191. }
  192. }
  193. </script>
  194. <style lang="less" scoped="scoped">
  195. .ant-pro-global-header {
  196. .anticon {
  197. vertical-align: middle;
  198. }
  199. }
  200. .ant-modal-confirm-content{
  201. p {
  202. height: 15px;
  203. }
  204. }
  205. .setUl {
  206. .ant-dropdown-menu-item {
  207. padding: 5px 32px;
  208. font-size: 12px;
  209. }
  210. .ant-dropdown-menu-item>.anticon:first-child {
  211. font-size: 12px;
  212. }
  213. .ant-dropdown-menu-item i {
  214. position: absolute;
  215. top: 10px;
  216. font-size: 12px;
  217. color:#969696;
  218. }
  219. .ant-dropdown-menu-item>a.homeTit {
  220. width: 150px;
  221. overflow: hidden;
  222. text-overflow: ellipsis;
  223. white-space: nowrap;
  224. color: #333;
  225. }
  226. .menu-operation{
  227. text-align: center;
  228. i{
  229. position: relative;
  230. top:0px;
  231. margin-right: 5px;
  232. }
  233. }
  234. .menu-operation:hover{
  235. i{
  236. color:#1890ff
  237. }
  238. }
  239. }
  240. </style>