From 4c20089472b20319746649decbce3a11f16cb6a0 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期五, 07 二月 2025 18:43:24 +0800
Subject: [PATCH] 切换主题,自身设置颜色、大小

---
 src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue |  254 +++++++++++++++++++++++++++-----------------------
 1 files changed, 135 insertions(+), 119 deletions(-)

diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue b/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue
index b9b0732..6606d1a 100644
--- a/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue
+++ b/src/components/chat/chatComponents/summaryCom/components/recordSetTable/map/Map.vue
@@ -1,148 +1,164 @@
 <template>
 	<div class="h-[60vh] relative">
-		<div ref="containerRef" class="h-full"></div>
-		<!-- <div v-if="bottomBarIsShow" class="absolute w-full bottom-0 bg-white border-gray-300 border border-solid">
-			<div
-				class="w-28 h-5 absolute left-1/2 -translate-x-1/2 -translate-y-[100%] cursor-pointer bg-[#4974f3] rounded-t-lg flex-center"
-				@click="toggleShowChart"
-			>
-				<div
-					class="ywifont -rotate-90 text-white !text-[13px]"
-					:class="{ 'ywicon-zuoyoujiantou': chartIsShow, 'ywicon-zuoyoujiantou1': !chartIsShow }"
-				></div>
-			</div>
-		</div> -->
+		<!-- 鍘熷鍦板浘瀹瑰櫒 -->
+		<BasicMap
+			ref="normalMapRef"
+			v-show="!isFullscreen"
+			class="h-full"
+			:data="data"
+			@markerClick="markerClick"
+			@closeInfoWindow="closeInfoWindow"
+		/>
+		<!-- 鍏ㄥ睆鎸夐挳 -->
+		<div class="absolute right-2 top-2 cursor-pointer" @click="toggleFullScreen">
+			<el-tooltip content="鍏ㄥ睆灞曞紑" placement="top">
+				<div class="ywifont !text-[20px] text-black rounded-lg ywicon-fullscreen"></div>
+			</el-tooltip>
+		</div>
+
+		<!-- Teleport 鍏ㄥ睆鍦板浘 -->
+		<Teleport to=".layout-parent">
+			<Transition name="fullscreen">
+				<div v-if="isRenderFullscreen" v-show="isFullscreen" class="absolute inset-0 z-50 w-full h-full">
+					<BasicMap
+						ref="fullScreenMapRef"
+						:config="fullScreenMapConfig"
+						class="h-full"
+						:data="data"
+						@markerClick="markerClick"
+						@closeInfoWindow="closeInfoWindow"
+					/>
+					<div class="absolute right-2 top-2 cursor-pointer" @click="toggleFullScreen">
+						<el-tooltip content="閫�鍑哄叏灞忥紙Esc锛�" placement="top">
+							<div class="ywifont !text-[20px] text-black rounded-lg ywicon-tuichuquanping"></div>
+						</el-tooltip>
+					</div>
+					<div class="absolute bottom-0 w-full">
+						<EquipCurve
+							v-model:isShow="chartDlgIsShow"
+							class="opacity-90"
+							:data="equipCurveMapRow"
+							:quotaChartCol="data?.quota_chart?.col"
+							height="15rem"
+							:tableHeight="240"
+						/>
+					</div>
+					<SmallChat class="absolute bottom-0 right-0" :olMap="fullScreenOlMap" />
+				</div>
+			</Transition>
+		</Teleport>
 	</div>
 </template>
 
 <script setup lang="ts">
-import { onMounted, ref } from 'vue';
+import 'ol/ol.css';
+import { computed, nextTick, onDeactivated, onMounted, onUnmounted, ref } from 'vue';
+import EquipCurve from '../components/EquipCurve.vue';
+import BasicMap from './BasicMap.vue';
+import SmallChat from '/@/components/chat/smallChat/index.vue';
+import { GaoDeSourceType } from '/@/model/map/OLMap';
+import { useCompRef } from '/@/utils/types';
+const isRenderFullscreen = ref(false);
 
-import equipPic from './img/equip.svg';
-import type { GaoDePosition, LabelMarkerData } from '/@/model/map/GaoDeMap';
-import { GaoDeMap } from '/@/model/map/GaoDeMap';
-
-let gaoDeMap = new GaoDeMap();
-const containerRef = ref<HTMLDivElement>(null);
+const isFullscreen = ref(false);
 const props = defineProps(['data']);
+const normalMapRef = useCompRef(BasicMap);
+const fullScreenMapRef = useCompRef(BasicMap);
+const fullScreenOlMap = computed(() => fullScreenMapRef.value?.olMap);
+const emit = defineEmits(['equipClick', 'closeInfoWindow']);
 
