作者 dong

首页修改

@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 :class="[index + 1 < 4 && '!md:mr-4']" 9 :class="[index + 1 < 4 && '!md:mr-4']"
10 > 10 >
11 <template #action> 11 <template #action>
12 - <a-tooltip> 12 + <a-tooltip :title="item.tooltip">
13 <Icon :icon="item.icon" :size="20" /> 13 <Icon :icon="item.icon" :size="20" />
14 </a-tooltip> 14 </a-tooltip>
15 </template> 15 </template>
@@ -18,9 +18,9 @@ @@ -18,9 +18,9 @@
18 <span>平均问答次数</span> 18 <span>平均问答次数</span>
19 <span>{{ formatNumber(statistics.averageCount) }}</span> 19 <span>{{ formatNumber(statistics.averageCount) }}</span>
20 </div> 20 </div>
21 - <SingleLine v-if="index === 1" :option="option" :chartData="dailyCountsData" :seriesColor="seriesColor" height="50px" /> 21 + <SingleLine v-if="index === 1" :option="lineOption" :chartData="dailyCountsData" :seriesColor="seriesColor" height="50px" />
22 22
23 - <Bar v-if="index === 2" :option="option" :chartData="dailyRejectedCountsData" :seriesColor="seriesColor" height="50px" /> 23 + <Bar v-if="index === 2" :option="barOption" :chartData="dailyRejectedCountsData" :seriesColor="seriesColor" height="50px" />
24 24
25 <Trend 25 <Trend
26 v-if="index === 3" 26 v-if="index === 3"
@@ -124,6 +124,61 @@ @@ -124,6 +124,61 @@
124 right: 5, 124 right: 5,
125 }, 125 },
126 }); 126 });
  127 + // 分离折线图和柱状图配置
  128 + const lineOption = ref({
  129 + tooltip: {
  130 + trigger: 'axis',
  131 + formatter: (params) => {
  132 + const param = params[0];
  133 + return `${param.name}<br/>问答次数: ${param.value}`;
  134 + },
  135 + },
  136 + xAxis: {
  137 + type: 'category',
  138 + data: [], // 由组件内部填充
  139 + axisLabel: { show: false },
  140 + boundaryGap: false,
  141 + },
  142 + yAxis: {
  143 + type: 'value',
  144 + min: 0,
  145 + axisLabel: { show: false },
  146 + },
  147 + grid: {
  148 + top: 10,
  149 + bottom: 10,
  150 + left: 10,
  151 + right: 10,
  152 + containLabel: true,
  153 + },
  154 + });
  155 +
  156 + const barOption = ref({
  157 + tooltip: {
  158 + trigger: 'axis',
  159 + formatter: (params) => {
  160 + const param = params[0];
  161 + return `${param.name}<br/>拒绝次数: ${param.value}`;
  162 + },
  163 + },
  164 + xAxis: {
  165 + type: 'category',
  166 + data: [], // 由组件内部填充
  167 + axisLabel: { show: false },
  168 + },
  169 + yAxis: {
  170 + type: 'value',
  171 + min: 0,
  172 + axisLabel: { show: false },
  173 + },
  174 + grid: {
  175 + top: 10,
  176 + bottom: 10,
  177 + left: 10,
  178 + right: 10,
  179 + containLabel: true,
  180 + },
  181 + });
127 const seriesColor = computed(() => { 182 const seriesColor = computed(() => {
128 return getThemeColor.value; 183 return getThemeColor.value;
129 }); 184 });
@@ -143,23 +198,27 @@ @@ -143,23 +198,27 @@
143 title: '累计问答次数', 198 title: '累计问答次数',
144 icon: 'visit-count|svg', 199 icon: 'visit-count|svg',
145 total: totalCount || 0, 200 total: totalCount || 0,
  201 + tooltip: '系统所有问答记录,从2025年7月1日开始的第一次问答至今所有累计:' + totalCount,
