From bcff2cf9253145d0dd4b36daed70a12ecbd2ff54 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期五, 26 七月 2024 10:56:57 +0800
Subject: [PATCH] 选择宽度自适应

---
 src/components/chat/chatComponents/summaryCom/components/deviceLastValue/DeviceLastValueCom.vue |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/components/chat/chatComponents/summaryCom/components/deviceLastValue/DeviceLastValueCom.vue b/src/components/chat/chatComponents/summaryCom/components/deviceLastValue/DeviceLastValueCom.vue
index 405c5a7..8ded22a 100644
--- a/src/components/chat/chatComponents/summaryCom/components/deviceLastValue/DeviceLastValueCom.vue
+++ b/src/components/chat/chatComponents/summaryCom/components/deviceLastValue/DeviceLastValueCom.vue
@@ -8,6 +8,9 @@
 					backgroundColor: BORDER_COLOR,
 				}"
 			>
+				<div class="flex-center font-bold text-base bg-[#8db4e2]" :style="{ height: `${CELL_HEIGHT}px` }">
+					{{ data.title }}
+				</div>
 				<div
 					v-for="(rowChunk, index) in currentRowChunkList"
 					:key="index"
@@ -162,12 +165,15 @@
 const restColWidth = ref(colHeaderCellContentWidth.value);
 const calcMaxRowsNum = (groupCount: number, height, extraHeight = 0) => {
 	return Math.floor(
-		(height - THICK_BORDER_WIDTH - extraHeight) /
+		(height - 2 * THICK_BORDER_WIDTH - CELL_HEIGHT - extraHeight) /
 			(CELL_HEIGHT * groupCount + 2 * THICK_BORDER_WIDTH + THIN_BORDER_WIDTH * (groupCount - 2))
 	);
 };
 let maxColsNum = ref<number>(null);
 const resizeEvent = ({ width, height }) => {
+	if (width === 0 || height === 0) {
+		return;
+	}
 	// 鎸夋渶澶у搴︾畻鏈�澶у垪鏁�
 	maxColsNum.value = Math.floor(
 		(width - THICK_BORDER_WIDTH + colHeaderCellContentWidth.value - rowHeaderCellContentWidth.value) /
@@ -262,7 +268,7 @@
 // const groupCount = (TEST_DATA?.rows?.length ?? 0) + 1;
 // 璁$畻鏈�澶ц鏁�
 // y * (cellHeight * groupCount) +
-// 	(y - 1) * (2 * thickBorderWidth) +
+// 	(y - 1) * (2 * thickBorderWidth) +cellHeight+thickBorderWidth
 // 	thickBorderWidth +
 // 	thickBorderWidth * 2 +
 // 	y * (groupCount - 2) * thinBorderWidth <=
@@ -273,13 +279,6 @@
 // y<= (height-thickBorderWidth)/(cellHeight * groupCount + 2 * thickBorderWidth + thinBorderWidth(groupCount - 2) )
 
 onMounted(() => {
-	resizeEvent({
-		width: containerRef.value.clientWidth,
-		height: 0.7 * document.body.clientHeight,
-	});
-});
-
-onActivated(() => {
 	resizeEvent({
 		width: containerRef.value.clientWidth,
 		height: 0.7 * document.body.clientHeight,

--
Gitblit v1.9.3