layout.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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="https://www.szjyxt.com/#/fileView?url=https%3A%2F%2Fwww.szjyxt.com%2Fibps%2Fplatform%2Fv3%2Ffile%2Fdownload%3FattachmentId%3D925044155762081792&isEdit=true&fileType=docx&title=GDYR-CX01-A0%20%E4%BF%9D%E8%AF%81%E5%85%AC%E6%AD%A3%E6%80%A7%E7%AE%A1%E7%90%86%E7%A8%8B%E5%BA%8F&user=%5Bobject%20Object%5D&mode=view&editUrl=https%3A%2F%2Fwww.szjyxt.com%2Fibps%2Fplatform%2Fv3%2Ffile%2FeditCallback%3FfileName%3DGDYR-CX01-A0%20%E4%BF%9D%E8%AF%81%E5%85%AC%E6%AD%A3%E6%80%A7%E7%AE%A1%E7%90%86%E7%A8%8B%E5%BA%8F%26fileType%3Ddocx&key="
  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. <!-- 如果你只想在开发环境显示这个按钮请添加 v-if="$nodeEnv === 'development'" -->
  80. <!-- 全局搜索放大镜、日志、环境切换、全屏 -->
  81. <!-- <ibps-header-search @click="handleSearchClick" />
  82. <ibps-header-error-log v-if="$nodeEnv === 'development'" />
  83. <ibps-header-base-url v-if="$nodeEnv === 'development'" />
  84. <ibps-header-download />
  85. <ibps-header-locking />
  86. <ibps-header-theme />
  87. <ibps-header-language />
  88. <ibps-header-size />
  89. <ibps-header-fullscreen />
  90. <ibps-header-tenant /> -->
  91. <span style="font-size: 12px; cursor: pointer;" @click="goToMain()">首页</span>
  92. <span style="margin: 0 10px;">|</span>
  93. <ibps-header-message />
  94. <!-- 消息中心 -->
  95. <span style="margin: 0 10px;">|</span>
  96. <ibps-header-user />
  97. <span style="margin: 0 10px;">|</span>
  98. <ibps-header-architecture />
  99. <span style="margin-left: 10px;">|</span>
  100. <ibps-header-setting />
  101. </div>
  102. </div>
  103. <!-- 下面 主体 -->
  104. <div class="ibps-theme-container" flex-box="1" flex>
  105. <!-- 主体 侧边栏 -->
  106. <div
  107. v-if="sysName != '首页'"
  108. ref="aside"
  109. flex-box="0"
  110. :class="{'ibps-theme-container-aside': true, 'ibps-theme-container-transition': asideTransition}"
  111. :style="{width: asideCollapse ? asideWidthCollapse : asideWidth, opacity: searchActive ? 0.5 : 1}"
  112. >
  113. <!-- 侧部顶头栏-->
  114. <div class="layout-border-left">
  115. <!-- <div
  116. class="toggle-aside-btn"
  117. style="float: right; width: 25%;"
  118. @click="handleToggleAside"
  119. >
  120. <ibps-icon :name="asideCollapse ? 'indent' : 'outdent'" />
  121. </div> -->
  122. <div style="width: 100%;" class="toggle-aside-btn layout-border-left-name">
  123. <span>{{ getSystemName[0].name }}</span>
  124. </div>
  125. </div>
  126. <ibps-menu-side style="margin-top: 52px;" />
  127. </div>
  128. <!-- 主体 -->
  129. <div class="ibps-theme-container-main" flex-box="1" flex>
  130. <!-- 搜索 -->
  131. <transition name="fade-scale">
  132. <div
  133. v-show="searchActive"
  134. class="ibps-theme-container-main-layer"
  135. flex
  136. >
  137. <ibps-panel-search ref="panelSearch" @close="searchPanelClose"/>
  138. </div>
  139. </transition>
  140. <!-- 内容 -->
  141. <transition name="fade-scale">
  142. <div
  143. v-show="!searchActive"
  144. class="ibps-theme-container-main-layer"
  145. flex="dir:top"
  146. >
  147. <!-- tab -->
  148. <!-- <div class="ibps-theme-container-main-header" flex-box="0">
  149. <ibps-tabs />
  150. </div> -->
  151. <!-- 页面 -->
  152. <div class="ibps-theme-container-main-body" flex-box="1">
  153. <transition :name="transitionActive ? 'fade-transverse' : ''">
  154. <!-- <keep-alive :include="keepAlive"> -->
  155. <router-view :key="routerViewKey" />
  156. <!-- </keep-alive> -->
  157. </transition>
  158. </div>
  159. </div>
  160. </transition>
  161. </div>
  162. </div>
  163. </div>
  164. <!-- <FloatBall></FloatBall> -->
  165. </div>
  166. </template>
  167. <script>
  168. import IbpsLogo from './components/logo'
  169. import IbpsMenuSide from './components/menu-side/index.js'
  170. import IbpsMenuHeader from './components/menu-header/index.js'
  171. import IbpsTabs from './components/tabs'
  172. import IbpsHeaderSearch from './components/header-search'
  173. import FloatBall from './components/components/float-ball'
  174. import IbpsHeaderFullscreen from './components/header-fullscreen'
  175. import IbpsHeaderArchitecture from './components/header-architecture'
  176. // import IbpsHeaderLocking from './components/header-locking'
  177. // import IbpsHeaderLanguage from './components/header-language'
  178. // import IbpsHeaderSize from './components/header-size'
  179. // import IbpsHeaderTheme from './components/header-theme'
  180. // import IbpsHeaderToolbar from './components/header-toolbar'
  181. // import IbpsHeaderTenant from './components/header-tenant'
  182. import IbpsHeaderSetting from './components/header-setting'
  183. import IbpsHeaderMessage from './components/header-message'
  184. import panle from '@/components/jbd-panel'
  185. import IbpsHeaderUser from './components/header-user'
  186. import IbpsHeaderErrorLog from './components/header-error-log'
  187. import IbpsHeaderBaseUrl from './components/header-base-url'
  188. // import IbpsHeaderDownload from './components/header-download'
  189. // import IbpsNotifyMonitor from '@/business/platform/socket/notify-monitor'
  190. import { mapState, mapGetters, mapActions } from 'vuex'
  191. import mixinSearch from './mixins/search'
  192. import mixinLock from './mixins/lock'
  193. import setting from '@/setting.js'
  194. export default {
  195. name: 'ibps-layout-header-aside',
  196. components: {
  197. IbpsLogo,
  198. IbpsMenuSide,
  199. IbpsMenuHeader,
  200. IbpsTabs,
  201. IbpsHeaderSearch,
  202. FloatBall,
  203. panle,
  204. IbpsHeaderFullscreen,
  205. IbpsHeaderArchitecture,
  206. // IbpsHeaderLocking,
  207. // IbpsHeaderLanguage,
  208. // IbpsHeaderSize,
  209. // IbpsHeaderTheme,
  210. // IbpsHeaderToolbar,
  211. // IbpsHeaderTenant,
  212. IbpsHeaderSetting,
  213. IbpsHeaderMessage,
  214. IbpsHeaderUser,
  215. IbpsHeaderErrorLog,
  216. IbpsHeaderBaseUrl
  217. // IbpsHeaderDownload,
  218. // IbpsNotifyMonitor
  219. },
  220. mixins: [mixinSearch, mixinLock],
  221. data() {
  222. return {
  223. // [侧边栏宽度] 正常状态
  224. asideWidth: '200px',
  225. // [侧边栏宽度] 折叠状态
  226. asideWidthCollapse: '65px'
  227. }
  228. },
  229. // watch: {
  230. // getSystemName(value) {
  231. // this.sysName = ''
  232. // }
  233. // },
  234. mounted() {
  235. // window.performance.navigation.type == 1
  236. if (this.$route.name == 'dashboard') {
  237. this.sysName = '首页'
  238. }
  239. },
  240. computed: {
  241. ...mapState('ibps', {
  242. // sysName:state=>state.menu.sysName,
  243. keepAlive: state => state.page.keepAlive,
  244. grayActive: state => state.gray.active,
  245. transitionActive: state => state.transition.active,
  246. asideCollapse: state => state.menu.asideCollapse,
  247. asideTransition: state => state.menu.asideTransition,
  248. system: state => state.system.system,
  249. subsystemList: state => state.system.subsystemList
  250. }),
  251. ...mapGetters('ibps', {
  252. themeActiveSetting: 'theme/activeSetting'
  253. }),
  254. getSystemName() {
  255. return this.header().filter(name => { return name.id == this.activeHeader() })
  256. },
  257. /**
  258. * @description 用来实现带参路由的缓存
  259. */
  260. sysName: {
  261. get() {
  262. if (this.$route.name == 'dashboard') {
  263. return '首页'
  264. } else {
  265. return ''
  266. }
  267. },
  268. set() {
  269. if (this.$route.name == 'dashboard') {
  270. return '首页'
  271. } else {
  272. return ''
  273. }
  274. }
  275. },
  276. routerViewKey() {
  277. // 默认情况下 key 类似 __transition-n-/foo
  278. // 这里的字符串操作是为了最终 key 的格式和原来相同 类似 __transition-n-__stamp-time-/foo
  279. const stamp = this.$route.meta[`__stamp-${this.$route.path}`] || ''
  280. return `${stamp ? `__stamp-${stamp}-` : ''}${this.$route.path}`
  281. },
  282. /**
  283. * @description 最外层容器的背景图片样式
  284. */
  285. styleLayoutMainGroup() {
  286. return { ...(this.themeActiveSetting.backgroundImage ? {backgroundImage: `url('${this.$baseUrl}${this.themeActiveSetting.backgroundImage}')`} : {})}
  287. },
  288. logoIconAll() {
  289. return `${this.$baseUrl}images/theme/${this.themeActiveSetting.name}/all.png`
  290. },
  291. logoIconOnly() {
  292. return `${this.$baseUrl}images/theme/${this.themeActiveSetting.name}/only.png`
  293. }
  294. },
  295. methods: {
  296. ...mapActions('ibps/menu', ['asideCollapseToggle']),
  297. ...mapState('ibps/menu', ['activeHeader', 'header', 'activeName']),
  298. /* 跳转首页*/
  299. goToMain() {
  300. // this.sysName = "首页"
  301. this.$router.push({
  302. name: 'dashboard'
  303. })
  304. },
  305. pageChange() {
  306. this.sysName = ''
  307. },
  308. /**
  309. * 接收点击切换侧边栏的按钮
  310. */
  311. handleToggleAside() {
  312. this.asideCollapseToggle()
  313. },
  314. handleSubsystemClick(system) {
  315. this.$store.dispatch('ibps/system/set', system)
  316. window.location.href = this.$baseUrl
  317. // location.reload() // 为了重新实例化vue-router对象 避免bug
  318. }
  319. }
  320. }
  321. </script>
  322. <style lang="scss">
  323. // 注册主题
  324. @import '~@/assets/styles/theme/register.scss';
  325. .jbd-sys-title {
  326. background: linear-gradient(to top,#a73a3a,#f35858);;
  327. height: 40px;
  328. line-height: 40px;
  329. font-size: 18px;
  330. color: #fff;
  331. text-align: center;
  332. }
  333. .jbd-sys-title-cont {
  334. height: 40px;
  335. line-height: 40px;
  336. font-weight: bold;
  337. font-size: 14px;
  338. }
  339. .jbd-sys-title-contact {
  340. line-height: 20px;
  341. margin-right: 40px;
  342. font-size: 14px;
  343. }
  344. .layout-border-left {
  345. float: left;
  346. box-shadow: 0px 2px 4px #e78c45, 0 0 5px rgba(155, 155, 0, 0.04);
  347. width: 100%;
  348. height: 50px;
  349. line-height: 50px;
  350. .layout-border-left-name {
  351. float: left;
  352. font-size: 18px;
  353. font-weight: bold;
  354. }
  355. }
  356. </style>