From b1398528bd9f5245f580285681cca6abc192c651 Mon Sep 17 00:00:00 2001 From: wangjuncheng <1> Date: 星期五, 16 五月 2025 16:00:43 +0800 Subject: [PATCH] change --- src/components/monifangzhen/schemeInfo.vue | 185 +++++++++++++++++++++++----------------------- 1 files changed, 93 insertions(+), 92 deletions(-) diff --git a/src/components/monifangzhen/schemeInfo.vue b/src/components/monifangzhen/schemeInfo.vue index d03fcde..df5c387 100644 --- a/src/components/monifangzhen/schemeInfo.vue +++ b/src/components/monifangzhen/schemeInfo.vue @@ -1,15 +1,15 @@ <template> <div class="listCard"> <div class="top"><span>鏂规璇︽儏</span> - <!-- <div @click="togglePick" :class="['pick-button', { active: isPickingActive }]"> - {{ isPickingActive ? '杩涜璁$畻' : '寮�濮嬫嬀鍙�' }} - </div> --> </div> <div class="details"> <div v-if="formattedData.length" class="input-group"> <div v-for="(item, index) in formattedData" :key="index" class="input-item"> <label>{{ item.name }}</label> - <span>{{ item.value }}</span> + <span :class="{ 'clickable': item.isClickable }" + @click="item.isClickable ? openGaugeDialog(item.gauges) : null"> + {{ item.value }} + </span> </div> </div> <div v-else> @@ -21,12 +21,31 @@ </div> </div> <Message @close="close" class="mess" v-show="messageShow" :mesData="mesData" /> + <!-- 娣诲姞闆ㄩ噺璁″脊绐� --> + <div class="dialoog"> + <el-dialog v-model="dialogVisible" title="闆ㄩ噺璁¤鎯�" width="50%" :before-close="handleClose"> + <div class="table-container"> + <el-table :data="gaugesData" border stripe height="100%"> + <el-table-column prop="name" label="鍚嶇О"></el-table-column> + <el-table-column prop="x" label="缁忓害(X)"></el-table-column> + <el-table-column prop="y" label="绾害(Y)"></el-table-column> + <el-table-column prop="r" label="鍗婂緞(r)"></el-table-column> + </el-table> + </div> + <!-- <template #footer> + <span class="dialog-footer"> + <el-button @click="dialogVisible = false">鍏抽棴</el-button> + </span> + </template> --> + </el-dialog> + </div> + </template> <script setup> import { defineProps, defineEmits, inject, ref, watch } from "vue"; +import { ElDialog, ElTable, ElTableColumn, ElButton ,ElMessage} from "element-plus"; import dayjs from "dayjs"; - // 鍏叡渚濊禆 const props = defineProps({ selectedScheme: { type: Object, default: null } }); const emit = defineEmits(["back"]); @@ -69,20 +88,32 @@ const parsed = JSON.parse(dataStr); const fields = { total: "闄嶉洦鎬婚噺锛坢m锛夛細", - duration: "闄嶉洦鏃堕暱锛堝垎閽燂級锛�", + duration: "闄嶉洦鏃堕暱锛堝皬鏃讹級锛�", intensity: "闄嶉洦寮哄害锛坢m/灏忔椂锛夛細", prediction: "闄嶉洦鍦烘锛�", model: "闄嶉洦妯″紡锛�", - history: "鍘嗗彶闄嶉洦锛�", - gauges: "闆ㄩ噺璁″垪琛細" + history: "鍘嗗彶闄嶉洦锛�" }; - return Object.entries(parsed) + const result = Object.entries(parsed) .filter(([k]) => fields[k]) .map(([k, v]) => ({ name: fields[k], - value: Array.isArray(v) ? v.join(", ") : v || "鏃�" + value: v || "鏃�" })); + + // 澶勭悊闆ㄩ噺璁℃暟鎹� + if (parsed.gauges && Array.isArray(parsed.gauges)) { + const gaugeNames = parsed.gauges.map(g => g.name).join(", ") || "鏃�"; + result.push({ + name: "闆ㄩ噺璁″垪琛細", + value: '鏌ョ湅闆ㄩ噺璁″垪琛�', + isClickable: true, + gauges: parsed.gauges + }); + } + + return result; } catch (e) { return [{ name: "鏁版嵁锛�", value: dataStr || "鏃�" }]; } @@ -104,6 +135,8 @@ const entries = Object.entries(newScheme); const areaType = newScheme.areaType; + + console.log(newScheme, 'news'); const result = entries.reduce((acc, [key, value]) => { if (skipKeys.includes(key)) return acc; @@ -146,90 +179,31 @@ }, { immediate: true } ); -// const pickedPoints = ref([]); -// const handler = ref(null); -// const isPickingActive = ref(false); -// // 鎷惧彇鐩稿叧閫昏緫 -// const viewer = window.viewer; +const dialogVisible = ref(false); +const gaugesData = ref([]); -// function getPickPosition(windowPosition) { -// if (!viewer) return null; -// viewer.scene.globe.depthTestAgainstTerrain = true; -// const cartesian = viewer.scene.pickPosition(windowPosition); -// if (!cartesian) return null; +// 鎵撳紑闆ㄩ噺璁″脊绐� +function openGaugeDialog(gauges) { + if (Array.isArray(gauges) && gauges.length > 0) { + gaugesData.value = gauges.map(g => ({ + name: g.name || "鏈煡", + x: g.x != null ? g.x.toFixed(2) : "-", + y: g.y != null ? g.y.toFixed(2) : "-", + r: g.r || "-" + })); + dialogVisible.value = true; + } else { + ElMessage({ + message: "闆ㄩ噺璁℃暟鎹嚭閿欙紝璇烽噸鏂版柊寤烘ā鎷熸柟妗堬紒", + type: "warning", + }); + } +} -// const cartographic = Cesium.Cartographic.fromCartesian(cartesian); - -// // 鍦ㄥ師鏈夐珮搴︿笂澧炲姞300绫� -// cartographic.height += 80.0; - -// return { -// cartesian: Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height), -// longitude: Cesium.Math.toDegrees(cartographic.longitude), -// latitude: Cesium.Math.toDegrees(cartographic.latitude), -// height: cartographic.height -// }; -// } - -// function addPointToViewer(point, index) { -// const entity = viewer.entities.add({ -// position: point.cartesian, -// billboard: { -// // image: '../path/to/your/icon.png', // 鏇挎崲涓轰綘鐨勫浘鏍囪矾寰� -// width: 32, // 鍥炬爣瀹藉害 -// height: 32, // 鍥炬爣楂樺害 -// verticalOrigin: Cesium.VerticalOrigin.BOTTOM -// }, -// label: { -// text: `Point ${index + 1}\n缁忓害: ${point.longitude.toFixed(6)}\n绾害: ${point.latitude.toFixed(6)}`, -// font: '14pt monospace', -// style: Cesium.LabelStyle.FILL_AND_OUTLINE, -// outlineWidth: 2, -// verticalOrigin: Cesium.VerticalOrigin.TOP, -// pixelOffset: new Cesium.Cartesian2(0, -40), // 璋冩暣鏍囩鐩稿浜庡浘鏍囩殑鍋忕Щ閲� -// fillColor: Cesium.Color.WHITE, -// outlineColor: Cesium.Color.BLACK -// } -// }); - -// // 鍙�夛細瀛樺偍瀹炰綋寮曠敤浠ヤ究鍚庣画鎿嶄綔 -// pickedPoints.value.push(entity); -// } - -// function initPickHandler() { -// if (!viewer?.scene?.canvas) return; -// handler.value = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); - -// handler.value.setInputAction((movement) => { -// const position = getPickPosition(movement.position); -// if (position) { -// const index = pickedPoints.value.length; -// pickedPoints.value.push(position); -// addPointToViewer(position, index); -// } -// }, Cesium.ScreenSpaceEventType.LEFT_CLICK); -// } - -// function togglePick() { -// isPickingActive.value ? stopPicking() : startPicking(); -// } - -// function startPicking() { -// pickedPoints.value = []; -// viewer.entities.removeAll(); -// !handler.value && initPickHandler(); -// isPickingActive.value = true; -// } - -// function stopPicking() { -// if (handler.value) { -// handler.value.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK); -// handler.value.destroy(); -// handler.value = null; -// } - -// isPickingActive.value = false; -// } +// 鍏抽棴寮圭獥 +function handleClose(done) { + done(); +} </script> <style lang="less" scoped> @@ -312,4 +286,31 @@ letter-spacing: 2px; font-weight: bolder; } + +.clickable { + color: #5bc0de; + cursor: pointer; + text-decoration: underline; +} + +.dialoog { + ::v-deep .el-dialog__title { + color: #fff !important; + } + + ::v-deep .el-dialog { + background-color: rgb(5, 75, 69) !important; + } + + .el-dialog__body { + padding-top: 10px; + padding-bottom: 10px; + } + + .table-container .el-table { + font-size: 14px; + border-radius: 4px; + box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); + } +} </style> -- Gitblit v1.9.3