index.vue 10 KB

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