layout.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <template>
  2. <div
  3. :style="styleLayoutMainGroup"
  4. :class="{ grayMode: grayActive }"
  5. class="ibps-layout-header-aside-group hidden-print"
  6. >
  7. <!-- <iframe
  8. style="display: none;"
  9. id="iframeContain"
  10. name="iframeContain"
  11. seamless
  12. scrolling="yes"
  13. src=""
  14. >
  15. </iframe> -->
  16. <!-- 半透明遮罩 -->
  17. <div class="ibps-layout-header-aside-mask" />
  18. <!-- websocket -->
  19. <ibps-notify-monitor />
  20. <!-- 主体内容 -->
  21. <div class="ibps-layout-header-aside-content" flex="dir:top">
  22. <panle />
  23. <!-- 顶栏 -->
  24. <div
  25. :style="{opacity: searchActive ? 0.5 : 1}"
  26. class="ibps-theme-header"
  27. style="box-shadow: 1px 4px 6px rgba(0, 0, 0, 0.12), 0 0 5px rgba(155, 155, 0, 0.04);margin-bottom: 5px;"
  28. flex-box="0"
  29. flex
  30. >
  31. <!-- <div
  32. :class="{'logo-group': true, 'logo-transition': asideTransition, 'ibps-pt-5': system.logoType === 'image', 'ibps-pl-0': system.logoType === 'image'}"
  33. :style="{width: asideCollapse ? asideWidthCollapse : asideWidth}"
  34. flex-box="0"
  35. >
  36. <el-dropdown
  37. v-if="subsystemList && subsystemList.length > 1"
  38. trigger="click"
  39. placement="bottom-start"
  40. @command="command => handleSubsystemClick(command)"
  41. >
  42. <ibps-logo
  43. :system="system"
  44. :aside-collapse="asideCollapse"
  45. :subsystem-list="subsystemList"
  46. :logo-icon-all="logoIconAll"
  47. :logo-icon-only="logoIconOnly"
  48. />
  49. <el-dropdown-menu slot="dropdown" style="width: 180px;">
  50. <el-dropdown-item
  51. v-for="(item, index) in subsystemList"
  52. :key="index"
  53. :disabled="item.id === system.id"
  54. :command="item"
  55. >
  56. <ibps-icon :name="item.logo || 'logo'" :title="item.name"/>{{ item.name }}
  57. </el-dropdown-item>
  58. </el-dropdown-menu>
  59. </el-dropdown>
  60. <ibps-logo
  61. v-else
  62. :system="system"
  63. :aside-collapse="asideCollapse"
  64. :subsystem-list="subsystemList"
  65. :logo-icon-all="logoIconAll"
  66. :logo-icon-only="logoIconOnly"
  67. />
  68. </div>
  69. <div
  70. class="toggle-aside-btn"
  71. flex-box="0"
  72. @click="handleToggleAside"
  73. >
  74. <ibps-icon :name="asideCollapse ? 'indent' : 'outdent'" />
  75. </div> -->
  76. <ibps-menu-header flex-box="1" @pageChange="pageChange" />
  77. <!-- 顶栏右侧 -->
  78. <div class="ibps-header-right" flex-box="0">
  79. <IbpHeaderSearchFeature />
  80. <!-- 如果你只想在开发环境显示这个按钮请添加 v-if="$nodeEnv === 'development'" -->
  81. <!-- 全局搜索放大镜、日志、环境切换、全屏 -->
  82. <!-- <ibps-header-search @click="handleSearchClick" /> -->
  83. <!-- <ibps-header-error-log v-if="$nodeEnv === 'development'" />
  84. <ibps-header-base-url v-if="$nodeEnv === 'development'" /> -->
  85. <!-- <ibps-header-download />
  86. <ibps-header-locking />
  87. <ibps-header-theme />
  88. <ibps-header-language />
  89. <ibps-header-size />
  90. <ibps-header-fullscreen />
  91. <ibps-header-tenant /> -->
  92. <!-- <ibps-header-clean-cache v-if="isSuper" type="platform" />
  93. <ibps-header-clean-cache v-if="isSuper" type="form" /> -->
  94. <ibps-header-tools :is-super="isSuper" />
  95. <!-- <ibps-header-clean-cache v-if="isSuper" type="oauth" />
  96. <ibps-header-clean-cache v-if="isSuper" type="office" /> -->
  97. <span :class="{'mgl5':!isSuper}" style="font-size: 12px; cursor: pointer;" @click="goToMain()">首页</span>
  98. <span style="margin: 0 10px;">|</span>
  99. <ibps-header-message />
  100. <!-- 消息中心 -->
  101. <span style="margin: 0 10px;">|</span>
  102. <ibps-header-user style="margin-right: 15px;" />
  103. <!-- <span style="margin-left: 10px;">|</span>
  104. <ibps-header-setting /> -->
  105. </div>
  106. </div>
  107. <!-- 下面 主体 -->
  108. <div class="ibps-theme-container" flex-box="1" flex>
  109. <!-- 主体 侧边栏 -->
  110. <div
  111. v-if="!hiddenAsideMenu"
  112. ref="aside"
  113. flex-box="0"
  114. :class="{'ibps-theme-container-aside': true, 'ibps-theme-container-transition': asideTransition}"
  115. :style="{width: asideCollapse ? asideWidthCollapse : asideWidth, opacity: searchActive ? 0.5 : 1}"
  116. >
  117. <!-- 侧部顶头栏-->
  118. <div class="layout-border-left">
  119. <div
  120. class="toggle-aside-btn"
  121. style="float: right; width: 25%;"
  122. @click="handleToggleAside"
  123. >
  124. <ibps-icon :name="asideCollapse ? 'indent' : 'outdent'" />
  125. </div>
  126. <div style="width: 74%;" class="toggle-aside-btn layout-border-left-name">
  127. <ibps-icon v-if="asideCollapse" :name="getSystemName[0].icon || 'cog'" />
  128. <span v-else>{{ getSystemName[0].name }}</span>
  129. </div>
  130. </div>
  131. <ibps-menu-side style="margin-top: 52px;" />
  132. </div>
  133. <!-- 主体 -->
  134. <div class="ibps-theme-container-main" flex-box="1" flex>
  135. <!-- 搜索 -->
  136. <transition name="fade-scale">
  137. <div
  138. v-show="searchActive"
  139. class="ibps-theme-container-main-layer"
  140. flex
  141. >
  142. <ibps-panel-search ref="panelSearch" @close="searchPanelClose" />
  143. </div>
  144. </transition>
  145. <!-- 内容 -->
  146. <transition name="fade-scale">
  147. <div
  148. v-show="!searchActive"
  149. class="ibps-theme-container-main-layer"
  150. flex="dir:top"
  151. >
  152. <!-- tab -->
  153. <!-- <div class="ibps-theme-container-main-header" flex-box="0">
  154. <ibps-tabs />
  155. </div> -->
  156. <!-- 页面 -->
  157. <div class="ibps-theme-container-main-body" flex-box="1">
  158. <transition :name="transitionActive ? 'fade-transverse' : ''">
  159. <!-- <keep-alive :include="keepAlive"> -->
  160. <router-view :key="routerViewKey" />
  161. <!-- </keep-alive> -->
  162. </transition>
  163. </div>
  164. </div>
  165. </transition>
  166. </div>
  167. </div>
  168. </div>
  169. <!-- <FloatBall></FloatBall> -->
  170. </div>
  171. </template>
  172. <script>
  173. import IbpsLogo from './components/logo'
  174. import IbpsMenuSide from './components/menu-side/index.js'
  175. import IbpsMenuHeader from './components/menu-header/index.js'
  176. import IbpsTabs from './components/tabs'
  177. import IbpsHeaderSearch from './components/header-search'
  178. import FloatBall from './components/components/float-ball'
  179. import IbpsHeaderFullscreen from './components/header-fullscreen'
  180. // import IbpsHeaderLocking from './components/header-locking'
  181. // import IbpsHeaderLanguage from './components/header-language'
  182. // import IbpsHeaderSize from './components/header-size'
  183. // import IbpsHeaderTheme from './components/header-theme'
  184. // import IbpsHeaderToolbar from './components/header-toolbar'
  185. // import IbpsHeaderTenant from './components/header-tenant'
  186. import IbpsHeaderSetting from './components/header-setting'
  187. import IbpsHeaderMessage from './components/header-message'
  188. import panle from '@/components/jbd-panel'
  189. import IbpsHeaderUser from './components/header-user'
  190. import IbpsHeaderErrorLog from './components/header-error-log'
  191. import IbpsHeaderBaseUrl from './components/header-base-url'
  192. import IbpsHeaderCleanCache from './components/header-clean-cache'
  193. import IbpsHeaderTools from './components/header-tools'
  194. import IbpHeaderSearchFeature from './components/header-search-feature'
  195. // import IbpsHeaderDownload from './components/header-download'
  196. import IbpsNotifyMonitor from '@/business/platform/socket/notify-monitor'
  197. import { mapState, mapGetters, mapActions } from 'vuex'
  198. import mixinSearch from './mixins/search'
  199. import mixinLock from './mixins/lock'
  200. import setting from '@/setting.js'
  201. import { f } from 'vue-grid-layout'
  202. export default {
  203. name: 'ibps-layout-header-aside',
  204. components: {
  205. IbpsLogo,
  206. IbpsMenuSide,
  207. IbpsMenuHeader,
  208. IbpsTabs,
  209. IbpsHeaderSearch,
  210. FloatBall,
  211. panle,
  212. IbpsHeaderFullscreen,
  213. // IbpsHeaderLocking,
  214. // IbpsHeaderLanguage,
  215. // IbpsHeaderSize,
  216. // IbpsHeaderTheme,
  217. // IbpsHeaderToolbar,
  218. // IbpsHeaderTenant,
  219. IbpsHeaderSetting,
  220. IbpsHeaderMessage,
  221. IbpsHeaderUser,
  222. IbpsHeaderErrorLog,
  223. IbpsHeaderBaseUrl,
  224. IbpsHeaderCleanCache,
  225. IbpsHeaderTools,
  226. // IbpsHeaderDownload,
  227. IbpsNotifyMonitor,
  228. IbpHeaderSearchFeature
  229. },
  230. mixins: [mixinSearch, mixinLock],
  231. data () {
  232. const { isSuper, account } = this.$store.getters
  233. const { hiddenAsideMenu = false } = this.$route.meta || {}
  234. return {
  235. // [侧边栏宽度] 正常状态
  236. asideWidth: '240px',
  237. // [侧边栏宽度] 折叠状态
  238. asideWidthCollapse: '65px',
  239. isSuper,
  240. account,
  241. hiddenAsideMenu
  242. }
  243. },
  244. computed: {
  245. ...mapState('ibps', {
  246. keepAlive: state => state.page.keepAlive,
  247. grayActive: state => state.gray.active,
  248. transitionActive: state => state.transition.active,
  249. asideCollapse: state => state.menu.asideCollapse,
  250. asideTransition: state => state.menu.asideTransition,
  251. system: state => state.system.system,
  252. subsystemList: state => state.system.subsystemList
  253. }),
  254. ...mapGetters('ibps', {
  255. themeActiveSetting: 'theme/activeSetting'
  256. }),
  257. getSystemName () {
  258. return this.header().filter(name => { return name.id === this.activeHeader() })
  259. },
  260. /**
  261. * @description 用来实现带参路由的缓存
  262. */
  263. routerViewKey () {
  264. // 默认情况下 key 类似 __transition-n-/foo
  265. // 这里的字符串操作是为了最终 key 的格式和原来相同 类似 __transition-n-__stamp-time-/foo
  266. const stamp = this.$route.meta[`__stamp-${this.$route.path}`] || ''
  267. return `${stamp ? `__stamp-${stamp}-` : ''}${this.$route.path}`
  268. },
  269. /**
  270. * @description 最外层容器的背景图片样式
  271. */
  272. styleLayoutMainGroup () {
  273. return { ...(this.themeActiveSetting.backgroundImage ? { backgroundImage: `url('${this.$baseUrl}${this.themeActiveSetting.backgroundImage}')` } : {}) }
  274. },
  275. logoIconAll () {
  276. return `${this.$baseUrl}images/theme/${this.themeActiveSetting.name}/all.png`
  277. },
  278. logoIconOnly () {
  279. return `${this.$baseUrl}images/theme/${this.themeActiveSetting.name}/only.png`
  280. }
  281. },
  282. watch: {
  283. $route (v) {
  284. this.hiddenAsideMenu = v.meta ? v.meta.hiddenAsideMenu : false
  285. }
  286. },
  287. mounted () {
  288. // window.performance.navigation.type === 1
  289. },
  290. methods: {
  291. ...mapActions('ibps/menu', ['asideCollapseToggle']),
  292. ...mapState('ibps/menu', ['routers', 'activeHeader', 'header', 'activeName']),
  293. goToMain () {
  294. this.$router.push({ path: '/' })
  295. },
  296. pageChange () {
  297. },
  298. /**
  299. * 接收点击切换侧边栏的按钮
  300. */
  301. handleToggleAside () {
  302. this.asideCollapseToggle()
  303. },
  304. handleSubsystemClick (system) {
  305. this.$store.dispatch('ibps/system/set', system)
  306. window.location.href = this.$baseUrl
  307. // location.reload() // 为了重新实例化vue-router对象 避免bug
  308. }
  309. }
  310. }
  311. </script>
  312. <style lang="scss">
  313. // 注册主题
  314. @import '~@/assets/styles/theme/register.scss';
  315. .jbd-sys-title {
  316. background: linear-gradient(to top, rgb(48, 194, 189), rgb(145, 216, 210));
  317. // background: rgb(51, 150, 209);
  318. height: 40px;
  319. line-height: 40px;
  320. font-size: 18px;
  321. color: #fff;
  322. text-align: center;
  323. }
  324. .jbd-sys-title-cont {
  325. height: 40px;
  326. line-height: 40px;
  327. font-weight: bold;
  328. font-size: 14px;
  329. }
  330. .jbd-sys-title-contact {
  331. line-height: 20px;
  332. margin-right: 40px;
  333. font-size: 14px;
  334. }
  335. .layout-border-left {
  336. float: left;
  337. box-shadow: 0px 2px 4px #e78c45, 0 0 5px rgba(155, 155, 0, 0.04);
  338. width: 100%;
  339. height: 50px;
  340. line-height: 50px;
  341. .layout-border-left-name {
  342. float: left;
  343. font-size: 18px;
  344. font-weight: bold;
  345. }
  346. }
  347. .mgl5 {
  348. margin-left: 5px;
  349. }
  350. </style>