index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <Header v-if="
  3. ((!getShowFullHeader && !currentRoute.path.endsWith('home')) || currentRoute.path.startsWith('/micro-vent-3dModal/modelchannel/')) &&
  4. !noHeadeLink.includes(currentRoute.path) &&
  5. currentRoute.path !== homePath
  6. " :class="[
  7. ...getHeaderClass,
  8. {
  9. 'vent-header': currentRoute.path.startsWith('/monitorChannel/monitor-'),
  10. 'normal-header': !currentRoute.path.startsWith('/monitorChannel/monitor-'),
  11. 'no-header': currentRoute.path.endsWith('home'),
  12. },
  13. ]" style="z-index: 1">
  14. <!-- left start -->
  15. <div :class="`${prefixCls}-left`">
  16. <!-- logo -->
  17. <!-- <AppLogo v-if="getShowHeaderLogo || getIsMobile" :class="`${prefixCls}-logo`" :theme="getHeaderTheme" :style="getLogoWidth" /> -->
  18. <AppLogo :class="`${prefixCls}-logo`" :theme="getHeaderTheme" :style="getLogoWidth" />
  19. <div v-if="!currentRoute.path.startsWith('/monitorChannel/monitor-')"
  20. style="margin-top: 5px; color: #aaa; margin-left: 10px; font-weight: 600">/{{ currentRoute.meta.title }}</div>
  21. <!-- <LayoutTrigger
  22. v-if="(getShowContent && getShowHeaderTrigger && !getSplit && !getIsMixSidebar) || getIsMobile"
  23. :theme="getHeaderTheme"
  24. :sider="false"
  25. />
  26. <LayoutBreadcrumb v-if="getShowContent && getShowBread" :theme="getHeaderTheme" />
  27. <span v-if="getShowContent && getShowBreadTitle" :class="[prefixCls, `${prefixCls}--${getHeaderTheme}`, 'headerIntroductionClass']">
  28. 欢迎进入 {{ title }}
  29. </span> -->
  30. </div>
  31. <!-- left end -->
  32. <!-- menu start -->
  33. <div v-if="currentRoute.path.startsWith('/monitorChannel/monitor-')" :class="`${prefixCls}-vent`">
  34. <!-- <div>主通风机监测控制</div> -->
  35. <div class="header-nav-title">{{ currentRoute.meta.title }} </div>
  36. </div>
  37. <div :class="`${prefixCls}-menu`" v-else-if="getShowTopMenu && !getIsMobile">
  38. <LayoutMenu :isHorizontal="true" :theme="getHeaderTheme" :splitType="getSplitType" :menuMode="getMenuMode" />
  39. </div>
  40. <!-- menu-end -->
  41. <!-- action -->
  42. <div :class="`${prefixCls}-action`">
  43. <!-- <div class="right-position">
  44. <VoiceBroadcast />
  45. <UserDropDown v-if="showUserDropdown" :theme="getHeaderTheme" />
  46. </div>
  47. <LoginSelect ref="loginSelectRef" @success="loginSelectOk" /> -->
  48. </div>
  49. </Header>
  50. <div :class="`${prefixCls}-action`" style="position: fixed; top: 30px; right: 20px; z-index: 999999">
  51. <div class="right-position">
  52. <!-- 公司端不显示语音播报功能 -->
  53. <VoiceBroadcast v-if="sysOrgCode != 'sdmtjtgsd'" />
  54. <VoiceBroadcastGsd v-if="sysOrgCode == 'sdmtjtgsd'" />
  55. <UserDropDown v-if="showUserDropdown" :theme="getHeaderTheme" />
  56. <LoginSelect ref="loginSelectRef" @success="loginSelectOk" />
  57. </div>
  58. </div>
  59. </template>
  60. <script lang="ts">
  61. import { defineComponent, unref, computed, ref, onMounted, toRaw } from 'vue';
  62. import { useGlobSetting } from '/@/hooks/setting';
  63. import { propTypes } from '/@/utils/propTypes';
  64. import { Layout } from 'ant-design-vue';
  65. import { AppLogo } from '/@/components/Application';
  66. import LayoutMenu from '../menu/index.vue';
  67. import LayoutTrigger from '../trigger/index.vue';
  68. import { AppSearch } from '/@/components/Application';
  69. import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting';
  70. import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
  71. import { useRootSetting } from '/@/hooks/setting/useRootSetting';
  72. import { MenuModeEnum, MenuSplitTyeEnum } from '/@/enums/menuEnum';
  73. import { SettingButtonPositionEnum } from '/@/enums/appEnum';
  74. import { AppLocalePicker } from '/@/components/Application';
  75. import { UserDropDown, LayoutBreadcrumb, FullScreen, Notify, ErrorAction, LockScreen } from './components';
  76. import { useAppInject } from '/@/hooks/web/useAppInject';
  77. import { useDesign } from '/@/hooks/web/useDesign';
  78. import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  79. import { useLocale } from '/@/locales/useLocale';
  80. import VoiceBroadcast from './components/VoiceBroadcast.vue';
  81. import VoiceBroadcastGsd from './components/VoiceBroadcastGsd.vue';
  82. import LoginSelect from '/@/views/sys/login/LoginSelect.vue';
  83. import { useUserStore } from '/@/store/modules/user';
  84. import { useRouter } from 'vue-router';
  85. import { noHeadeLink } from '../layout.data';
  86. export default defineComponent({
  87. name: 'LayoutHeader',
  88. components: {
  89. Header: Layout.Header,
  90. AppLogo,
  91. LayoutTrigger,
  92. LayoutBreadcrumb,
  93. LayoutMenu,
  94. UserDropDown,
  95. AppLocalePicker,
  96. FullScreen,
  97. Notify,
  98. AppSearch,
  99. ErrorAction,
  100. LockScreen,
  101. LoginSelect,
  102. VoiceBroadcast,
  103. VoiceBroadcastGsd,
  104. SettingDrawer: createAsyncComponent(() => import('/@/layouts/default/setting/index.vue'), {
  105. loading: true,
  106. }),
  107. },
  108. props: {
  109. fixed: propTypes.bool,
  110. },
  111. setup(props) {
  112. const { prefixCls } = useDesign('layout-header');
  113. const userStore = useUserStore();
  114. const { currentRoute } = useRouter();
  115. console.log(currentRoute);
  116. const { getShowTopMenu, getShowHeaderTrigger, getSplit, getIsMixMode, getMenuWidth, getIsMixSidebar } = useMenuSetting();
  117. const { getUseErrorHandle, getShowSettingButton, getSettingButtonPosition } = useRootSetting();
  118. const { title, sysOrgCode, homePath } = useGlobSetting();
  119. const {
  120. getHeaderTheme,
  121. getShowFullScreen,
  122. getShowNotice,
  123. getShowContent,
  124. getShowBread,
  125. getShowHeaderLogo,
  126. getShowHeader,
  127. getShowSearch,
  128. getUseLockPage,
  129. getShowBreadTitle,
  130. getShowFullHeaderRef,
  131. } = useHeaderSetting();
  132. const { getShowLocalePicker } = useLocale();
  133. const { getIsMobile } = useAppInject();
  134. const getHeaderClass = computed(() => {
  135. const theme = unref(getHeaderTheme);
  136. return [
  137. prefixCls,
  138. {
  139. [`${prefixCls}--fixed`]: props.fixed,
  140. [`${prefixCls}--mobile`]: unref(getIsMobile),
  141. [`${prefixCls}--${theme}`]: theme,
  142. },
  143. ];
  144. });
  145. const getShowFullHeader = computed(() => {
  146. const route = unref(currentRoute);
  147. return getShowFullHeaderRef && route.path.startsWith('/micro-');
  148. });
  149. const getShowSetting = computed(() => {
  150. if (!unref(getShowSettingButton)) {
  151. return false;
  152. }
  153. const settingButtonPosition = unref(getSettingButtonPosition);
  154. if (settingButtonPosition === SettingButtonPositionEnum.AUTO) {
  155. return unref(getShowHeader);
  156. }
  157. return settingButtonPosition === SettingButtonPositionEnum.HEADER;
  158. });
  159. const getLogoWidth = computed(() => {
  160. if (!unref(getIsMixMode) || unref(getIsMobile)) {
  161. return {};
  162. }
  163. const width = unref(getMenuWidth) < 180 ? 180 : unref(getMenuWidth);
  164. return { width: `${width}px` };
  165. });
  166. const getSplitType = computed(() => {
  167. return unref(getSplit) ? MenuSplitTyeEnum.TOP : MenuSplitTyeEnum.NONE;
  168. });
  169. const getMenuMode = computed(() => {
  170. return unref(getSplit) ? MenuModeEnum.HORIZONTAL : null;
  171. });
  172. // /**
  173. // * 首页多租户部门弹窗逻辑
  174. // */
  175. const loginSelectRef = ref();
  176. function showLoginSelect() {
  177. //update-begin---author:liusq Date:20220101 for:判断登录进来是否需要弹窗选择租户----
  178. //判断是否是登陆进来
  179. const loginInfo = toRaw(userStore.getLoginInfo) || {};
  180. if (!!loginInfo.isLogin) {
  181. loginSelectRef.value.show(loginInfo);
  182. }
  183. //update-end---author:liusq Date:20220101 for:判断登录进来是否需要弹窗选择租户----
  184. }
  185. function loginSelectOk() {
  186. console.log('成功。。。。。');
  187. }
  188. // 用户下拉框应该在以下情况中隐藏:
  189. // 1. 本页面是由其他页面的 iframe 嵌入的页面
  190. const showUserDropdown = computed(() => {
  191. return window.self === window.top;
  192. });
  193. onMounted(() => {
  194. showLoginSelect();
  195. });
  196. return {
  197. prefixCls,
  198. getHeaderClass,
  199. getShowHeaderLogo,
  200. getHeaderTheme,
  201. getShowHeaderTrigger,
  202. getIsMobile,
  203. getShowBreadTitle,
  204. getShowBread,
  205. getShowContent,
  206. getSplitType,
  207. getSplit,
  208. getMenuMode,
  209. getShowTopMenu,
  210. getShowLocalePicker,
  211. getShowFullScreen,
  212. getShowNotice,
  213. getUseErrorHandle,
  214. getLogoWidth,
  215. getIsMixSidebar,
  216. getShowSettingButton,
  217. getShowSetting,
  218. getShowSearch,
  219. getUseLockPage,
  220. loginSelectOk,
  221. loginSelectRef,
  222. currentRoute,
  223. title,
  224. getShowFullHeader,
  225. noHeadeLink,
  226. showUserDropdown,
  227. sysOrgCode,
  228. homePath,
  229. };
  230. },
  231. });
  232. </script>
  233. <style lang="less">
  234. @import './index.less';
  235. //update-begin---author:scott ---date:2022-09-30 for:默认隐藏顶部菜单面包屑-----------
  236. //顶部欢迎语展示样式
  237. @prefix-cls: ~'@{namespace}-layout-header';
  238. .@{prefix-cls} {
  239. display: flex;
  240. padding: 0 8px;
  241. // align-items: center;
  242. .headerIntroductionClass {
  243. margin-right: 4px;
  244. margin-bottom: 2px;
  245. border-bottom: 0px;
  246. border-left: 0px;
  247. }
  248. &--light {
  249. .headerIntroductionClass {
  250. color: @breadcrumb-item-normal-color;
  251. }
  252. }
  253. &--dark {
  254. .headerIntroductionClass {
  255. color: rgba(255, 255, 255, 0.6);
  256. }
  257. .anticon {
  258. color: rgba(255, 255, 255, 0.8);
  259. }
  260. }
  261. //update-end---author:scott ---date::2022-09-30 for:默认隐藏顶部菜单面包屑--------------
  262. }
  263. // background: linear-gradient(#003f77, #0a134c);
  264. // // background: linear-gradient(#02050c 0%, #03114c 100%);
  265. // // border: none;
  266. // border-bottom: 1px solid #81aabf01;
  267. // padding-bottom: 2px;
  268. // box-shadow: 0 0 20px #44caff55 inset;
  269. .normal-header {
  270. height: 52px !important;
  271. line-height: 52px !important;
  272. background: var(--vent-header-bg-color) !important;
  273. // background: linear-gradient(#005177,#0a344c) !important;
  274. border-bottom: 1px solid #81aabf01 !important;
  275. padding-bottom: 2px !important;
  276. box-shadow: 0 0 20px #44caff55 inset !important;
  277. padding: 0 8px !important;
  278. }
  279. .no-header {
  280. height: 0px !important;
  281. display: none !important;
  282. }
  283. .header-nav-title {
  284. background-image: linear-gradient(#ffffff 50%, #60f4ff);
  285. -webkit-background-clip: text;
  286. color: transparent;
  287. font-weight: 600;
  288. }
  289. </style>