146 }, 202 },
147 { 203 {
148 title: '今日问答次数', 204 title: '今日问答次数',
149 icon: 'total-sales|svg', 205 icon: 'total-sales|svg',
150 total: todayCount || 0, 206 total: todayCount || 0,
151 color: 'blue', 207 color: 'blue',
  208 + tooltip: '系统今日进行回答的问题数量:' + todayCount,
152 }, 209 },
153 { 210 {
154 title: '拒绝回答次数', 211 title: '拒绝回答次数',
155 icon: 'download-count|svg', 212 icon: 'download-count|svg',
156 total: rejectedCount || 0, 213 total: rejectedCount || 0,
157 color: 'orange', 214 color: 'orange',
  215 + tooltip: '系统拒绝回答的问题数量总计:' + rejectedCount,
158 }, 216 },
159 { 217 {
160 title: '对比前一日增长同比', 218 title: '对比前一日增长同比',
161 icon: 'transaction|svg', 219 icon: 'transaction|svg',
162 total: formatGrowthRate(growthRate), 220 total: formatGrowthRate(growthRate),
  221 + tooltip: '系统对比今天和昨天的数据增长比,计算公式为(今日回答总量-前一日回答总量/前一日回答总量)* 100',
163 }, 222 },
164 ]; 223 ];
165 }); 224 });
@@ -17,12 +17,7 @@ @@ -17,12 +17,7 @@
17 <a-tab-pane loading="true" tab="按钮统计数据" key="1"> 17 <a-tab-pane loading="true" tab="按钮统计数据" key="1">
18 <a-row> 18 <a-row>
19 <a-col :xl="16" :lg="12" :md="12" :sm="24" :xs="24"> 19 <a-col :xl="16" :lg="12" :md="12" :sm="24" :xs="24">
20 - <Bar  
21 - :chartData="barChartData"  
22 - :option="{ title: { text: '', textStyle: { fontWeight: 'lighter' } } }"  
23 - height="40vh"  
24 - :seriesColor="seriesColor"  
25 - /> 20 + <Bar :chartData="barChartData" :option="barOption" height="40vh" :seriesColor="seriesColor" />
26 </a-col> 21 </a-col>
27 <a-col :xl="8" :lg="12" :md="12" :sm="24" :xs="24"> 22 <a-col :xl="8" :lg="12" :md="12" :sm="24" :xs="24">
28 <RankList title="按钮统计榜" :list="buttonStatsData" /> 23 <RankList title="按钮统计榜" :list="buttonStatsData" />
@@ -91,6 +86,54 @@ @@ -91,6 +86,54 @@
91 })); 86 }));
92 }); 87 });
93 88
  89 + const barOption = ref({
  90 + tooltip: {
  91 + trigger: 'axis', // 使用 'axis' 而不是 'item'
  92 + formatter: (params: any) => {
  93 + // 检查参数有效性
  94 + if (!params || !params.length) return '';
  95 +
  96 + const param = params[0];
  97 + // 确保我们访问的是正确的数据结构
  98 + if (param && param.data && param.data.name && param.data.value) {
  99 + return `${param.data.name}<br/>问答次数: ${param.data.value}`;
  100 + }
  101 +
  102 + // 备选访问方式
  103 + if (param && param.name && param.value) {
  104 + return `${param.name}<br/>问答次数: ${param.value}`;
  105 + }
  106 +
  107 + return '数据加载中...';
  108 + },
  109 + },
  110 + grid: {
  111 + top: 30,
  112 + bottom: 60, // 增加底部空间以容纳旋转的标签
  113 + left: 30,
  114 + right: 30,
  115 + },
  116 + xAxis: {
  117 + type: 'category',
  118 + axisLabel: {
  119 + interval: 0, // 强制显示所有标签
  120 + formatter: (value: string) => {
  121 + // 截断过长的标签
  122 + return value.length > 6 ? value.substring(0, 6) + '...' : value;
  123 + },
  124 + },
  125 + },
  126 + yAxis: {
  127 + type: 'value',
  128 + },
  129 + series: [
  130 + {
  131 + type: 'bar',
  132 + barWidth: '60%',
  133 + },
  134 + ],
  135 + });
  136 +
