From b23bc4d88ed6215fdda94dc94a15dd62e9f4a5cc Mon Sep 17 00:00:00 2001 From: guonan <guonan201020@163.com> Date: 星期四, 12 六月 2025 11:59:10 +0800 Subject: [PATCH] 北京市隐患点和监测设备修改 --- src/views/GisView.vue | 33 +++ src/components/tools/Detail.vue | 4 src/api/hpApi.js | 177 +++++++++------------ src/components/menu/Device.vue | 117 ++++++++++---- src/utils/customEntity.js | 2 src/views/Home.vue | 5 src/components/menu/Location.vue | 134 ++++++++++----- src/views/left/KGSimOption/RealTimeSimulation.vue | 4 8 files changed, 281 insertions(+), 195 deletions(-) diff --git a/src/api/hpApi.js b/src/api/hpApi.js index d397817..9d0e86f 100644 --- a/src/api/hpApi.js +++ b/src/api/hpApi.js @@ -39,6 +39,7 @@ console.log("getSafeLocation:", response); return response.data; } + // 鑾峰彇閬块櫓绾胯矾 export async function getEscapeRoute(data) { const response = await axios.post("/hp/escapeRoute/getData", { @@ -49,6 +50,7 @@ console.log("getEscapeRoute:", response); return response.data; } + // 鑾峰彇浼犳劅鍣ㄥ垪琛� export async function getSensor(data) { const response = await axios.post("/hp/sensor/getData", { @@ -59,6 +61,7 @@ console.log("getSensor:", response); return response.data; } + // 鑾峰彇闆ㄩ噺鏁版嵁 export async function getRainfallData() { const response = await axios.post("/hp/rainfallCountyCity/getData", { @@ -69,62 +72,36 @@ return response.data; } -// 鑾峰彇鐞夌拑搴欓晣鐩戞祴璁惧淇℃伅 -export async function getDeviceInfoShg(data) { - const response = await axios.post("/hp/deviceInfo/getData", { - filterObject: { - "dictDeviceType": data, - "townCode": "110116110000" - }, - "pageSize": 10000 +// 鎸夌収鍖椾含甯俢ode鏌ヨ琛屾斂鍖篶ode +export async function getAeraCode() { + const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getHiddenDangerCountByDistrict", { + "dictDisasterGrade": "", + "dictDisasterType": "", + "dictRiskLevel": "", + "districtCode": "110000000000", + "dictThreatObj": "", + "year": "2025" }); return response.data; } -// 鑾峰彇鍖椾含甯傜洃娴嬭澶囦俊鎭� -export async function getDeviceInfo(data) { - const response = await axios.post("/hp/deviceInfo/getData", { - - "currentPage": 1, - "pageSize": 10000, - "filterObject": { - "belongObjList": [ - "1797461961110261762" - ], - "townCode": data - // "id": "", - // "deviceName": "", - // "deviceCode": "", - // "deviceClientId": "", - // "dictDeviceType": "", - // "hdName": "", - // "installUnit": "", - // "rtuUnit": "", - // "dictDisasterType": "", - // "dictCommunicationType": "", - // "dictDeviceStatus": "", - // "divisionDistrict": "", - }, - "sortedList": [ - { - "sorted": "createTime", - "type": "desc" - } - ] - }) - +// 鎸夌収琛屾斂鍖篶ode鏌ヨ涔¢晣code +export async function getAeraTownCode(data) { + const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getHiddenDangerTownCount", { + "dictDisasterGrade": "", + "dictDisasterType": "", + "dictRiskLevel": "", + "districtCode": data, + "dictThreatObj": "", + "year": "2025" + }); return response.data; } - -// 鑾峰彇闅愭偅鐐逛俊鎭� +// 鏍规嵁涔¢晣Code鑾峰彇闅愭偅鐐� export async function getDangerPoint(data) { - const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getData", { - filterObject: { - // divisionCounty鍏跺疄鍙互涓嶄紶 - // "divisionCounty": divisionCounty, "divisionTown": data, "year": 2025 }, @@ -133,44 +110,57 @@ return response.data; } -// export async function fetchAndLoadDangerPoints(loadCallback) { -// let currentPage = 1; -// const pageSize = 100; // 姣忔璇锋眰鐨勬暟鎹噺 -// while (true) { -// try { -// const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getData", { -// filterObject: { -// divisionCounty: "110111000000", -// divisionTown: null, -// year: 2025 -// }, -// pageSize: pageSize, -// currentPage: currentPage // 娣诲姞褰撳墠椤电爜鍙傛暟 -// }); +// 鍒嗛〉鑾峰彇琛屾斂鍖哄垝闅愭偅鐐逛俊鎭� +export async function getDangerPointByPage(data, pageNum) { + const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getData", { + filterObject: { + "divisionCounty": data, + "year": 2025 + }, + "pageSize": 50, + "pageNum": pageNum, + }); + return response.data; +} -// const pageData = response.data?.data?.pageData; -// if (!Array.isArray(pageData)) { -// console.error("Expected an array in 'pageData', but got:", typeof pageData, pageData); -// break; -// } +// 鐩戞祴璁惧鎺ュ彛 +/** + * 妫�鏌ユ椂闂村垪鏄惁鎸夊崌搴忔帓鍒� + * @param {string} data - 闆ㄩ噺璁¤澶囩被鍨媔d + * @param {string} townCode - 涔¢晣code,鍙互鏌ヨ涔¢晣鐩戞祴璁惧淇℃伅 + */ +export async function getDeviceInfo(data, townCode) { + const response = await axios.post("/hp/deviceInfo/getData", { + filterObject: { + "dictDeviceType": data, + "townCode": townCode, + // 鎵�灞為」鐩� + // "belongObjList": [ + // "1797461961110261762" + // ], + }, + "pageSize": 10000 + }); + return response.data; +} -// if (pageData.length === 0) break; // 娌℃湁鏇村鏁版嵁浜� - -// // 璋冪敤浼犲叆鐨勫洖璋冨嚱鏁帮紝鐢ㄤ簬鏇存柊椤甸潰鍐呭 -// loadCallback(pageData); - -// if (pageData.length < pageSize) break; // 濡傛灉鏈杩斿洖鐨勬暟鎹皯浜巔ageSize锛岃鏄庡凡鑾峰彇瀹屾墍鏈夋暟鎹� - -// currentPage++; // 鏇存柊涓嬩竴椤电殑椤电爜 -// } catch (error) { -// console.error("Error fetching danger points:", error); -// break; -// } -// } -// } - +// 鍒嗛〉鏌ヨ琛屾斂鍖哄垝鐩戞祴璁惧淇℃伅 +export async function getDeviceInfoByPage(data, pageNum) { + const response = await axios.post("/hp/deviceInfo/getData", { + filterObject: { + "divisionDistrict": data, + // 鎵�灞為」鐩� + "belongObjList": [ + "1797461961110261762" + ], + }, + "pageSize": 50, + "pageNum": pageNum + }); + return response.data; +} // 鏍规嵁骞翠唤鑾峰彇闆ㄩ噺鏁版嵁 @@ -181,7 +171,6 @@ }, "pageSize": 1000 }); - console.log("getRainfallData:", response); return response.data; } @@ -219,28 +208,10 @@ return response.data; } -// 鎸夌収鍖椾含甯俢ode鏌ヨ琛屾斂鍖篶ode -export async function getAeraCode() { - const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getHiddenDangerCountByDistrict", { - "dictDisasterGrade": "", - "dictDisasterType": "", - "dictRiskLevel": "", - "districtCode": "110000000000", - "dictThreatObj": "", - "year": "2025" - }); - return response.data; -} -// 鎸夌収琛屾斂鍖篶ode鏌ヨ涔¢晣code -export async function getAeraTownCode(data) { - const response = await axios.post("/hp/sinoDzHiddenDangerPoint/getHiddenDangerTownCount", { - "dictDisasterGrade": "", - "dictDisasterType": "", - "dictRiskLevel": "", - "districtCode": data, - "dictThreatObj": "", - "year": "2025" - }); + +// 鏌ヨ鍖椾含甯傜洃娴嬭澶囩殑鏁伴噺 +export async function getDeviceCount() { + const response = await axios.get("/hp/device/statisticsCountyByDeviceType"); return response.data; } \ No newline at end of file diff --git a/src/components/menu/Device.vue b/src/components/menu/Device.vue index e587b5e..22b7f18 100644 --- a/src/components/menu/Device.vue +++ b/src/components/menu/Device.vue @@ -9,7 +9,7 @@ <el-select @change="handleChange1" v-model="selectValue1" - placeholder="Select" + placeholder="璇烽�夋嫨琛屾斂鍖�" size="mini" style="width: 240px" > @@ -26,7 +26,7 @@ <el-select @change="handleChange" v-model="selectValue" - placeholder="Select" + placeholder="璇烽�夋嫨閲嶇偣娌�" size="mini" style="width: 240px" > @@ -50,6 +50,7 @@ <el-tree v-show="!isLoading" :data="deviceTree" + default-expand-all node-key="deviceId" :props="treeProps" @node-click="handleTreeNodeClick" @@ -74,10 +75,10 @@ import { useRoute, onBeforeRouteUpdate } from "vue-router"; import { createPoint, removeEntities, clearAllPoints } from "@/utils/map"; import { deviceDictList, getDictName } from "@/constant/dict.js"; -import { getDeviceInfoShg, getDeviceInfo } from "@/api/hpApi"; import { initeWaterPrimitiveView } from "@/utils/water"; //鐩告満flyTo鍑芥暟锛屽悗缁璷ptions鍒楄〃涓湁瀵瑰簲缁忕含搴﹀悗寮冪敤 import { useSimStore } from "@/store/simulation"; import { Loading } from "@element-plus/icons-vue"; +import { getDeviceInfoByPage } from "@/api/hpApi"; const simStore = useSimStore(); @@ -94,12 +95,6 @@ } }); -// onBeforeRouteUpdate((to, from, next) => { -// if (to.path !== "/zhjc") { -// handleCleanup(); -// } -// next(); -// }); const route = useRoute(); onBeforeUnmount(() => { @@ -108,22 +103,34 @@ } }); -// watch( -// () => simStore.DeviceShowSwitch, -// (newValue, oldValue) => { -// if (newValue) { -// initializeDevicePoints(); -// } else { -// clearAllPoints(); -// } -// } -// ); +const selectValue1 = ref(""); + +const BJoptions = ref([ + { label: "瀵嗕簯鍖�", value: "110118000000" }, + { label: "鎴垮北鍖�", value: "110111000000" }, + { label: "闂ㄥご娌熷尯", value: "110109000000" }, + { label: "寤跺簡鍖�", value: "110119000000" }, + { label: "鎬�鏌斿尯", value: "110116000000" }, + { label: "鏄屽钩鍖�", value: "110114000000" }, + { label: "骞宠胺鍖�", value: "110117000000" }, + { label: "娴锋穩鍖�", value: "110108000000" }, + { label: "鐭虫櫙灞卞尯", value: "110107000000" }, + { label: "涓板彴鍖�", value: "110106000000" }, +]); + +const selectValue = ref("瀛欒儭娌�"); + +const options = ref([ + { value: "瀛欒儭娌�", label: "瀛欒儭娌�" }, + { value: "楸兼按娲炲悗娌�", label: "楸兼按娲炲悗娌�" }, + { value: "浜庡瑗挎矡", label: "浜庡瑗挎矡" }, + { value: "鍖楁渤娌�", label: "鍖楁渤娌�" }, + { value: "榫欐硥宄潙", label: "榫欐硥宄潙" }, +]); const deviceListAll = ref([]); const initializeDevicePoints = () => { - const list = []; - // val.forEach((item, index) => { deviceListAll.value.forEach((item, index) => { // 鏍规嵁闇�姹傚彲澧炲垹 item.type = getDictName(deviceDictList, item.dictDeviceType); @@ -135,6 +142,19 @@ // console.log(`璁惧鍚嶇О: ${item.id}, 璁惧绫诲瀷: ${item.name}`); createPoint(item); }); +}; + +const DevicePoints = async (item) => { + // 鏍规嵁闇�姹傚彲澧炲垹 + item.type = getDictName(deviceDictList, item.dictDeviceType); + item.name = item.deviceName + // item.name = item.deviceName.split(selectValue.value)[1] || item.deviceName; + item.id = item.deviceId; + item.className = "device"; + item.showLabel = true; + // 鎵撳嵃姣忎釜璁惧鐨勫悕绉板拰璁惧绫诲瀷 + // console.log(`璁惧鍚嶇О: ${item.id}, 璁惧绫诲瀷: ${item.name}`); + createPoint(item); }; // 鏍规嵁鍖哄煙鍚嶇О鍔犺浇璁惧鍒楄〃 @@ -174,26 +194,49 @@ ElMessage("璇烽�夋嫨涓�涓尯鍩�"); return; } + selectValue1.value = ""; + selectValue.value = item; // 鏍规嵁鏂板尯鍩熷悕閲嶆柊鍔犺浇璁惧鍒楄〃 loadDeviceList(item); initializeDevicePoints(); - - // console.log(deviceListAll.value); }; -const selectValue1 = ref("鍖椾含甯�"); +// 澶勭悊鍖哄煙鍙樺寲浜嬩欢 +const handleChange1 = async (item) => { + if (!item) { + ElMessage("璇烽�夋嫨涓�涓尯鍩�"); + return; + } + selectValue1.value = item; + selectValue.value = ""; + deviceListAll.value = []; + let pageNum = 1; + let hasMore = true; -const BJoptions = ref([]); + try { + while (hasMore) { + const res = await getDeviceInfoByPage(item, pageNum); -const selectValue = ref("瀛欒儭娌�"); + // 灏嗘柊鏁版嵁杩藉姞鍒板垪琛ㄤ腑 + deviceListAll.value = [...deviceListAll.value, ...res.data.pageData]; -const options = ref([ - { value: "瀛欒儭娌�", label: "瀛欒儭娌�" }, - { value: "楸兼按娲炲悗娌�", label: "楸兼按娲炲悗娌�" }, - { value: "浜庡瑗挎矡", label: "浜庡瑗挎矡" }, - { value: "鍖楁渤娌�", label: "鍖楁渤娌�" }, - { value: "榫欐硥宄潙", label: "榫欐硥宄潙" }, -]); + // 鍒ゆ柇鏄惁杩樻湁涓嬩竴椤� + if (pageNum < res.data.pageCount) { + pageNum++; + await new Promise((resolve) => setTimeout(resolve, 300)); + } else { + hasMore = false; + } + } + } catch (err) { + console.error("鑾峰彇鐩戞祴璁惧澶辫触", err); + deviceListAll.value = []; // 鍙�夛細娓呯┖鎴栦繚鐣欏凡鍔犺浇閮ㄥ垎 + } finally { + // 鏆傛椂鍏堝叧闂姞杞界姸鎬侊紝鍥犱负姝ゅ涓哄垎椤佃姹傛暟鎹紝鐒跺悗涓�鐐逛竴鐐圭殑娓叉煋锛屾渶缁堜細鍔犺浇瀹屾垚 + // 濡傛灉寮�鍚姞杞界姸鎬侊紝鏈�鍚庤繕鏄細绛夋墍鏈夋暟鎹兘璇锋眰鍥炴潵鎵嶄細娓叉煋 + // loading.value = false; // 鍏抽棴鍔犺浇鐘舵�� + } +}; const treeProps = { label: "deviceName", @@ -229,7 +272,13 @@ }); function handleTreeNodeClick(data) { - initializeDevicePoints(); + if (selectValue.value) { + // 姝ゅ璋冪敤鏄洜涓篏isView椤甸潰浼氬湪鐐瑰嚮涓嬩竴涔¢晣涔嬪墠鎶婁笂涓�涓�夋嫨鐨勫尯鍩熺殑闅愭偅鐐规竻闄ゆ帀锛堝鏋滃垰濂介�夋嫨浜嗗瓩鑳℃矡锛岄偅涔堜笅涓�涓偣鍑诲皢浼氭竻绌哄瓩鑳℃矡鐨勯殣鎮g偣锛� + initializeDevicePoints(); + } else { + // 琛屾斂鍖哄垝鐨勭偣浣嶅お澶氫簡锛屽彧鑳介�変腑鍝釜娓叉煋鍝釜 + DevicePoints(data); + } // 鍙湁璁惧鑺傜偣鎵嶅鐞嗙偣鍑讳簨浠� if (!data.children) { const entity = viewer.entities.getById(data.deviceId); diff --git a/src/components/menu/Location.vue b/src/components/menu/Location.vue index 53c3d4a..85ada38 100644 --- a/src/components/menu/Location.vue +++ b/src/components/menu/Location.vue @@ -10,7 +10,7 @@ <el-select @change="handleChange1" v-model="selectValue1" - placeholder="Select" + placeholder="璇烽�夋嫨琛屾斂鍖�" size="mini" style="width: 240px" > @@ -27,7 +27,7 @@ <el-select @change="handleChange" v-model="selectValue" - placeholder="Select" + placeholder="璇烽�夋嫨閲嶇偣娌�" size="mini" style="width: 240px" > @@ -66,14 +66,14 @@ <script setup> import { ref, onMounted, watch, onBeforeUnmount } from "vue"; -import { createPoint,clearAllPoints } from "@/utils/map"; +import { createPoint, clearAllPoints } from "@/utils/map"; import { useSimStore } from "@/store/simulation"; import { initeWaterPrimitiveView } from "@/utils/water"; //鐩告満flyTo鍑芥暟锛屽悗缁璷ptions鍒楄〃涓湁瀵瑰簲缁忕含搴﹀悗寮冪敤 import { useRoute, onBeforeRouteUpdate } from "vue-router"; import { Loading } from "@element-plus/icons-vue"; +import { getDangerPointByPage } from "@/api/hpApi"; const districtList = ref([]); - const simStore = useSimStore(); @@ -86,38 +86,40 @@ }); const selectValue = ref("瀛欒儭娌�"); -const selectValue1 = ref("鍖椾含甯�"); +const selectValue1 = ref(""); -const BJoptions = ref([]); +const BJoptions = ref([ + { label: "瀵嗕簯鍖�", value: "110118000000" }, + { label: "鎴垮北鍖�", value: "110111000000" }, + { label: "闂ㄥご娌熷尯", value: "110109000000" }, + { label: "寤跺簡鍖�", value: "110119000000" }, + { label: "鎬�鏌斿尯", value: "110116000000" }, + { label: "鏄屽钩鍖�", value: "110114000000" }, + { label: "骞宠胺鍖�", value: "110117000000" }, + { label: "娴锋穩鍖�", value: "110108000000" }, + { label: "鐭虫櫙灞卞尯", value: "110107000000" }, + { label: "涓板彴鍖�", value: "110106000000" }, +]); const options = ref([ - { - value: "瀛欒儭娌�", - label: "瀛欒儭娌�", - }, - { - value: "楸兼按娲炲悗娌�", - label: "楸兼按娲炲悗娌�", - }, - { - value: "浜庡瑗挎矡", - label: "浜庡瑗挎矡", - }, - { - value: "鍖楁渤娌�", - label: "鍖楁渤娌�", - }, - { - value: "榫欐硥宄潙", - label: "榫欐硥宄潙", - }, + { value: "瀛欒儭娌�", label: "瀛欒儭娌�" }, + { value: "楸兼按娲炲悗娌�", label: "楸兼按娲炲悗娌�" }, + { value: "浜庡瑗挎矡", label: "浜庡瑗挎矡" }, + { value: "鍖楁渤娌�", label: "鍖楁渤娌�" }, + { value: "榫欐硥宄潙", label: "榫欐硥宄潙" }, ]); const loading = ref(true); // 鎺у埗鍔犺浇鐘舵�� function handleClick(district) { - // 姝ゅ璋冪敤鏄洜涓篏isView椤甸潰浼氬湪鐐瑰嚮涓嬩竴涔¢晣涔嬪墠鎶婁笂涓�涓�夋嫨鐨勫尯鍩熺殑闅愭偅鐐规竻闄ゆ帀锛堝鏋滃垰濂介�夋嫨浜嗗瓩鑳℃矡锛岄偅涔堜笅涓�涓偣鍑诲皢浼氭竻绌哄瓩鑳℃矡鐨勯殣鎮g偣锛� - initializeDevicePoints(); + if (selectValue.value) { + // 姝ゅ璋冪敤鏄洜涓篏isView椤甸潰浼氬湪鐐瑰嚮涓嬩竴涔¢晣涔嬪墠鎶婁笂涓�涓�夋嫨鐨勫尯鍩熺殑闅愭偅鐐规竻闄ゆ帀锛堝鏋滃垰濂介�夋嫨浜嗗瓩鑳℃矡锛岄偅涔堜笅涓�涓偣鍑诲皢浼氭竻绌哄瓩鑳℃矡鐨勯殣鎮g偣锛� + initializeDevicePoints(); + } else { + // 琛屾斂鍖哄垝鐨勭偣浣嶅お澶氫簡锛屽彧鑳介�変腑鍝釜娓叉煋鍝釜 + DevicePoints(district); + } + const entity = viewer.entities.getById(district.hdId); if (entity) { viewer.flyTo(entity, { @@ -148,6 +150,18 @@ ); }; +const DevicePoints = async (item) => { + // 鏍规嵁闇�姹傚彲澧炲垹 + item.id = item.hdId; + item.name = item.hdName; + item.latitude = item.lat; + item.longitude = item.lon; + item.showBillboard = true; + item.type = item.disasterType; + item.className = "district"; + await createPoint(item); +}; + const filterDataByArea = async (areaName) => { clearAllPoints(); if (!areaName || !simStore.DangerPoint || simStore.DangerPoint.length === 0) { @@ -165,33 +179,59 @@ } }; +const handleChange1 = async (item) => { + if (!item) { + ElMessage("璇烽�夋嫨涓�涓尯鍩�"); + return; + } + selectValue1.value = item; + selectValue.value = ""; + // 寮�鍚姞杞界姸鎬� + // loading.value = true; + districtList.value = []; // 娓呯┖鏃ф暟鎹� + + let pageNum = 1; + let hasMore = true; + + try { + while (hasMore) { + const res = await getDangerPointByPage(item, pageNum); + + // 灏嗘柊鏁版嵁杩藉姞鍒板垪琛ㄤ腑 + districtList.value = [...districtList.value, ...res.data.pageData]; + + // 鍒ゆ柇鏄惁杩樻湁涓嬩竴椤� + if (pageNum < res.data.pageCount) { + pageNum++; + await new Promise((resolve) => setTimeout(resolve, 300)); + } else { + hasMore = false; + } + } + } catch (err) { + console.error("鑾峰彇闅愭偅鐐瑰け璐�", err); + districtList.value = []; // 鍙�夛細娓呯┖鎴栦繚鐣欏凡鍔犺浇閮ㄥ垎 + } finally { + // 鏆傛椂鍏堝叧闂姞杞界姸鎬侊紝鍥犱负姝ゅ涓哄垎椤佃姹傛暟鎹紝鐒跺悗涓�鐐逛竴鐐圭殑娓叉煋锛屾渶缁堜細鍔犺浇瀹屾垚 + // 濡傛灉寮�鍚姞杞界姸鎬侊紝鏈�鍚庤繕鏄細绛夋墍鏈夋暟鎹兘璇锋眰鍥炴潵鎵嶄細娓叉煋 + // loading.value = false; // 鍏抽棴鍔犺浇鐘舵�� + } +}; + // 澶勭悊鍖哄煙鍙樺寲浜嬩欢 const handleChange = (item) => { - const areaName = item; - if (!areaName) { + selectValue1.value = ""; + selectValue.value = item; + + if (!item) { ElMessage.warning("璇烽�夋嫨涓�涓尯鍩�"); return; } - filterDataByArea(areaName); + filterDataByArea(item); }; + let isInitialized = false; -// watch( -// () => simStore.DangerShowSwitch, -// async (newValue, oldValue) => { -// console.log("褰撳墠鐘舵�侊細", newValue); - -// if (newValue) { -// if (!isInitialized) { -// await initializeDevicePoints(); -// isInitialized = true; -// } -// } else { -// clearAllPoints(); -// isInitialized = false; -// } -// } -// ); // 鐩戝惉 simStore.DangerPoint 鍙樺寲 watch( () => simStore.DangerPoint, diff --git a/src/components/tools/Detail.vue b/src/components/tools/Detail.vue index a4ad46b..ae1f16b 100644 --- a/src/components/tools/Detail.vue +++ b/src/components/tools/Detail.vue @@ -30,8 +30,8 @@ } // 鐩戞祴璁惧鍏蜂綋淇℃伅 function handlDeviceDetail() { - const name = deviceDetail.value.name; - detailTitle.value = name; + // const name = deviceDetail.value.deviceForShort; + detailTitle.value = deviceDetail.value.deviceForShort; detailList.value = [ { name: "璁惧缂栧彿", diff --git a/src/utils/customEntity.js b/src/utils/customEntity.js index 1f6c693..45964a0 100644 --- a/src/utils/customEntity.js +++ b/src/utils/customEntity.js @@ -169,7 +169,7 @@ windowPosition ) // top 鏂规 - const left = windowPosition.x - 80 + const left = windowPosition.x - 100 const top = `${windowPosition.y - (div.offsetHeight + 10)}` if (left > 0 && top > 0) { diff --git a/src/views/GisView.vue b/src/views/GisView.vue index bbb0786..f286edd 100644 --- a/src/views/GisView.vue +++ b/src/views/GisView.vue @@ -41,10 +41,10 @@ import { loadAreaPolygon } from "@/utils/area.js"; import { loadAreaPolygonAll } from "@/utils/area_all.js"; import { isVisibleDistance } from "@/utils/customEntity"; -import { getDistrictCount, getDistrictCountByCity } from "@/api/index"; import { useRoute } from "vue-router"; import { EventBus } from "@/eventBus"; // 寮曞叆浜嬩欢鎬荤嚎 import { useSimStore } from "@/store/simulation"; +const route = useRoute(); const simStore = useSimStore(); import { @@ -52,6 +52,7 @@ getDeviceInfo, getAeraCode, getAeraTownCode, + getDeviceCount, } from "@/api/hpApi"; /////////////////////////鍦板浘褰卞儚閫夋嫨///////////////////////// const views = [ @@ -116,7 +117,6 @@ }; /////////////////////////鍦板浘褰卞儚閫夋嫨///////////////////////// -const route = useRoute(); let handler = null; /////////////////////////鍒濆鍖栧湴鍥�///////////////////////// function initMap() { @@ -423,13 +423,40 @@ }, }; +const showDeviceCount = ref(false); + +// 鐩戝惉璺敱鍙樺寲 +watch( + () => route.name, + (newName) => { + console.log("璺敱鍚嶇О鍙樺寲:", newName); + // 浣跨敤涓夊厓杩愮畻绗︽潵鍐冲畾 showDeviceCount 鐨勫�� + showDeviceCount.value = newName === "zhjc" ? true : false; + initDistrictCount("primary"); + }, + { immediate: true } +); + // 鍒濆鍖栧尯鍩熺粺璁� async function initDistrictCount(level = "secondary") { try { + const deviceTotal = ref([]); if (level === "primary") { // 涓�绾у尯鍩燂細鐩存帴璋冪敤 getAeraCode() + // 濡傛灉鏄� "/zhjc" 璺敱锛屽厛鑾峰彇璁惧缁熻鎺ュ彛鏁版嵁 + if (showDeviceCount.value) { + deviceTotal.value = await getDeviceCount(); + } const res = await getAeraCode(); res.data.forEach((item) => { + if (showDeviceCount.value) { + const matchedDistrict = deviceTotal.value.data.find( + (d) => d.districtName === item.districtName + ); + if (matchedDistrict) { + item.count = matchedDistrict.count; // 鏇存柊 count + } + } processDistrictItem(item, LEVEL_CONFIG[level], level); }); } else if (level === "secondary") { @@ -497,7 +524,7 @@ res = await getDangerPoint(item.districtCode); } else if (route.path === "/zhjc") { // 璇锋眰鐩戞祴璁惧鏁版嵁 - res = await getDeviceInfo(item.districtCode); + res = await getDeviceInfo(null,item.districtCode); } else { loadingInstance.close(); return; diff --git a/src/views/Home.vue b/src/views/Home.vue index a52b6f7..3462f52 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -60,8 +60,7 @@ import { showDeviceDetail } from "@/store"; import { setupTokenRefresh, getDangerPoint } from "@/api/hpApi.js"; import { convertToWKT } from "@/utils/wktUtils"; -import { getDeviceInfoShg } from "@/api/hpApi"; -import { deviceDictList, getDictName } from "@/constant/dict.js"; +import { getDeviceInfo } from "@/api/hpApi"; const route = useRoute(); const simStore = useSimStore(); @@ -109,7 +108,7 @@ simStore.DangerPoint = res.data.pageData; }); - getDeviceInfoShg().then((res) => { + getDeviceInfo(null,"110116110000").then((res) => { simStore.devices = res.data.pageData; }); try { diff --git a/src/views/left/KGSimOption/RealTimeSimulation.vue b/src/views/left/KGSimOption/RealTimeSimulation.vue index 0b34776..d79704c 100644 --- a/src/views/left/KGSimOption/RealTimeSimulation.vue +++ b/src/views/left/KGSimOption/RealTimeSimulation.vue @@ -78,7 +78,7 @@ import { initeWaterPrimitiveView } from "@/utils/water"; import { SimAPIStore } from "@/store/simAPI"; import { EventBus } from "@/eventBus"; // 寮曞叆浜嬩欢鎬荤嚎 -import { getDeviceInfoShg, getYLJData } from "@/api/hpApi"; +import { getDeviceInfo, getYLJData } from "@/api/hpApi"; // 鑾峰彇 Store 瀹炰緥 const simStore = SimAPIStore(); @@ -117,7 +117,7 @@ const getRainListAll = () => { // 闆ㄩ噺璁$被鍨媔d const ids = "1874719366287368194"; - getDeviceInfoShg(ids).then((res) => { + getDeviceInfo(ids, "110116110000").then((res) => { rainListNoFilter.value = res.data.pageData; // 鏍规嵁褰撳墠閫夋嫨鐨勫尯鍩熻嚜鍔ㄨ繃婊� updateShgListByArea(); -- Gitblit v1.9.3