index.vue 12 KB

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