作者 dong

首页修改

... ... @@ -9,7 +9,7 @@
:class="[index + 1 < 4 && '!md:mr-4']"
>
<template #action>
<a-tooltip>
<a-tooltip :title="item.tooltip">
<Icon :icon="item.icon" :size="20" />
</a-tooltip>
</template>
... ... @@ -18,9 +18,9 @@
<span>平均问答次数</span>
<span>{{ formatNumber(statistics.averageCount) }}</span>
</div>
<SingleLine v-if="index === 1" :option="option" :chartData="dailyCountsData" :seriesColor="seriesColor" height="50px" />
<SingleLine v-if="index === 1" :option="lineOption" :chartData="dailyCountsData" :seriesColor="seriesColor" height="50px" />
<Bar v-if="index === 2" :option="option" :chartData="dailyRejectedCountsData" :seriesColor="seriesColor" height="50px" />
<Bar v-if="index === 2" :option="barOption" :chartData="dailyRejectedCountsData" :seriesColor="seriesColor" height="50px" />
<Trend
v-if="index === 3"
... ... @@ -124,6 +124,61 @@
right: 5,
},
});
// 分离折线图和柱状图配置
const lineOption = ref({
tooltip: {
trigger: 'axis',
formatter: (params) => {
const param = params[0];
return `${param.name}<br/>问答次数: ${param.value}`;
},
},
xAxis: {
type: 'category',
data: [], // 由组件内部填充
axisLabel: { show: false },
boundaryGap: false,
},
yAxis: {
type: 'value',
min: 0,
axisLabel: { show: false },
},
grid: {
top: 10,
bottom: 10,
left: 10,
right: 10,
containLabel: true,
},
});
const barOption = ref({
tooltip: {
trigger: 'axis',
formatter: (params) => {
const param = params[0];
return `${param.name}<br/>拒绝次数: ${param.value}`;
},
},
xAxis: {
type: 'category',
data: [], // 由组件内部填充
axisLabel: { show: false },
},
yAxis: {
type: 'value',
min: 0,
axisLabel: { show: false },
},
grid: {
top: 10,
bottom: 10,
left: 10,
right: 10,
containLabel: true,
},
});
const seriesColor = computed(() => {
return getThemeColor.value;
});
... ... @@ -143,23 +198,27 @@
title: '累计问答次数',
icon: 'visit-count|svg',
total: totalCount || 0,
tooltip: '系统所有问答记录,从2025年7月1日开始的第一次问答至今所有累计:' + totalCount,
},
{
title: '今日问答次数',
icon: 'total-sales|svg',
total: todayCount || 0,
color: 'blue',
tooltip: '系统今日进行回答的问题数量:' + todayCount,
},
{
title: '拒绝回答次数',
icon: 'download-count|svg',
total: rejectedCount || 0,
color: 'orange',
tooltip: '系统拒绝回答的问题数量总计:' + rejectedCount,
},
{
title: '对比前一日增长同比',
icon: 'transaction|svg',
total: formatGrowthRate(growthRate),
tooltip: '系统对比今天和昨天的数据增长比,计算公式为(今日回答总量-前一日回答总量/前一日回答总量)* 100',
},
];
});
... ...
... ... @@ -17,12 +17,7 @@
<a-tab-pane loading="true" tab="按钮统计数据" key="1">
<a-row>
<a-col :xl="16" :lg="12" :md="12" :sm="24" :xs="24">
<Bar
:chartData="barChartData"
:option="{ title: { text: '', textStyle: { fontWeight: 'lighter' } } }"
height="40vh"
:seriesColor="seriesColor"
/>
<Bar :chartData="barChartData" :option="barOption" height="40vh" :seriesColor="seriesColor" />
</a-col>
<a-col :xl="8" :lg="12" :md="12" :sm="24" :xs="24">
<RankList title="按钮统计榜" :list="buttonStatsData" />
... ... @@ -91,6 +86,54 @@
}));
});
const barOption = ref({
tooltip: {
trigger: 'axis', // 使用 'axis' 而不是 'item'
formatter: (params: any) => {
// 检查参数有效性
if (!params || !params.length) return '';
const param = params[0];
// 确保我们访问的是正确的数据结构
if (param && param.data && param.data.name && param.data.value) {
return `${param.data.name}<br/>问答次数: ${param.data.value}`;
}
// 备选访问方式
if (param && param.name && param.value) {
return `${param.name}<br/>问答次数: ${param.value}`;
}
return '数据加载中...';
},
},
grid: {
top: 30,
bottom: 60, // 增加底部空间以容纳旋转的标签
left: 30,
right: 30,
},
xAxis: {
type: 'category',
axisLabel: {
interval: 0, // 强制显示所有标签
formatter: (value: string) => {
// 截断过长的标签
return value.length > 6 ? value.substring(0, 6) + '...' : value;
},
},
},
yAxis: {
type: 'value',
},
series: [
{
type: 'bar',
barWidth: '60%',
},
],
});
// 初始化加载数据
onMounted(() => {
fetchButtonStats();
... ...
... ... @@ -6,11 +6,11 @@
<a-col :span="24">
<a-card :loading="questionLoading" :bordered="false" title="问题输入量统计">
<div class="infoArea">
<HeadInfo title="今日" :iconColor="ipColor" :content="formatNumber(questionStats.todayCount)" icon="environment" />
<HeadInfo title="本周" :iconColor="ipColor" :content="formatNumber(questionStats.weekCount)" icon="environment" />
<HeadInfo title="本月" :iconColor="ipColor" :content="formatNumber(questionStats.monthCount)" icon="environment" />
<HeadInfo title="本年" :iconColor="ipColor" :content="formatNumber(questionStats.yearCount)" icon="environment" />
<HeadInfo title="总计" :iconColor="seriesColor" :content="formatNumber(questionStats.totalCount)" icon="rise" />
<HeadInfo title="今日" :iconColor="black" :content="formatNumber(questionStats.todayCount)" icon="environment" />
<HeadInfo title="本周" :iconColor="black" :content="formatNumber(questionStats.weekCount)" icon="environment" />
<HeadInfo title="本月" :iconColor="black" :content="formatNumber(questionStats.monthCount)" icon="environment" />
<HeadInfo title="本年" :iconColor="black" :content="formatNumber(questionStats.yearCount)" icon="environment" />
<HeadInfo title="总计" :iconColor="black" :content="formatNumber(questionStats.totalCount)" icon="rise" />
</div>
<!-- <LineMulti :chartData="lineMultiData" height="33vh" type="line" :option="{ legend: { top: 'bottom' } }" />-->
</a-card>
... ... @@ -25,6 +25,7 @@
import HeadInfo from '/@/components/chart/HeadInfo.vue';
import { getLoginfo, getQuestionStatistics, getStatistics, getVisitInfo } from '../api';
import { useRootSetting } from '/@/hooks/setting/useRootSetting';
import {black} from "picocolors";
const loading = ref(true);
const questionLoading = ref(true);
... ...
<template>
<div>
<div class="knowledge-header" v-if="currentKnowledge">
<div class="header-container">
<h2 class="knowledge-title">{{ currentKnowledge.name }} - 文档列表</h2>
<a-button type="link" @click="goBack" class="back-button"> <Icon icon="ant-design:arrow-left-outlined" /> 返回知识库列表 </a-button>
</div>
</div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
... ... @@ -87,10 +81,6 @@
loadKnowledgeMap();
});
// 返回知识库列表
function goBack() {
router.push('/super/airag/aiknowledge/AiKnowledgeBaseList');
}
// 知识库名称映射
const knowledgeMap = ref<Record<string, string>>({});
... ...