From 27c8277d717b34b55f3ea967027b53b067f77df3 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期四, 20 八月 2026 16:58:49 +0800
Subject: [PATCH] feat 功能变更
---
src/views/bi/decision/trend-analysis/index.vue | 87 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 87 insertions(+), 0 deletions(-)
diff --git a/src/views/bi/decision/trend-analysis/index.vue b/src/views/bi/decision/trend-analysis/index.vue
new file mode 100644
index 0000000..7919f94
--- /dev/null
+++ b/src/views/bi/decision/trend-analysis/index.vue
@@ -0,0 +1,87 @@
+<script lang="ts" setup>
+import { onMounted, ref } from 'vue';
+
+import { Page } from '@vben/common-ui';
+
+import { Select, Spin, Table } from 'ant-design-vue';
+
+import { getKpiOverview } from '#/api/bi/decision/kpi';
+
+defineOptions({ name: 'DecisionTrendAnalysis' });
+
+const loading = ref(false);
+const trendData = ref<any[]>([]);
+const selectedCategory = ref<string>('');
+
+const CATEGORY_OPTIONS = [
+ { label: '鍏ㄩ儴', value: '' },
+ { label: '渚涚數閲�', value: 'power_supply' },
+ { label: '璁惧杩愯', value: 'device_operation' },
+ { label: '鐢熶骇', value: 'production' },
+ { label: '璐ㄩ噺', value: 'quality' },
+ { label: '閲囪喘', value: 'procurement' },
+ { label: '瀹夊叏', value: 'safety' },
+];
+
+const columns = [
+ { title: 'KPI鍚嶇О', dataIndex: 'name', key: 'name', width: 150 },
+ { title: '鍒嗙被', dataIndex: 'category', key: 'category', width: 100 },
+ { title: '褰撳墠鍊�', dataIndex: 'value', key: 'value', width: 120 },
+ { title: '鍗曚綅', dataIndex: 'unit', key: 'unit', width: 80 },
+ { title: '棰勮鐘舵��', dataIndex: 'alertStatus', key: 'alertStatus', width: 100 },
+];
+
+async function loadData() {
+ loading.value = true;
+ try {
+ const overview = await getKpiOverview();
+ let list = overview.kpis || [];
+ if (selectedCategory.value) {
+ list = list.filter((k) => k.category === selectedCategory.value);
+ }
+ trendData.value = list;
+ } catch {
+ trendData.value = [];
+ } finally {
+ loading.value = false;
+ }
+}
+
+onMounted(loadData);
+</script>
+
+<template>
+ <Page :auto-content-height="true">
+ <div class="p-4">
+ <div class="mb-4 flex items-center gap-4">
+ <h2 class="text-lg font-bold">瓒嬪娍鍒嗘瀽</h2>
+ <Select
+ v-model:value="selectedCategory"
+ :options="CATEGORY_OPTIONS"
+ style="width: 160px"
+ allow-clear
+ @change="loadData"
+ />
+ </div>
+
+ <Spin :spinning="loading">
+ <Table
+ :columns="columns"
+ :data-source="trendData"
+ :pagination="{ pageSize: 20 }"
+ row-key="code"
+ bordered
+ size="middle"
+ >
+ <template #bodyCell="{ column, record }">
+ <template v-if="column.key === 'alertStatus'">
+ <span v-if="record.alertStatus === 'critical'" class="text-red-500">涓ラ噸</span>
+ <span v-else-if="record.alertStatus === 'warn'" class="text-orange-500">璀﹀憡</span>
+ <span v-else class="text-green-500">姝e父</span>
+ </template>
+ </template>
+ </Table>
+ </Spin>
+ </div>
+ </Page>
+</template>
\ No newline at end of file
--
Gitblit v1.9.3