index.vue 11 KB

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