index.vue 11 KB

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