index.vue 13 KB

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