refactor: 调整权限代码

This commit is contained in:
2026-08-15 14:19:12 +08:00
parent 19513dac52
commit af47943436
36 changed files with 174 additions and 127 deletions
@@ -104,6 +104,7 @@ const PromotionFeeIcon = createIconifyIcon('lucide:dollar-sign');
const ToolbarToggleIcon = createIconifyIcon('lucide:sliders-horizontal');
const ReceiptIcon = createIconifyIcon('lucide:receipt');
const CalendarIcon = createIconifyIcon('lucide:calendar');
const RefreshIcon = createIconifyIcon('lucide:refresh-cw');
function goToImportOrder() {
void router.push('/import/order');
@@ -557,6 +558,27 @@ async function refreshActiveDataTab() {
await loadTabData(tab as DataTabKey);
}
const refreshing = ref(false);
/** 手动刷新:强制重拉当前 Tab(含区间对比) */
async function handleManualRefresh() {
if (refreshing.value) {
return;
}
refreshing.value = true;
try {
if (activeTab.value === 'periodCompare') {
await periodCompareTabRef.value?.refresh?.();
return;
}
const tab = activeTab.value as DataTabKey;
tabLoaded[tab] = false;
await loadTabData(tab);
} finally {
refreshing.value = false;
}
}
const activeTab = ref('finance');
function handleShopNavigate(shopId: number) {
@@ -589,6 +611,7 @@ const salesRankTabRef = ref<InstanceType<typeof WorkbenchSalesRankTab> | null>(
const periodCompareTabRef = ref<
| (InstanceType<typeof WorkbenchPeriodCompareTab> & {
redraw: () => Promise<void>;
refresh: () => Promise<void>;
})
| null
>(null);
@@ -852,6 +875,30 @@ onUnmounted(() => {
</div>
</div>
</Popover>
<div
:class="[
toolbarShellClass,
refreshing ? 'cursor-wait opacity-70' : 'cursor-pointer',
]"
role="button"
title="刷新当前页数据"
@click="handleManualRefresh"
>
<div
:class="[toolbarPanelClass, 'flex items-center gap-1 px-2 py-1']"
>
<RefreshIcon
class="h-4 w-4 shrink-0"
:class="{ 'animate-spin': refreshing }"
/>
<span
class="whitespace-nowrap text-xs font-bold text-slate-700 dark:text-slate-300"
>
刷新
</span>
</div>
</div>
</div>
</template>
@@ -686,7 +686,7 @@ watch(
{ deep: true },
);
defineExpose({ redraw });
defineExpose({ redraw, refresh: fetchSlices });
</script>
<template>
@@ -13,7 +13,7 @@ import {
storeOverviewHints,
} from '#/utils/overview-table-hints';
import { FINANCE_PANEL_SHELL } from '../finance-ui';
import { FINANCE_PANEL_SHELL } from '../constants/finance-ui';
defineOptions({ name: 'WorkbenchCategorySummaryTable' });
@@ -7,7 +7,7 @@ import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { formatWanShort, formatYuanDetail } from '../../../utils/money';
import { FINANCE_PANEL_SHELL } from '../finance-ui';
import { FINANCE_PANEL_SHELL } from '../constants/finance-ui';
defineOptions({ name: 'WorkbenchFinancePlatformSalesPieChart' });
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import type { WorkbenchVO } from '#/api/bi/workbench/types';
import type { FinanceKpiCardId } from '../kpi-catalog';
import type { FinanceKpiCardId } from '../constants/kpi-catalog';
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
@@ -9,18 +9,18 @@ import { Popover, Tooltip } from 'ant-design-vue';
import OverviewColumnHint from '#/components/overview/OverviewColumnHint.vue';
import { formatYuanDetail, yuanToWanNum } from '../../../utils/money';
import { getFinanceKpiHint } from '../finance-kpi-hints';
import { getFinanceKpiHint } from '../constants/finance-kpi-hints';
import {
FINANCE_KPI_CARD_SHELL,
FINANCE_TONE_ICON,
} from '../finance-ui';
} from '../constants/finance-ui';
import {
cardById,
clampFinanceKpiColsPerRow,
kpiMetaByLabel,
normalizePrimary,
sortCardIdsByCatalog,
} from '../kpi-catalog';
} from '../constants/kpi-catalog';
defineOptions({ name: 'WorkbenchFinanceKpiGrid' });
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { FinanceKpiCardId } from '../kpi-catalog';
import type { FinanceKpiCardId } from '../constants/kpi-catalog';
import { ref, watch } from 'vue';
@@ -14,7 +14,7 @@ import {
FINANCE_KPI_DEFAULT_VISIBLE_CARDS,
normalizePrimary,
type FinanceKpiColsPerRow,
} from '../kpi-catalog';
} from '../constants/kpi-catalog';
defineOptions({ name: 'WorkbenchFinanceKpiSettingsModal' });
@@ -7,7 +7,7 @@ import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { formatWanWithYuanDetail, yuanToWanNum } from '../../../utils/money';
import { FINANCE_PANEL_SHELL } from '../finance-ui';
import { FINANCE_PANEL_SHELL } from '../constants/finance-ui';
defineOptions({ name: 'WorkbenchFinanceTrendChart' });
@@ -11,7 +11,7 @@ import {
storeOverviewHints,
} from '#/utils/overview-table-hints';
import { FINANCE_PANEL_SHELL } from '../finance-ui';
import { FINANCE_PANEL_SHELL } from '../constants/finance-ui';
defineOptions({ name: 'WorkbenchPlatformSummaryCard' });
@@ -13,7 +13,7 @@ import {
storeOverviewHints,
} from '#/utils/overview-table-hints';
import { FINANCE_PANEL_SHELL } from '../finance-ui';
import { FINANCE_PANEL_SHELL } from '../constants/finance-ui';
const JumpIcon = createIconifyIcon('tdesign:jump');
@@ -13,7 +13,7 @@ import {
normalizePrimary,
sortCardIdsByCatalog,
type FinanceKpiCardId,
} from './kpi-catalog';
} from '../constants/kpi-catalog';
type PrefsV2 = {
version: 2;
@@ -13,8 +13,8 @@ import FinanceKpiSettingsModal from './components/FinanceKpiSettingsModal.vue';
import FinanceTrendChart from './components/FinanceTrendChart.vue';
import OverviewTables from './components/OverviewTables.vue';
import { useFinanceKpiPreferences } from './useFinanceKpiPreferences';
import type { FinanceKpiCardId } from './kpi-catalog';
import { useFinanceKpiPreferences } from './composables/useFinanceKpiPreferences';
import type { FinanceKpiCardId } from './constants/kpi-catalog';
import {
buildCategoryOverviewFromDimRows,