From 28706df7da34b8854cdce96ad89c035eaded6ea9 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期三, 09 四月 2025 15:54:50 +0800
Subject: [PATCH] 完善数字人

---
 src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue |   77 ++++++++++++++++++++++++++++----------
 1 files changed, 57 insertions(+), 20 deletions(-)

diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue b/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue
index 6914370..2f082a3 100644
--- a/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue
+++ b/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue
@@ -100,6 +100,10 @@
 		type: String,
 		required: false,
 	},
+	tableHeight: {
+		type: Number,
+		default: document.body.clientHeight * 0.7,
+	},
 	showFilter: {
 		type: Boolean,
 		default: true,
@@ -108,13 +112,16 @@
 		type: Boolean,
 		default: false,
 	},
-}) as {
-	data: any;
-	summaryIndex: number;
-	showFilter: Boolean;
-};
+	reportIndex: {
+		type: Number,
+		default: 0,
+	},
+	historyId: {
+		type: String,
+	},
+});
 
-const tableLimitHeight = props.chartHeight == undefined ? undefined : document.body.clientHeight * 0.7;
+const tableLimitHeight = props.chartHeight == undefined ? undefined : props.tableHeight;
 
 const chartLoading = ref(false);
 
@@ -129,6 +136,7 @@
 const getVisibleParams = (data) => {
 	// const visibleList = props.data?.params?.filter((item) => !item?.hide) ?? [];
 	// index 浣滀负 id
+	const dataFilter = data?.filter ?? [];
 	const visibleList = (data?.filter ?? []).map((item, index) => {
 		// 涓嶄慨鏀瑰師濮嬪湴鍧�
 		item.id = index + '';
@@ -183,7 +191,6 @@
 		}
 	});
 };
-
 const visibleParams = ref(getVisibleParams(props.data));
 
 const checkIsDayTime = () => {
@@ -260,7 +267,11 @@
 			const values = groupedValues[item];
 			return {
 				name: item === 'default' ? '' : item,
-				data: values.map((item) => [item[timeIndex], item[valueIndex]]),
+				data: values
+					.map((item) => [item[timeIndex], item[valueIndex]])
+					.toSorted((b, a) => {
+						return b[timeIndex].localeCompare(a[timeIndex]);
+					}),
 				...getChartTypeSeriesOption(activeChartType),
 			};
 		});
@@ -273,12 +284,10 @@
 			  }
 			: axisLabelFormatter;
 
-	const tooltipValueFormatter =
-		originChartType === ChartTypeEnum.Score
-			? (value) => {
-					return scoreMap[value];
-			  }
-			: undefined;
+	const tooltipValueFormatter = (value) => {
+		const realValue = originChartType === ChartTypeEnum.Score ? scoreMap[value] : value;
+		return realValue + (props.data.unit ? ` ${props.data.unit}` : '');
+	};
 
 	const scoreYAxisOption: echarts.YAXisComponentOption = {
 		min: 0,
@@ -349,7 +358,8 @@
 				name: timeCol?.title,
 			},
 			yAxis: {
-				name: valueCol?.title,
+				name: props.data.unit ? `${props.data.unit}` : valueCol?.title,
+
 				/** @description 涓嶅己鍒朵繚鐣� */
 				scale: true,
 				...(originChartType === ChartTypeEnum.Score ? scoreYAxisOption : {}),
@@ -436,7 +446,11 @@
 					const values = groupedValues[item];
 					return {
 						name: item === 'default' ? '' : item,
-						data: values.map((item) => [item[timeIndex], item[valueIndex]]),
+						data: values
+							.map((item) => [item[timeIndex], item[valueIndex]])
+							.toSorted((b, a) => {
+								return b[timeIndex].localeCompare(a[timeIndex]);
+							}),
 					};
 				})),
 				chartInstance.value?.setOption({
@@ -491,7 +505,7 @@
 };
 const handleQueryChange = async (val: any, item: RecordSetParamsItem) => {
 	if (!val) return;
-	const historyId = (props as any).originData.historyId;
+	const historyId = props.historyId;
 	let res = null;
 
 	// 鏀瑰彉鍘熷鍊�
@@ -509,6 +523,7 @@
 			// 鏌ヨ鍓嶅悗 agent_key 涓嶄細鍙�
 			agent_key: props.data.agent_key,
 			filter_json: JSON.stringify(filterList),
+			result_group_index: props.reportIndex,
 		};
 		res = await curveQuery(params);
 		chartLoading.value = true;
@@ -619,7 +634,11 @@
 	}, []);
 	const series = seriesData.map<echarts.SeriesOption>((item) => ({
 		name: item[0]?.[nameIndex],
-		data: item.map((item) => [item[timeIndex], item[valueIndex]]),
+		data: item
+			.map((item) => [item[timeIndex], item[valueIndex]])
+			.toSorted((b, a) => {
+				return b[timeIndex].localeCompare(a[timeIndex]);
+			}),
 		...getChartTypeSeriesOption(activeChartType),
 	}));
 	setNewOption(series, getSingleDayOption());
@@ -678,8 +697,14 @@
 		.toSorted((b, a) => {
 			return b[0].localeCompare(a[0]);
 		});
+	const getColName = (name) => {
+		if (props.data.unit) {
+			return `${name}锛�${props.data.unit}锛塦;
+		}
+		return name;
+	};
 	const cols = currentSeries.value.map((item, index) => ({
-		title: item.name ?? `鍊�${index + 1}`,
+		title: getColName(item.name ?? `鍊�${index + 1}`),
 		type: 'text',
 	}));
 
@@ -740,13 +765,25 @@
 	updateCurrent(summary?.[props.summaryIndex], true);
 };
 
+const clearChart = () => {
+	chartInstance.value.setOption(
+		{
+			title: {
+				text: '',
+			},
+			series: [],
+		},
+		true
+	);
+};
+
 defineExpose({
 	drawChart,
 	isMultiCompare,
 	handleMultiCompare,
 	handleData,
 	updateAll,
-
+	clearChart,
 	updateIndexSummary,
 });
 </script>

--
Gitblit v1.9.3