add NavbarActions.vue

This commit is contained in:
Timi
2026-10-22 14:55:33 +08:00
parent 2e91964a5d
commit bba4a2d4d6
12 changed files with 160 additions and 941 deletions
+2 -92
View File
@@ -2,48 +2,7 @@
<div class="page-layout navbar sales-order-list">
<t-navbar fixed :z-index="20" title="销售订单" left-arrow @left-click="$router.back()">
<template #right>
<div
class="nav-actions"
v-if="(route.name === 'SalesOrderList' && actions.length) && pageNavBarActionList.length"
>
<t-popover
v-model:visible="pageNavBarActionVisible"
placement="bottom-right"
:show-arrow="false"
theme="light"
>
<t-button
class="trigger"
variant="text"
:aria-label="'更多操作'"
type="button"
>
<template #icon>
<t-icon name="ellipsis" />
</template>
</t-button>
<template #content>
<div class="menu">
<t-button
v-for="action in pageNavBarActionList"
:key="action.key"
class="menu-item"
variant="text"
type="button"
:theme="action.theme"
:loading="action.loading"
:disabled="action.disabled || action.loading"
@click="handlePageNavBarAction(action)"
>
<template v-if="action.icon" #icon>
<t-icon :name="action.icon" />
</template>
<span v-text="action.text" />
</t-button>
</div>
</template>
</t-popover>
</div>
<navbar-actions :actions="actions" :visible="route.name === 'SalesOrderList'" />
</template>
</t-navbar>
<main ref="salesOrderListRef" v-can="permissionCodes.salesOrder.read" class="page-content scroll list">
@@ -149,7 +108,7 @@
</template>
<script setup lang="ts">
import type { NavBarAction } from "@/types/NavBarAction";
import type { NavbarAction } from "@/types/NavbarAction.ts";
import { Toolkit } from "timi-web";
import { useUserStore } from "timi-web-api";
import { onBeforeRouteLeave } from "vue-router";
@@ -183,14 +142,6 @@ import { events, isCurrentStoreEvent, listDataEventKeys, type ListDataChangedPay
import { Message } from "@/utils/message";
import { gaoRoleCodes, permissionCodes } from "@/utils/permission";
const pageNavBarActionVisible = ref(false);
const pageNavBarActionList = computed<NavBarAction[]>(() => (unref(actions) as NavBarAction[]).filter(action => action.visible !== false));
async function handlePageNavBarAction(action: NavBarAction): Promise<void> {
pageNavBarActionVisible.value = false;
await action.action();
}
import SalesOrderFilterPopup from "@/pages/salesOrder/components/SalesOrderFilterPopup.vue";
import type { Customer } from "@/types/Customer";
@@ -853,45 +804,4 @@ onUnmounted(() => {
}
}
.nav-actions {
--td-popover-padding: 0 .5rem;
width: 6rem;
height: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
:deep(.t-popover__content) { border-radius: .875rem; }
.trigger { padding: 0; }
.menu {
gap: .25rem;
display: grid;
padding: .5rem 0;
min-width: 9rem;
.menu-item {
--td-button-medium-height: 32px;
--td-button-medium-padding-horizontal: 10px;
gap: .25rem;
width: 100%;
font-weight: unset;
justify-content: flex-start;
}
}
}
:global(html.theme-dark) {
.nav-actions {
:deep(.t-popover__content) {
color: #e2e8f0;
background: rgba(30, 41, 59, .98);
}
.menu-item { color: #e2e8f0; }
}
}
</style>