From 022a757742c70b3106d817461464e821b537e794 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期二, 05 十一月 2024 13:20:40 +0800
Subject: [PATCH] process loading bug;报告

---
 src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue |   72 ++++++++++++++++++++++++++---------
 1 files changed, 53 insertions(+), 19 deletions(-)

diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue b/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue
index 722568e..e16eb87 100644
--- a/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue
+++ b/src/components/chat/chatComponents/summaryCom/components/recordSet/RecordSet.vue
@@ -3,7 +3,7 @@
 	<div class="w-full flex-column">
 		<div class="flex mb-4 flex-wrap flex-0">
 			<!-- TimeRange v-model 璺� @change 涓殑鍊间細涓嶄竴鏍凤紝浠change 涓负鍑� -->
-			<template v-if="visibleParams && visibleParams.length > 0">
+			<template v-if="visibleParams && visibleParams.length > 0 && showFilter">
 				<component
 					class="flex-0 m-2"
 					v-model="visibleParams[index].value"
@@ -34,7 +34,13 @@
 			<DisplayMode class="ml-auto" v-model="showMode" @change="displayModeChange" />
 		</div>
 
-		<RecordSetTable :data="tableData" v-if="tableIsShow" :key="tableKey" :tableLimitHeight="tableLimitHeight" />
+		<RecordSetTable
+			:data="tableData"
+			v-if="tableIsShow"
+			:key="tableKey"
+			:tableLimitHeight="tableLimitHeight"
+			:class="{ 'flex-auto': chartHeight == undefined }"
+		/>
 		<div
 			v-show="!tableIsShow"
 			:style="{ height: chartHeight }"
@@ -66,6 +72,7 @@
 import { axisLabelFormatter } from '/@/utils/chart';
 import { deepClone } from '/@/utils/other';
 import { debounce } from '/@/utils/util';
+import { IS_DAY_LIST } from './components/constants';
 const chartRef = ref<HTMLDivElement>(null);
 
 const showMode = ref(DisplayModeType.Chart);
@@ -74,6 +81,7 @@
 // 		type: Object as PropType<RecordSet>,
 // 	},
 // });
+
 const emits = defineEmits<{
 	(event: 'updateQuery', res: any): void;
 }>();
@@ -92,10 +100,16 @@
 		type: String,
 		required: false,
 	},
+	showFilter: {
+		type: Boolean,
+		default: true,
+	},
 }) as {
 	data: any;
 	summaryIndex: number;
+	showFilter: Boolean;
 };
+
 const tableLimitHeight = props.chartHeight == undefined ? undefined : document.body.clientHeight * 0.7;
 
 const chartLoading = ref(false);
@@ -167,6 +181,16 @@
 };
 
 const visibleParams = ref(getVisibleParams(props.data));
+
+const checkIsDayTime = () => {
+	if (!props.showFilter) return false;
+	const stepFilter = visibleParams.value.find((item) => item.type === RecordSetParamsType.Step);
+	if (!stepFilter.origin.step_value) return false;
+
+	return IS_DAY_LIST.includes(stepFilter.origin.step_value);
+};
+// 璺ㄥ害鏄惁鏄棩鏈熷舰寮�
+// const isDayTime = checkIsDayTime();
 let groupedValues = null;
 let timeIndex = undefined;
 let valueIndex = undefined;
@@ -387,32 +411,36 @@
 };
 const { chartContainerResize, chartInstance } = useDrawChatChart({ chartRef, drawChart });
 
-const updateCurrent = (res) => {
+const updateCurrent = (res, isNew = false) => {
 	const title = res?.title;
 	const values = res?.values ?? [];
 	//#region ====================== 鍒锋柊褰撳墠 filter ======================
 	// 鍙洿鏂� value锛屼笉鐩存帴瑕嗙洊锛岄槻姝涪澶卞搷搴旀��
-	updateVisibleParams(res);
+	// updateVisibleParams(res);
 	//#endregion
 	groupedValues = _.groupBy(values, (item) => item[nameIndex]);
 	if (isMultiCompare.value) {
 		handleMultiCompare();
 	} else {
-		(currentSeries.value =
-			groupedValues &&
-			Object.keys(groupedValues).map((item, index) => {
-				const values = groupedValues[item];
-				return {
-					name: currentSeries.value[index].name,
-					data: values.map((item) => [item[timeIndex], item[valueIndex]]),
-				};
-			})),
-			chartInstance.value.setOption({
-				title: {
-					text: title,
-				},
-				series: currentSeries.value,
-			});
+		if (isNew) {
+			setNewOption();
+		} else {
+			(currentSeries.value =
+				groupedValues &&
+				Object.keys(groupedValues).map((item, index) => {
+					const values = groupedValues[item];
+					return {
+						name: item === 'default' ? '' : item,
+						data: values.map((item) => [item[timeIndex], item[valueIndex]]),
+					};
+				})),
+				chartInstance.value?.setOption({
+					title: {
+						text: title,
+					},
+					series: currentSeries.value,
+				});
+		}
 	}
 };
 
@@ -692,12 +720,18 @@
 	updateCurrent(newSummary);
 };
 
+const updateIndexSummary = (summary) => {
+	updateCurrent(summary?.[props.summaryIndex], true);
+};
+
 defineExpose({
 	drawChart,
 	isMultiCompare,
 	handleMultiCompare,
 	handleData,
 	updateAll,
+
+	updateIndexSummary,
 });
 </script>
 <style scoped lang="scss"></style>

--
Gitblit v1.9.3