index.vue 13 KB

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