index.vue 11 KB

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