-const emit = defineEmits(['equipClick'])
-const createInfoWindow = () => {
-	// title
-	// <div class="title flex-center bg-[#ca0dab] text-white py-0.5 mb-2 w-full over-ellipsis">
-	// 			缃楁眽楸�
-	// 		</div>
-	const dom = `<div class="rounded-md text-nowrap flex flex-col  w-fit border border-solid border-blue-600 text-blue-600" style="padding: 12px">
-			
-			<div class="space-x-4 flex w-full">
-				<div class="flex flex-col w-1/2 key-list">
-					
-				</div>
-
-				<div class="flex flex-col w-1/2 value-list">
-					
-				</div>
-			</div>
-		</div>`;
-
-	return dom;
+const markerClick = (row) => {
+	if (isFullscreen.value) {
+		showCurve(row);
+	} else {
+		emit('equipClick', row);
+	}
+};
+const closeInfoWindow = () => {
+	if (isFullscreen.value) {
+		closeChartDlg();
+	} else {
+		emit('closeInfoWindow');
+	}
 };
 
-const updateInfoWindow = (item) => {
-	const cellHeight = '20px';
-	const keyListDom = infoWindow.dom.querySelector('.key-list');
-	const valueListDom = infoWindow.dom.querySelector('.value-list')
+const fullScreenMapConfig = ref({
+	sourceType: GaoDeSourceType.Vector,
+	markerIsVisible: true,
+});
+// 鍒囨崲鍏ㄥ睆
+const toggleFullScreen = async () => {
+	isFullscreen.value = !isFullscreen.value;
 
-	const colsArray = props.data.cols ?? [];
-	const keyItemHtml = colsArray
-		.map((col) => {
-			return `<span class="flex-items-center justify-start" style="height:${cellHeight}">${col.title??''}</span>`;
-		})
-		.join('');
-
-	const valueItemHtml = colsArray
-		.map((col, index) => {
-			return `<span class="flex-items-center justify-end" style="height:${cellHeight}">${item[index] ??''}</span>`;
-		})
-		.join('');
-
-	keyListDom.innerHTML = keyItemHtml;
-	valueListDom.innerHTML = valueItemHtml;
+	await nextTick();
+	if (isFullscreen.value) {
+		const config = normalMapRef.value.olMap.getConfig();
+		if (!isRenderFullscreen.value) {
+			fullScreenMapConfig.value = config;
+			isRenderFullscreen.value = true;
+		} else {
+			// fullScreenMapRef.value.olMap.setConfig(config);
+		}
+		closeInfoWindow();
+	} else {
+		const config = fullScreenMapRef.value.olMap.getConfig();
+		// normalMapRef.value.olMap.setConfig(config);
+	}
 };
 
-const addMarkerLayer = () => {
-	const map = props.data.map;
-	if (map.pos_x == null && map.pos_y == null) return;
-
-	const dataList = (props.data?.values ?? []).map((item) => {
-		const x = item[map.pos_x];
-		const y = item[map.pos_y];
-
-		return {
-			position: [x, y],
-			// textColor: item.color,
-			extData: item,
-			title: item.title,
-		};
-	});
-	gaoDeMap.addMarkerLayer(dataList, {
-		markerOpt: {
-			icon: {
-				url: equipPic,
-				size: 30,
-			},
-			click(e, label) {
-				// if (!bottomBarIsShow.value) {
-				// 	bottomBarIsShow.value = true;
-				// }
-				// if (!chartIsShow.value) {
-				// 	chartIsShow.value = true;
-				// }
-				infoWindow.open(gaoDeMap.map, label.getPosition() as any);
-				const extData = label.getExtData();
-				emit('equipClick',extData);
-				updateInfoWindow(extData);
-			},
-		},
-		layerOpt: {
-			// allowCollision:false
-		},
-	});
+//#region ====================== 璁惧鏇茬嚎 ======================
+const chartDlgIsShow = ref(false);
+const equipCurveMapRow = ref(null);
+const showCurve = (row) => {
+	equipCurveMapRow.value = row;
+	chartDlgIsShow.value = true;
 };
 
-const bottomBarIsShow = ref(false);
-const chartIsShow = ref(true);
-const toggleShowChart = () => {
-	chartIsShow.value = !chartIsShow.value;
+const closeChartDlg = () => {
+	chartDlgIsShow.value = false;
+	equipCurveMapRow.value = null;
 };
+//#endregion
 
-let infoWindow: AMap.InfoWindow;
+// 娣诲姞 ESC 閿洃鍚嚱鏁�
+const handleEscKey = (event: KeyboardEvent) => {
+	if (event.key === 'Escape' && isFullscreen.value) {
+		toggleFullScreen();
+	}
+};
 
 onMounted(async () => {
-	await gaoDeMap.init({
-		container: containerRef.value,
-		aMapOption: {
-			resizeEnable: true,
-		},
-	});
-	// const southWest: GaoDePosition = [props.data.minx, props.data.miny];
-	// const northEast: GaoDePosition = [props.data.maxx, props.data.maxy];
-	// gaoDeMap.zoomToRect(southWest, northEast);
-	gaoDeMap.applyBasicPlugins();
+	// 娣诲姞 ESC 閿洃鍚�
+	document.addEventListener('keydown', handleEscKey);
+	// toggleFullScreen();
+});
 
-	addMarkerLayer();
-	gaoDeMap.map.setFitView();
+onDeactivated(async () => {
+	if (isFullscreen.value) {
+		await toggleFullScreen();
+	}
+});
 
-	infoWindow = new AMap.InfoWindow({
-		content: createInfoWindow(),
-		// offset: [3, -34],
-		anchor: 'top-left',
-		closeWhenClickMap: true,
-	});
+// 鍦ㄧ粍浠跺嵏杞芥椂绉婚櫎鐩戝惉
+onUnmounted(() => {
+	// 绉婚櫎 ESC 閿洃鍚�
+	document.removeEventListener('keydown', handleEscKey);
 });
 </script>
 <style scoped lang="scss">
 :deep(.amap-info-content) {
 	padding: 0;
 }
+
+// 鍏ㄥ睆杩囨浮鍔ㄧ敾
+.fullscreen-enter-active,
+.fullscreen-leave-active {
+	transition: all 0.3s ease;
+}
+
+.fullscreen-enter-from,
+.fullscreen-leave-to {
+	opacity: 0;
+	transform: scale(0.95);
+}
 </style>

--
Gitblit v1.9.3