|
|
@@ -1,40 +1,36 @@
|
|
|
<template>
|
|
|
- <ALayoutHeader :class="getHeaderClass">
|
|
|
- <!-- left start -->
|
|
|
- <div :class="`${prefixCls}-left`">
|
|
|
- <!-- logo -->
|
|
|
- <AppLogo
|
|
|
- v-if="getShowHeaderLogo || getIsMobile"
|
|
|
- :class="`${prefixCls}-logo`"
|
|
|
- :theme="getHeaderTheme"
|
|
|
- :style="getLogoWidth"
|
|
|
- />
|
|
|
- <!-- <LayoutTrigger
|
|
|
- v-if="(getShowContent && getShowHeaderTrigger && !getSplit && !getIsMixSidebar) || getIsMobile"
|
|
|
- :theme="getHeaderTheme"
|
|
|
- :sider="false"
|
|
|
- />
|
|
|
- <LayoutBreadcrumb v-if="getShowContent && getShowBread" :theme="getHeaderTheme" /> -->
|
|
|
- </div>
|
|
|
- <!-- left end -->
|
|
|
-
|
|
|
- <!-- menu start -->
|
|
|
- <div :class="`${prefixCls}-menu`" v-if="getIsInitMenu && getShowTopMenu && !getIsMobile">
|
|
|
- <LayoutMenu :isHorizontal="true" :theme="getHeaderTheme" :splitType="getSplitType" :menuMode="getMenuMode" />
|
|
|
- </div>
|
|
|
- <!-- menu-end -->
|
|
|
-
|
|
|
- <div v-if="currentCaseName" :class="`${prefixCls}-case-name`" :title="currentCaseName">
|
|
|
- {{ currentCaseName }}
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- action -->
|
|
|
- <div :class="`${prefixCls}-action`">
|
|
|
+ <!--
|
|
|
+ 顶栏壳:结构 / 案件 / 模式切换 / 头像 / 窗口控制都在 AppTopBar 里,这里只注入传统布局特有的部分。
|
|
|
+ 注意 ant-layout-header 这个类不能省:项目原有样式
|
|
|
+ `.ant-layout .ant-layout-header.jeesite-layout-header { position: relative }`(特异性高于 --fixed)
|
|
|
+ 才是把顶栏留在文档流里的那一条;少了它,--fixed 的 position:fixed 生效,
|
|
|
+ 主区会整体上移 48px 被顶栏压住(页签栏与内容首行显示不全)。
|
|
|
+ -->
|
|
|
+ <AppTopBar
|
|
|
+ :class="[getHeaderClass, 'ant-layout-header']"
|
|
|
+ :theme="getHeaderTheme"
|
|
|
+ :case-name="currentCaseName"
|
|
|
+ :show-logo="getShowHeaderLogo || getIsMobile"
|
|
|
+ :logo-min-width="logoMinWidth"
|
|
|
+ :show-mode-switch="false"
|
|
|
+ show-case-exit
|
|
|
+ @exit-case="handleExitCase"
|
|
|
+ >
|
|
|
+ <!-- 顶部菜单(品牌 logo 由公共顶栏统一渲染) -->
|
|
|
+ <template #nav>
|
|
|
+ <div v-if="getIsInitMenu && getShowTopMenu && !getIsMobile" :class="`${prefixCls}-menu`">
|
|
|
+ <LayoutMenu :isHorizontal="true" :theme="getHeaderTheme" :splitType="getSplitType" :menuMode="getMenuMode" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #actions>
|
|
|
<div :class="`${prefixCls}-search`">
|
|
|
<AppSearch mode="bar" placeholder="搜索系统内容" />
|
|
|
</div>
|
|
|
<span :class="`${prefixCls}-search-divider`"></span>
|
|
|
- <AppWorkbenchToggle @change="handleWorkbenchModeChange" />
|
|
|
+ <!-- 传统 ⇄ 智能:放在模板库前面 -->
|
|
|
+ <AppWorkbenchToggle @change="setWorkbenchMode" />
|
|
|
+
|
|
|
<Tooltip v-if="showTemplateLibraryAction" title="模板库" placement="bottom" :mouseEnterDelay="0.5">
|
|
|
<Button
|
|
|
type="text"
|
|
|
@@ -51,23 +47,17 @@
|
|
|
<!-- <FullScreen v-if="getShowFullScreen" class="fullscreen-item" /> -->
|
|
|
|
|
|
<SettingDrawer v-if="getShowSetting" />
|
|
|
-
|
|
|
- <LogoutButton class="logout-item" />
|
|
|
- <!-- UserDropdown 是多根节点(Dropdown + 两个 Modal),传 class 无法继承会被丢弃,只会产生告警 -->
|
|
|
- <UserDropdown />
|
|
|
- <span :class="`${prefixCls}-search-divider`"></span>
|
|
|
- <WindowControls class="window-controls-item" />
|
|
|
- </div>
|
|
|
- </ALayoutHeader>
|
|
|
+ </template>
|
|
|
+ </AppTopBar>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { defineComponent, ref, unref, computed } from 'vue';
|
|
|
import { storeToRefs } from 'pinia';
|
|
|
import { useRoute } from 'vue-router';
|
|
|
import { propTypes } from '@/core/utils/propTypes';
|
|
|
- import { Button, Layout, Tooltip } from 'ant-design-vue';
|
|
|
- import { AppLogo, AppWorkbenchToggle } from '@/core/components/Application';
|
|
|
- import { AppSearch, WindowControls } from '@/core/components/Application';
|
|
|
+ import { Button, Tooltip } from 'ant-design-vue';
|
|
|
+ import { AppTopBar, AppWorkbenchToggle } from '@/core/components/Application';
|
|
|
+ import { AppSearch } from '@/core/components/Application';
|
|
|
import { Icon } from '@/core/components/Icon';
|
|
|
import { PageEnum } from '@/core/enums/pageEnum';
|
|
|
import { MenuModeEnum, MenuSplitTyeEnum } from '@/core/enums/menuEnum';
|
|
|
@@ -77,18 +67,19 @@
|
|
|
import { useRootSetting } from '@/core/hooks/setting/useRootSetting';
|
|
|
import { useAppInject } from '@/core/hooks/web/useAppInject';
|
|
|
import { useDesign } from '@/core/hooks/web/useDesign';
|
|
|
+ import { useMessage } from '@/core/hooks/web/useMessage';
|
|
|
+ import { useWorkbenchModeSwitch } from '@/core/logics/workbenchMode';
|
|
|
+ import { exitCaseConfirmOptions } from '@/core/logics/exitCaseConfirm';
|
|
|
import { useGo } from '@/core/hooks/web/usePage';
|
|
|
import { useLocale } from '@/core/locales/useLocale';
|
|
|
import { onMountedOrActivated } from '@/core/hooks/core/onMountedOrActivated';
|
|
|
import { useUserStore } from '@/core/store/modules/case';
|
|
|
- import { useAppStoreWithOut } from '@/core/store/modules/app';
|
|
|
- import type { WorkbenchMode } from '@/core/store/modules/app';
|
|
|
import { useEmitter } from '@/core/store/modules/case';
|
|
|
import { getAuthCache } from '@/core/utils/auth';
|
|
|
import { CASE_INFO_KEY } from '@/core/enums/cacheEnum';
|
|
|
import LayoutMenu from '../menu/index.vue';
|
|
|
import LayoutTrigger from '../trigger/index.vue';
|
|
|
- import { LayoutBreadcrumb, FullScreen, ErrorAction, SettingDrawer, LogoutButton, UserDropdown } from './components';
|
|
|
+ import { LayoutBreadcrumb, FullScreen, ErrorAction, SettingDrawer } from './components';
|
|
|
|
|
|
const HEADER_TEMPLATE_LIBRARY_OPEN_EVENT = 'layout-header:open-template-library';
|
|
|
|
|
|
@@ -96,19 +87,15 @@
|
|
|
name: 'LayoutHeader',
|
|
|
components: {
|
|
|
Button,
|
|
|
- ALayoutHeader: Layout.Header,
|
|
|
- AppLogo,
|
|
|
+ AppTopBar,
|
|
|
AppWorkbenchToggle,
|
|
|
LayoutTrigger,
|
|
|
LayoutBreadcrumb,
|
|
|
LayoutMenu,
|
|
|
FullScreen,
|
|
|
AppSearch,
|
|
|
- WindowControls,
|
|
|
ErrorAction,
|
|
|
SettingDrawer,
|
|
|
- LogoutButton,
|
|
|
- UserDropdown,
|
|
|
Tooltip,
|
|
|
Icon,
|
|
|
},
|
|
|
@@ -117,6 +104,8 @@
|
|
|
},
|
|
|
setup(props) {
|
|
|
const { prefixCls } = useDesign('layout-header');
|
|
|
+ const { createConfirm } = useMessage();
|
|
|
+ const { setMode: setWorkbenchMode } = useWorkbenchModeSwitch();
|
|
|
const userStore = useUserStore();
|
|
|
const emitter = useEmitter();
|
|
|
const route = useRoute();
|
|
|
@@ -172,12 +161,10 @@
|
|
|
return settingButtonPosition === SettingButtonPositionEnum.HEADER;
|
|
|
});
|
|
|
|
|
|
- const getLogoWidth = computed(() => {
|
|
|
- if (!unref(getIsMixMode) || unref(getIsMobile)) {
|
|
|
- return {};
|
|
|
- }
|
|
|
- const width = unref(getMenuWidth) < 180 ? 180 : unref(getMenuWidth);
|
|
|
- return { minWidth: `${width}px` };
|
|
|
+ /** MIX 侧栏模式下给 logo 留出与侧栏等宽的最小宽度(数值交给公共顶栏用) */
|
|
|
+ const logoMinWidth = computed(() => {
|
|
|
+ if (!unref(getIsMixMode) || unref(getIsMobile)) return null;
|
|
|
+ return unref(getMenuWidth) < 180 ? 180 : unref(getMenuWidth);
|
|
|
});
|
|
|
|
|
|
const getSplitType = computed(() => {
|
|
|
@@ -198,13 +185,6 @@
|
|
|
|
|
|
const showTemplateLibraryAction = computed(() => true);
|
|
|
|
|
|
- /** 主界面模式切换:智能 = 进入全屏 AI 工作台 */
|
|
|
- const handleWorkbenchModeChange = (mode: WorkbenchMode) => {
|
|
|
- useAppStoreWithOut().setWorkbenchMode(mode);
|
|
|
- if (mode === 'smart') {
|
|
|
- go(PageEnum.BASE_WORKBENCH, true);
|
|
|
- }
|
|
|
- };
|
|
|
|
|
|
const handleTemplateLibraryClick = async () => {
|
|
|
if (route.name !== 'ViewsDataIndex') {
|
|
|
@@ -213,6 +193,18 @@
|
|
|
emitter.emit(HEADER_TEMPLATE_LIBRARY_OPEN_EVENT, undefined);
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * 退出案件:与工作台、头像菜单同一套确认框与同一动作
|
|
|
+ * (store.logout(true) = 调后端 exitCase + 清案件态 + 回案件管理;账号登录态保留)。
|
|
|
+ */
|
|
|
+ const handleExitCase = () => {
|
|
|
+ createConfirm(
|
|
|
+ exitCaseConfirmOptions(async () => {
|
|
|
+ await userStore.logout(true);
|
|
|
+ }, currentCaseName.value),
|
|
|
+ );
|
|
|
+ };
|
|
|
+
|
|
|
return {
|
|
|
prefixCls,
|
|
|
getHeaderClass,
|
|
|
@@ -230,7 +222,7 @@
|
|
|
getShowLocalePicker,
|
|
|
getShowFullScreen,
|
|
|
getUseErrorHandle,
|
|
|
- getLogoWidth,
|
|
|
+ logoMinWidth,
|
|
|
getIsMixSidebar,
|
|
|
getShowSettingButton,
|
|
|
getShowSetting,
|
|
|
@@ -238,7 +230,8 @@
|
|
|
currentCaseName,
|
|
|
showTemplateLibraryAction,
|
|
|
handleTemplateLibraryClick,
|
|
|
- handleWorkbenchModeChange,
|
|
|
+ handleExitCase,
|
|
|
+ setWorkbenchMode,
|
|
|
};
|
|
|
},
|
|
|
});
|