94 // 初始化加载数据 137 // 初始化加载数据
95 onMounted(() => { 138 onMounted(() => {
96 fetchButtonStats(); 139 fetchButtonStats();
@@ -6,11 +6,11 @@ @@ -6,11 +6,11 @@
6 <a-col :span="24"> 6 <a-col :span="24">
7 <a-card :loading="questionLoading" :bordered="false" title="问题输入量统计"> 7 <a-card :loading="questionLoading" :bordered="false" title="问题输入量统计">
8 <div class="infoArea"> 8 <div class="infoArea">
9 - <HeadInfo title="今日" :iconColor="ipColor" :content="formatNumber(questionStats.todayCount)" icon="environment" />  
10 - <HeadInfo title="本周" :iconColor="ipColor" :content="formatNumber(questionStats.weekCount)" icon="environment" />  
11 - <HeadInfo title="本月" :iconColor="ipColor" :content="formatNumber(questionStats.monthCount)" icon="environment" />  
12 - <HeadInfo title="本年" :iconColor="ipColor" :content="formatNumber(questionStats.yearCount)" icon="environment" />  
13 - <HeadInfo title="总计" :iconColor="seriesColor" :content="formatNumber(questionStats.totalCount)" icon="rise" /> 9 + <HeadInfo title="今日" :iconColor="black" :content="formatNumber(questionStats.todayCount)" icon="environment" />
  10 + <HeadInfo title="本周" :iconColor="black" :content="formatNumber(questionStats.weekCount)" icon="environment" />
  11 + <HeadInfo title="本月" :iconColor="black" :content="formatNumber(questionStats.monthCount)" icon="environment" />
  12 + <HeadInfo title="本年" :iconColor="black" :content="formatNumber(questionStats.yearCount)" icon="environment" />
  13 + <HeadInfo title="总计" :iconColor="black" :content="formatNumber(questionStats.totalCount)" icon="rise" />
14 </div> 14 </div>
15 <!-- <LineMulti :chartData="lineMultiData" height="33vh" type="line" :option="{ legend: { top: 'bottom' } }" />--> 15 <!-- <LineMulti :chartData="lineMultiData" height="33vh" type="line" :option="{ legend: { top: 'bottom' } }" />-->
16 </a-card> 16 </a-card>
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
25 import HeadInfo from '/@/components/chart/HeadInfo.vue'; 25 import HeadInfo from '/@/components/chart/HeadInfo.vue';
26 import { getLoginfo, getQuestionStatistics, getStatistics, getVisitInfo } from '../api'; 26 import { getLoginfo, getQuestionStatistics, getStatistics, getVisitInfo } from '../api';
27 import { useRootSetting } from '/@/hooks/setting/useRootSetting'; 27 import { useRootSetting } from '/@/hooks/setting/useRootSetting';
  28 + import {black} from "picocolors";
28 29
29 const loading = ref(true); 30 const loading = ref(true);
30 const questionLoading = ref(true); 31 const questionLoading = ref(true);
1 <template> 1 <template>
2 <div> 2 <div>
3 - <div class="knowledge-header" v-if="currentKnowledge">  
4 - <div class="header-container">  
5 - <h2 class="knowledge-title">{{ currentKnowledge.name }} - 文档列表</h2>  
6 - <a-button type="link" @click="goBack" class="back-button"> <Icon icon="ant-design:arrow-left-outlined" /> 返回知识库列表 </a-button>  
7 - </div>  
8 - </div>  
9 <!--引用表格--> 3 <!--引用表格-->
10 <BasicTable @register="registerTable" :rowSelection="rowSelection"> 4 <BasicTable @register="registerTable" :rowSelection="rowSelection">
11 <!--插槽:table标题--> 5 <!--插槽:table标题-->
@@ -87,10 +81,6 @@ @@ -87,10 +81,6 @@
87 loadKnowledgeMap(); 81 loadKnowledgeMap();
88 }); 82 });
89 83
90 - // 返回知识库列表  
91 - function goBack() {  
92 - router.push('/super/airag/aiknowledge/AiKnowledgeBaseList');  
93 - }  
94 // 知识库名称映射 84 // 知识库名称映射
95 const knowledgeMap = ref<Record<string, string>>({}); 85 const knowledgeMap = ref<Record<string, string>>({});
96 86