云
2 天以前 3268de7494d5281186bb692635540e38db251e13
src/views/dashboard/analytics/index.vue
@@ -4,7 +4,7 @@
import { Page } from '@vben/common-ui';
import { Card, Col, Row } from 'ant-design-vue';
import { Col, Row } from 'ant-design-vue';
import { getHomeSummary } from '#/api/mes/home';
@@ -15,11 +15,13 @@
import KpiCards from './modules/kpi-cards.vue';
import ProductionTrend from './modules/production-trend.vue';
import QuickActions from './modules/quick-actions.vue';
import { useHomeAccess } from './use-home-access';
defineOptions({ name: 'DashboardAnalytics' });
const router = useRouter();
const summary = ref(defaultSummary);
const { canNavigate, canViewHome } = useHomeAccess();
const greeting = computed(() => {
  const hour = new Date().getHours();
@@ -38,10 +40,12 @@
});
function handleNavigate(name: string) {
  if (!canNavigate(name)) return;
  router.push({ name });
}
async function loadSummary() {
  if (!canViewHome.value) return;
  summary.value = await getHomeSummary();
}
@@ -72,19 +76,20 @@
    </div>
    <!-- MES 生产 KPI -->
    <KpiCards :summary="summary" @navigate="handleNavigate" />
    <KpiCards v-if="canViewHome" :summary="summary" @navigate="handleNavigate" />
    <!-- ERP/WMS/BPM 经营 KPI -->
    <BizCards @navigate="handleNavigate" />
    <!-- AI 智能分析 -->
    <AiInsights
      v-if="canViewHome && canNavigate('MesProWorkOrder')"
      :active-order-count="summary.workOrderActiveCount"
      @navigate="handleNavigate"
    />
    <!-- 生产趋势 + 预警面板 -->
    <Row :gutter="16" class="mb-4">
    <Row v-if="canViewHome" :gutter="16" class="mb-4">
      <Col :lg="14" :md="24" :sm="24" :xl="14" :xs="24" class="mb-4">
        <div class="glass-card rounded-2xl p-5">
          <h3 class="mb-4 text-base font-semibold text-gray-800 dark:text-gray-100">