From a9c4f7775e82d93638e607fa6c5fafe22f5310b4 Mon Sep 17 00:00:00 2001 From: guonan <guonan201020@163.com> Date: 星期五, 16 五月 2025 15:06:27 +0800 Subject: [PATCH] 完善接口部分 --- src/components/tools/LayerTree.vue | 92 ++- src/views/GisView.vue | 2 src/components/tools/Detail.vue | 408 +++++++++--------- src/components/menu/Device.vue | 1 src/api/index.js | 32 - src/views/left/KGSimOption/PredictiveSimulation.vue | 1 src/views/left/Left.vue | 8 src/components/menu/Location.vue | 718 +++----------------------------- src/components/monifangzhen/schemeCard.vue | 1 9 files changed, 322 insertions(+), 941 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 23336cd..dd62064 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,24 +1,3 @@ -export async function getDistrictData() { - const response = await fetch("/json/闅愭偅鐐逛俊鎭�.json", { - mode: "cors", - cache: "no-cache", - headers: { - "Content-Type": "application/json", - }, - }) - return await response.json() -} -export async function getDeviceData() { - const response = await fetch("/json/缁煎悎鐩戞祴璁惧淇℃伅.json", { - mode: "cors", - cache: "no-cache", - headers: { - "Content-Type": "application/json", - }, - }) - return await response.json() -} - export async function getSimulateData() { const response = await fetch("/json/浠跨湡鏂规.json", { mode: "cors", @@ -40,16 +19,7 @@ }) return await response.json() } -export async function getDevicetListData() { - const response = await fetch("/json/缁煎悎鐩戞祴璁惧淇℃伅.json", { - mode: "cors", - cache: "no-cache", - headers: { - "Content-Type": "application/json", - }, - }) - return await response.json() -} + export async function getDistrictListData() { const response = await fetch("/json/闅愭偅鐐逛俊鎭�.json", { mode: "cors", diff --git a/src/components/menu/Device.vue b/src/components/menu/Device.vue index e914dbf..1ea39aa 100644 --- a/src/components/menu/Device.vue +++ b/src/components/menu/Device.vue @@ -44,7 +44,6 @@ <script setup> import { ref, computed, onMounted } from "vue"; -import { createPoint, removeEntities } from "@/utils/map"; import { deviceDictList, getDictName } from "@/constant/dict.js"; import { getDeviceInfo } from "@/api/hpApi"; diff --git a/src/components/menu/Location.vue b/src/components/menu/Location.vue index f8b899f..c239e71 100644 --- a/src/components/menu/Location.vue +++ b/src/components/menu/Location.vue @@ -23,8 +23,14 @@ </el-select> </div> + <!-- 婊氬姩鍖哄煙 --> <div style="overflow-y: auto; height: 95%"> + <!-- 鍔犺浇閬僵灞� --> + <div v-if="loading" class="loading-overlay"> + <div class="spinner"></div> + </div> <div + v-else v-for="(item, key) in districtList" :key="key" class="district-item" @@ -39,8 +45,8 @@ </template> <script setup> -import { ref, onMounted, onBeforeUnmount, reactive } from "vue"; -import { createPoint, removeEntities } from "@/utils/map"; +import { ref, onMounted, watch } from "vue"; +import { createPoint } from "@/utils/map"; import { useSimStore } from "@/store/simulation"; const simStore = useSimStore(); @@ -71,638 +77,10 @@ ]); const districtList = ref([]); - -// const districtList = ref([ -// { -// activeStatus: "", -// areaCode: "", -// areaName: "", -// brookLength: 0, -// checkId: "", -// city: "鍖椾含甯�", -// codeProvince: "110116", -// county: "鎬�鏌�", -// dangerLevel: "", -// disasterStatus: "", -// drainageArea: "", -// elevation: 0, -// featureDes: "", -// groupMonitor: "鏉庢姊�,瀛欐鍜�,鑼冩弧鐢�,绉﹀缓鏉�,瀛欐姹�,瀛欐浼�", -// hasPlan: "", -// id: "110116020058", -// latitude: 40.56652778, -// length: 0, -// district: "鐞夌拑搴欓晣瀛欒儭娌熸潙灏瑰瑗挎矡灏瑰缓鐕曞灞嬪悗", -// longitude: 116.5803889, -// monitor: "", -// monitorAdvice: "", -// name: "灏瑰瑗挎矡灏瑰缓鐕曞灞嬪悗宕╁闅愭偅鐐�", -// number: -// "13716108909,13716029391,13716291714,13716191943,13716427398,13124792612", -// preventionDes: "", -// preventionLevel: "", -// preventionPlan: "瀹氭湡宸℃煡锛岄璀﹁浆绉伙紝绔嬭绀虹墝", -// preventionUnit: "涔¢晣", -// principal: "", -// province: "鍖椾含甯�", -// qp: "", -// reason: "", -// responsibleUnit: "", -// riskLevel: "", -// scale: "灏忓瀷", -// stableLevel: "", -// status: "", -// thickness: 0, -// threatenFamily: 2, -// threatenMoney: 0, -// threatenPopulation: "3", -// threatenType: "", -// town: "鐞夌拑搴欓晣", -// trigger: "", -// type: "宕╁", -// village: "瀛欒儭娌熸潙", -// volume: "", -// volumePotential: "", -// width: 0, -// }, -// { -// activeStatus: "", -// areaCode: "", -// areaName: "", -// brookLength: 0, -// checkId: "", -// city: "鍖椾含甯�", -// codeProvince: "110116", -// county: "鎬�鏌�", -// dangerLevel: "", -// disasterStatus: "", -// drainageArea: "", -// elevation: 0, -// featureDes: "", -// groupMonitor: "鏉庢姊�,瀛欐鍜�,鑼冩弧鐢�,绉﹀缓鏉�,瀛欐姹�,瀛欐浼�", -// hasPlan: "", -// id: "110116020078", -// latitude: 40.56497222, -// length: 0, -// district: "鐞夌拑搴欓晣瀛欒儭娌熸潙娌宠タ浜庡嚖鑻卞灞嬪悗", -// longitude: 116.5955278, -// monitor: "", -// monitorAdvice: "", -// name: "娌宠タ浜庡嚖鑻卞灞嬪悗宕╁闅愭偅鐐�", -// number: -// "13716108909,13716029391,13716291714,13716191943,13716427398,13124792612", -// preventionDes: "", -// preventionLevel: "", -// preventionPlan: "瀹氭湡宸℃煡锛岄璀﹁浆绉伙紝绔嬭绀虹墝", -// preventionUnit: "涔¢晣", -// principal: "", -// province: "鍖椾含甯�", -// qp: "", -// reason: "", -// responsibleUnit: "", -// riskLevel: "", -// scale: "灏忓瀷", -// stableLevel: "", -// status: "", -// thickness: 0, -// threatenFamily: 4, -// threatenMoney: 0, -// threatenPopulation: "6", -// threatenType: "", -// town: "鐞夌拑搴欓晣", -// trigger: "", -// type: "宕╁", -// village: "瀛欒儭娌熸潙", -// volume: "", -// volumePotential: "", -// width: 0, -// }, -// { -// activeStatus: "", -// areaCode: "", -// areaName: "", -// brookLength: 0, -// checkId: "", -// city: "鍖椾含甯�", -// codeProvince: "110116", -// county: "鎬�鏌�", -// dangerLevel: "", -// disasterStatus: "", -// drainageArea: "", -// elevation: 0, -// featureDes: "", -// groupMonitor: "鏉庢姊�,瀛欐鍜�,鑼冩弧鐢�,绉﹀缓鏉�,瀛欐姹�,瀛欐浼�", -// hasPlan: "", -// id: "110116030041", -// latitude: 40.55369444, -// length: 0, -// district: "鐞夌拑搴欓晣瀛欒儭娌熷叕璺�", -// longitude: 116.6002778, -// monitor: "", -// monitorAdvice: "", -// name: "鍗楁灏忎笢娌熸偿鐭虫祦闅愭偅鐐�", -// number: -// "13716108909,13716029391,13716291714,13716191943,13716427398,13124792612", -// preventionDes: "", -// preventionLevel: "", -// preventionPlan: "瀹氭湡宸℃煡,绔嬭绀虹墝", -// preventionUnit: "涔¢晣", -// principal: "", -// province: "鍖椾含甯�", -// qp: "", -// reason: "", -// responsibleUnit: "", -// riskLevel: "", -// scale: "灏忓瀷", -// stableLevel: "", -// status: "", -// thickness: 0, -// threatenFamily: 0, -// threatenMoney: 0, -// threatenPopulation: "", -// threatenType: "", -// town: "鐞夌拑搴欓晣", -// trigger: "", -// type: "娉ョ煶娴�", -// village: "瀛欒儭娌熸潙", -// volume: "", -// volumePotential: "", -// width: 0, -// }, -// { -// activeStatus: "", -// areaCode: "", -// areaName: "", -// brookLength: 0, -// checkId: "", -// city: "鍖椾含甯�", -// codeProvince: "110116", -// county: "鎬�鏌�", -// dangerLevel: "", -// disasterStatus: "", -// drainageArea: "", -// elevation: 0, -// featureDes: "", -// groupMonitor: "鏉庢姊�,瀛欐鍜�,鑼冩弧鐢�,绉﹀缓鏉�,瀛欐姹�,瀛欐浼�", -// hasPlan: "", -// id: "110116030015", -// latitude: 40.55277778, -// length: 0, -// district: "鐞夌拑搴欓晣瀛欒儭娌熸潙鍗楁鏉戝ぇ绐戞矡", -// longitude: 116.5994722, -// monitor: "", -// monitorAdvice: "", -// name: "澶х獞娌熸偿鐭虫祦闅愭偅鐐�", -// number: -// "13716108909,13716029391,13716291714,13716191943,13716427398,13124792612", -// preventionDes: "宸茬洃娴嬨�佸凡娌荤悊", -// preventionLevel: "", -// preventionPlan: "瀹氭湡宸℃煡锛岄璀﹁浆绉伙紝绔嬭绀虹墝", -// preventionUnit: "涔¢晣", -// principal: "", -// province: "鍖椾含甯�", -// qp: "", -// reason: "", -// responsibleUnit: "", -// riskLevel: "", -// scale: "涓瀷", -// stableLevel: "", -// status: "", -// thickness: 0, -// threatenFamily: 5, -// threatenMoney: 0, -// threatenPopulation: "11", -// threatenType: "", -// town: "鐞夌拑搴欓晣", -// trigger: "", -// type: "娉ョ煶娴�", -// village: "瀛欒儭娌熸潙", -// volume: "", -// volumePotential: "", -// width: 0, -// }, -// { -// activeStatus: "", -// areaCode: "", -// areaName: "", -// brookLength: 0, -// checkId: "", -// city: "鍖椾含甯�", -// codeProvince: "110116", -// county: "鎬�鏌�", -// dangerLevel: "", -// disasterStatus: "", -// drainageArea: "", -// elevation: 0, -// featureDes: "", -// groupMonitor: "鏉庢姊�,瀛欐鍜�,鑼冩弧鐢�,绉﹀缓鏉�,瀛欐姹�,瀛欐浼�", -// hasPlan: "", -// id: "110116030076", -// latitude: 40.55972222, -// length: 0, -// district: "鐞夌拑搴欓晣瀛欒儭娌熸潙涓滃潕澶т笢娌�", -// longitude: 116.5916667, -// monitor: "", -// monitorAdvice: "", -// name: "澶т笢娌熸偿鐭虫祦闅愭偅鐐�", -// number: -// "13716108909,13716029391,13716291714,13716191943,13716427398,13124792612", -// preventionDes: "宸叉不鐞�", -// preventionLevel: "", -// preventionPlan: "瀹氭湡宸℃煡锛岄璀﹁浆绉�", -// preventionUnit: "涔¢晣", -// principal: "", -// province: "鍖椾含甯�", -// qp: "", -// reason: "", -// responsibleUnit: "", -// riskLevel: "", -// scale: "灏忓瀷", -// stableLevel: "", -// status: "", -// thickness: 0, -// threatenFamily: 1, -// threatenMoney: 0, -// threatenPopulation: "2", -// threatenType: "", -// town: "鐞夌拑搴欓晣", -// trigger: "", -// type: "娉ョ煶娴�", -// village: "瀛欒儭娌熸潙", -// volume: "", -// volumePotential: "", -// width: 0, -// }, -// { -// activeStatus: "", -// areaCode: "", -// areaName: "", -// brookLength: 0, -// checkId: "", -// city: "鍖椾含甯�", -// codeProvince: "110116", -// county: "鎬�鏌�", -// dangerLevel: "", -// disasterStatus: "", -// drainageArea: "", -// elevation: 0, -// featureDes: "", -// groupMonitor: "鏉庢姊�,瀛欐鍜�,鑼冩弧鐢�,绉﹀缓鏉�,瀛欐姹�,瀛欐浼�", -// hasPlan: "", -// id: "110116030074", -// latitude: 40.56580556, -// length: 0, -// district: "鐞夌拑搴欓晣瀛欒儭娌熸潙灏瑰瑗挎矡", -// longitude: 116.59, -// monitor: "", -// monitorAdvice: "", -// name: "灏瑰瑗挎矡娉ョ煶娴侀殣鎮g偣", -// number: -// "13716108909,13716029391,13716291714,13716191943,13716427398,13124792612", -// preventionDes: -// "宸茬洃娴嬶紱鐏惧浣撳彉鍖栵細4澶勫潯绉墿鍨锛屽爢绉嚦鍧¤剼锛屾柟閲忕害20m鲁銆�", -// preventionLevel: "", -// preventionPlan: "瀹氭湡宸℃煡锛岄璀﹁浆绉�", -// preventionUnit: "涔¢晣", -// principal: "", -// province: "鍖椾含甯�", -// qp: "", -// reason: "", -// responsibleUnit: "", -// riskLevel: "", -// scale: "涓瀷", -// stableLevel: "", -// status: "", -// thickness: 0, -// threatenFamily: 7, -// threatenMoney: 0, -// threatenPopulation: "12", -// threatenType: "", -// town: "鐞夌拑搴欓晣", -// trigger: "", -// type: "娉ョ煶娴�", -// village: "瀛欒儭娌熸潙", -// volume: "", -// volumePotential: "", -// width: 0, -// }, -// { -// activeStatus: "", -// areaCode: "", -// areaName: "", -// brookLength: 0, -// checkId: "", -// city: "鍖椾含甯�", -// codeProvince: "110116", -// county: "鎬�鏌�", -// dangerLevel: "", -// disasterStatus: "", -// drainageArea: "", -// elevation: 0, -// featureDes: "", -// groupMonitor: "鏉庢姊�,瀛欐鍜�,鑼冩弧鐢�,绉﹀缓鏉�,瀛欐姹�,瀛欐浼�", -// hasPlan: "", -// id: "110116030053", -// latitude: 40.57361111, -// length: 0, -// district: "鐞夌拑搴欓晣瀛欒儭娌熸潙鍖楀ぇ鍦拌タ娲煎瓙娌�", -// longitude: 116.5897222, -// monitor: "", -// monitorAdvice: "", -// name: "鍖楀ぇ鍦拌タ娲煎瓙娌熸偿鐭虫祦闅愭偅鐐�", -// number: -// "13716108909,13716029391,13716291714,13716191943,13716427398,13124792612", -// preventionDes: "娌熷彛姝e鎴垮眿锛岄檷闆ㄦ椂鍑烘按閲忓ぇ锛屽缓璁不鐞嗭紝姹涙湡鍔犲己宸℃煡", -// preventionLevel: "", -// preventionPlan: "瀹氭湡宸℃煡锛岄璀﹁浆绉伙紝绔嬭绀虹墝", -// preventionUnit: "涔¢晣", -// principal: "", -// province: "鍖椾含甯�", -// qp: "", -// reason: "", -// responsibleUnit: "", -// riskLevel: "", -// scale: "涓瀷", -// stableLevel: "", -// status: "", -// thickness: 0, -// threatenFamily: 6, -// threatenMoney: 0, -// threatenPopulation: "10", -// threatenType: "", -// town: "鐞夌拑搴欓晣", -// trigger: "", -// type: "娉ョ煶娴�", -// village: "瀛欒儭娌熸潙", -// volume: "", -// volumePotential: "", -// width: 0, -// }, -// { -// activeStatus: "", -// areaCode: "", -// areaName: "", -// brookLength: 0, -// checkId: "", -// city: "鍖椾含甯�", -// codeProvince: "110116", -// county: "鎬�鏌�", -// dangerLevel: "", -// disasterStatus: "", -// drainageArea: "", -// elevation: 0, -// featureDes: "", -// groupMonitor: "鏉庢姊�,瀛欐鍜�,鑼冩弧鐢�,绉﹀缓鏉�,瀛欐姹�,瀛欐浼�", -// hasPlan: "", -// id: "110116020102", -// latitude: 40.55972222, -// length: 0, -// district: "鐞夌拑搴欓晣瀛欒儭娌熸潙鑼冨搴勭帇绉�鑾插灞嬪悗", -// longitude: 116.5922222, -// monitor: "", -// monitorAdvice: "", -// name: "鑼冨搴勭帇绉�鑾插灞嬪悗宕╁闅愭偅鐐�", -// number: -// "13716108909,13716029391,13716291714,13716191943,13716427398,13124792612", -// preventionDes: "杈瑰潯杈冮櫋锛岄『鍚戝博灞傦紝鎴垮眿闈犺繎鍧¤剼锛屽缓璁敖蹇不鐞�", -// preventionLevel: "", -// preventionPlan: "瀹氭湡宸℃煡锛岄璀﹁浆绉伙紝绔嬭绀虹墝", -// preventionUnit: "涔¢晣", -// principal: "", -// province: "鍖椾含甯�", -// qp: "", -// reason: "", -// responsibleUnit: "", -// riskLevel: "", -// scale: "灏忓瀷", -// stableLevel: "", -// status: "", -// thickness: 0, -// threatenFamily: 1, -// threatenMoney: 0, -// threatenPopulation: "3", -// threatenType: "", -// town: "鐞夌拑搴欓晣", -// trigger: "", -// type: "宕╁", -// village: "瀛欒儭娌熸潙", -// volume: "", -// volumePotential: "", -// width: 0, -// }, -// { -// activeStatus: "", -// areaCode: "", -// areaName: "", -// brookLength: 0, -// checkId: "", -// city: "鍖椾含甯�", -// codeProvince: "110116", -// county: "鎬�鏌�", -// dangerLevel: "", -// disasterStatus: "", -// drainageArea: "", -// elevation: 0, -// featureDes: "", -// groupMonitor: "鏉庢姊�,瀛欐鍜�,鑼冩弧鐢�,绉﹀缓鏉�,瀛欐姹�,瀛欐浼�", -// hasPlan: "", -// id: "110116020742", -// latitude: 40.57680556, -// length: 0, -// district: "鐞夌拑搴欓晣瀛欒儭娌熸潙涓変憨鍦拌寖蹇犵敯瀹跺眿鍚�", -// longitude: 116.5887222, -// monitor: "", -// monitorAdvice: "", -// name: "涓変憨鍦拌寖蹇犵敯瀹跺眿鍚庡穿濉岄殣鎮g偣", -// number: -// "13716108909,13716029391,13716291714,13716191943,13716427398,13124792612", -// preventionDes: "", -// preventionLevel: "", -// preventionPlan: "瀹氭湡宸℃煡锛岄璀﹁浆绉伙紝鏇存崲璀︾ず鐗�", -// preventionUnit: "涔¢晣", -// principal: "", -// province: "鍖椾含甯�", -// qp: "", -// reason: "", -// responsibleUnit: "", -// riskLevel: "", -// scale: "涓瀷", -// stableLevel: "", -// status: "", -// thickness: 0, -// threatenFamily: 8, -// threatenMoney: 0, -// threatenPopulation: "23", -// threatenType: "", -// town: "鐞夌拑搴欓晣", -// trigger: "", -// type: "宕╁", -// village: "瀛欒儭娌熸潙", -// volume: "", -// volumePotential: "", -// width: 0, -// }, -// { -// activeStatus: "", -// areaCode: "", -// areaName: "", -// brookLength: 0, -// checkId: "", -// city: "鍖椾含甯�", -// codeProvince: "110116", -// county: "鎬�鏌�", -// dangerLevel: "", -// disasterStatus: "", -// drainageArea: "", -// elevation: 0, -// featureDes: "", -// groupMonitor: "鏉庢姊�,瀛欐鍜�,鑼冩弧鐢�,绉﹀缓鏉�,瀛欐姹�,瀛欐浼�", -// hasPlan: "", -// id: "110116030040", -// latitude: 40.56344444, -// length: 0, -// district: "鐞夌拑搴欓晣瀛欒儭娌熸潙娌宠タ浜庡瑗挎矡", -// longitude: 116.5953889, -// monitor: "", -// monitorAdvice: "", -// name: "浜庡瑗挎矡娉ョ煶娴侀殣鎮g偣", -// number: -// "13716108909,13716029391,13716291714,13716191943,13716427398,13124792612", -// preventionDes: -// "宸茬洃娴嬶紝2018鏉戝凡娌荤悊锛涙矡鍙e爢绉墖鏄庢樉锛屾瀵规埧灞嬶紝寤鸿姹涙湡鍔犲己宸℃煡", -// preventionLevel: "", -// preventionPlan: "瀹氭湡宸℃煡锛岄璀﹁浆绉�", -// preventionUnit: "涔¢晣", -// principal: "", -// province: "鍖椾含甯�", -// qp: "", -// reason: "", -// responsibleUnit: "", -// riskLevel: "", -// scale: "涓瀷", -// stableLevel: "", -// status: "", -// thickness: 0, -// threatenFamily: 18, -// threatenMoney: 0, -// threatenPopulation: "59", -// threatenType: "", -// town: "鐞夌拑搴欓晣", -// trigger: "", -// type: "娉ョ煶娴�", -// village: "瀛欒儭娌熸潙", -// volume: "", -// volumePotential: "", -// width: 0, -// }, -// { -// activeStatus: "", -// areaCode: "", -// areaName: "", -// brookLength: 0, -// checkId: "", -// city: "鍖椾含甯�", -// codeProvince: "110116", -// county: "鎬�鏌�", -// dangerLevel: "", -// disasterStatus: "", -// drainageArea: "", -// elevation: 0, -// featureDes: "", -// groupMonitor: "鏉庢姊�,瀛欐鍜�,鑼冩弧鐢�,绉﹀缓鏉�,瀛欐姹�,瀛欐浼�", -// hasPlan: "", -// id: "110116030055", -// latitude: 40.55283333, -// length: 0, -// district: "鐞夌拑搴欓晣瀛欒儭娌熸潙妞存爲搴曚笅涓滄矡", -// longitude: 116.5999444, -// monitor: "", -// monitorAdvice: "", -// name: "妞存爲搴曚笅涓滄矡娉ョ煶娴侀殣鎮g偣", -// number: -// "13716108909,13716029391,13716291714,13716191943,13716427398,13124792612", -// preventionDes: "宸叉不鐞嗭細濞佽儊瀵硅薄閲嶅锛氫笌110116030015閲嶅5鎴�11浜�", -// preventionLevel: "", -// preventionPlan: "瀹氭湡宸℃煡锛岄璀﹁浆绉伙紝绔嬭绀虹墝", -// preventionUnit: "涔¢晣", -// principal: "", -// province: "鍖椾含甯�", -// qp: "", -// reason: "", -// responsibleUnit: "", -// riskLevel: "", -// scale: "涓瀷", -// stableLevel: "", -// status: "", -// thickness: 0, -// threatenFamily: 5, -// threatenMoney: 0, -// threatenPopulation: "11", -// threatenType: "", -// town: "鐞夌拑搴欓晣", -// trigger: "", -// type: "娉ョ煶娴�", -// village: "瀛欒儭娌熸潙", -// volume: "", -// volumePotential: "", -// width: 0, -// }, -// { -// activeStatus: "", -// areaCode: "", -// areaName: "", -// brookLength: 0, -// checkId: "", -// city: "鍖椾含甯�", -// codeProvince: "110116", -// county: "鎬�鏌�", -// dangerLevel: "", -// disasterStatus: "", -// drainageArea: "", -// elevation: 0, -// featureDes: "", -// groupMonitor: "鏉庢姊�,瀛欐鍜�,鑼冩弧鐢�,绉﹀缓鏉�,瀛欐姹�,瀛欐浼�", -// hasPlan: "", -// id: "110116030054", -// latitude: 40.56166667, -// length: 0, -// district: "鐞夌拑搴欓晣瀛欒儭娌熸潙涓婂彴瀛愭渤涓滃崡娌�", -// longitude: 116.5997222, -// monitor: "", -// monitorAdvice: "", -// name: "娌充笢鍗楁矡娉ョ煶娴侀殣鎮g偣", -// number: -// "13716108909,13716029391,13716291714,13716191943,13716427398,13124792612", -// preventionDes: "宸茬洃娴�", -// preventionLevel: "", -// preventionPlan: "瀹氭湡宸℃煡,绔嬭绀虹墝", -// preventionUnit: "涔¢晣", -// principal: "", -// province: "鍖椾含甯�", -// qp: "", -// reason: "", -// responsibleUnit: "", -// riskLevel: "", -// scale: "灏忓瀷", -// stableLevel: "", -// status: "", -// thickness: 0, -// threatenFamily: 0, -// threatenMoney: 0, -// threatenPopulation: "", -// threatenType: "", -// town: "鐞夌拑搴欓晣", -// trigger: "", -// type: "娉ョ煶娴�", -// village: "瀛欒儭娌熸潙", -// volume: "", -// volumePotential: "", -// width: 0, -// }, -// ]); +const loading = ref(true); // 鎺у埗鍔犺浇鐘舵�� function handleClick(district) { - const entity = viewer.entities.getById(district.unifiedCode); + const entity = viewer.entities.getById(district.hdId); if (entity) { viewer.flyTo(entity, { offset: { @@ -712,22 +90,16 @@ }, }); } - // if (entity) { - // viewer.flyTo(entity) - // } } - -// 闅愭偅鐐瑰垪琛� -const originalData = simStore.DangerPoint; // 瀛樺偍鍘熷鏁版嵁锛堜粎鍔犺浇涓�娆★級 // 鏍规嵁鍖哄煙鍚嶇О杩囨护鏁版嵁 const filterDataByArea = (areaName) => { - if (!areaName) { + if (!areaName || !simStore.DangerPoint || simStore.DangerPoint.length === 0) { districtList.value = []; return; } - districtList.value = originalData.filter((item) => + districtList.value = simStore.DangerPoint.filter((item) => item.position?.includes(areaName) ); }; @@ -743,16 +115,60 @@ filterDataByArea(areaName); }; -// 缁勪欢鎸傝浇鏃跺姞杞藉師濮嬫暟鎹紝骞堕粯璁よ繃婊や负 "瀛欒儭娌�" -onMounted(async () => { - // await loadAllData(); - filterDataByArea("瀛欒儭娌�"); // 榛樿鏄剧ず瀛欒儭娌熺殑鏁版嵁 -}); -onBeforeUnmount(() => { - // removeEntities() +// 鐩戝惉 simStore.DangerPoint 鍙樺寲 +watch( + () => simStore.DangerPoint, + (newVal) => { + if (newVal && newVal.length > 0) { + filterDataByArea(selectValue.value); + loading.value = false; // 鏁版嵁鍔犺浇瀹屾垚 + } else { + districtList.value = []; + loading.value = true; // 鏁版嵁鏈噯澶囧氨缁� + } + }, + { immediate: true } +); + +onMounted(() => { + // 榛樿鍏堟鏌ヤ竴閬嶆暟鎹� + if (simStore.DangerPoint && simStore.DangerPoint.length > 0) { + filterDataByArea("瀛欒儭娌�"); + loading.value = false; + } else { + loading.value = true; + } }); </script> + <style lang="less" scoped> +.loading-overlay { + position: absolute; + top: 120px; + left: 0px; + right: 0px; + bottom: 10px; + background-color: rgba(236, 233, 233, 0.5); /* 鍗婇�忔槑閬僵 */ + display: flex; + align-items: center; + justify-content: center; + z-index: 999; +} + +.spinner { + width: 40px; + height: 40px; + border: 4px solid #fff; + border-top: 4px solid transparent; + border-radius: 50%; + animation: spin 1s linear infinite; +} + +@keyframes spin { + to { + transform: rotate(360deg); + } +} .district { position: absolute; width: 345px; @@ -786,6 +202,14 @@ overflow: hidden; text-overflow: ellipsis; } + +.loading-text { + color: white; + font-size: 14px; + text-align: center; + margin-top: 20px; +} + /deep/ .el-select__placeholder { color: white; } diff --git a/src/components/monifangzhen/schemeCard.vue b/src/components/monifangzhen/schemeCard.vue index 99c7112..875157c 100644 --- a/src/components/monifangzhen/schemeCard.vue +++ b/src/components/monifangzhen/schemeCard.vue @@ -158,7 +158,6 @@ () => props.deleteSim, (newVal) => { if (newVal) { - console.log(newVal); deleteSim(); emit("reset"); } diff --git a/src/components/tools/Detail.vue b/src/components/tools/Detail.vue index 64d6492..a4ad46b 100644 --- a/src/components/tools/Detail.vue +++ b/src/components/tools/Detail.vue @@ -1,233 +1,223 @@ <template> - <div class="detail" ref="detailRef"> - <div class="detail-top">{{ detailTitle }}</div> - <div class="detail-close" @click="closeMsg"></div> - <div class="detail-context"> - <div v-for="(item, key) in detailList" :key="key" class="detail-item"> - <div class="detail-name">{{ item.name }}</div> - <div class="detail-value" :title="item.value">{{ item.value || "--" }}</div> - </div> - </div> - </div> + <div class="detail" ref="detailRef"> + <div class="detail-top">{{ detailTitle }}</div> + <div class="detail-close" @click="closeMsg"></div> + <div class="detail-context"> + <div v-for="(item, key) in detailList" :key="key" class="detail-item"> + <div class="detail-name">{{ item.name }}</div> + <div class="detail-value" :title="item.value"> + {{ item.value || "--" }} + </div> + </div> + </div> + </div> </template> <script setup> - import { ref, onMounted, nextTick, onUnmounted } from "vue"; - import { showDeviceDetail, deviceDetail, className, dialogPositon } from "@/store" +import { ref, onMounted, nextTick, onUnmounted } from "vue"; +import { + showDeviceDetail, + deviceDetail, + className, + dialogPositon, +} from "@/store"; - // props: { - // deviceDetail: { - // type: Object, - // default: { - // deviceCode: "1101161102180100031040", - // deviceId: "1554360448383913986", - // deviceName: "鎬�鏌斿尯鐞夌拑搴欓晣瀛欒儭娌熸潙浜庡瑗挎矡娆″0浠�1040", - // dictDeviceType: "1437295832", - // latitude: 40.563822, - // longitude: 116.592648, - // type: "娆$敓浠�", - // name: "鎬�鏌斿尯鐞夌拑搴欓晣瀛欒儭娌熸潙浜庡瑗挎矡娆″0浠�1040", - // id: "1554360448383913986", - // }, - // }, - // }, - const detailList = ref([]) - const detailTitle = ref("璁惧璇︽儏") - function closeMsg() { - showDeviceDetail.value = false - coloseDialog() - } - function handlDeviceDetail() { - const name = deviceDetail.value.name.split("瀛欒儭娌�")[1] || deviceDetail.value.deviceName - detailTitle.value = name - detailList.value = [ - { - name: "璁惧缂栧彿", - value: deviceDetail.value.deviceCode || Math.floor(Math.random() * 100000), - }, - { - name: "璁惧绫诲瀷", - value: deviceDetail.value.type || "", - }, - { - name: "瀹夎鏃堕棿", - value: "2024-01-15 12:55:18", - }, - { - name: "鏇存柊鏃堕棿", - value: "2025-02-15 8:15:28", - }, - { - name: "璁惧浣嶇疆", - value: deviceDetail.value.name.split("瀛欒儭娌�")[0] || cityData.listData[0], - }, - ] - } - function handleDistrictDetail() { - const name = deviceDetail.value.name || deviceDetail.value.district - detailTitle.value = name - detailList.value = [ - { - name: "闅愭偅绫诲瀷", - value: deviceDetail.value.type || "娉ョ煶娴�", - }, - // { - // name: "濞佽儊浜烘暟", - // value: deviceDetail.value.type || "", - // }, - { - name: "涓荤绉戦暱", - value: "寮犳旦", - }, - { - name: "涓荤闀囬暱", - value: "鍒樹匠鏂�", - }, - { - name: "缇ゆ祴缇ら槻", - value: deviceDetail.value.groupMonitor, - }, - { - name: "闅愭偅浣嶇疆", - value: deviceDetail.value.district, - }, - { - name: "棰勯槻鏂规", - value: deviceDetail.value.preventionPlan, - }, - ] - } - function loadClassNameDetail() { - if (className.value == "device") { - handlDeviceDetail() - } else if (className.value == "district") { - handleDistrictDetail() - } - } - const detailRef = ref(null) - //灞曠ず灞炴�ф - function calcDialogPostion() { - const position = dialogPositon.value; - if (!position) { - console.error("dialogPositon is null or invalid"); - return; - } +const detailList = ref([]); +const detailTitle = ref("璁惧璇︽儏"); +function closeMsg() { + showDeviceDetail.value = false; + coloseDialog(); +} +// 鐩戞祴璁惧鍏蜂綋淇℃伅 +function handlDeviceDetail() { + const name = deviceDetail.value.name; + detailTitle.value = name; + detailList.value = [ + { + name: "璁惧缂栧彿", + value: + deviceDetail.value.deviceCode || Math.floor(Math.random() * 100000), + }, + { + name: "璁惧绫诲瀷", + value: deviceDetail.value.type || "", + }, + { + name: "瀹夎鏃堕棿", + value: "2024-01-15 12:55:18" || deviceDetail.value.startTime, + }, + { + name: "鏇存柊鏃堕棿", + value: "2025-02-15 8:15:28", + }, + { + name: "璁惧浣嶇疆", + value: deviceDetail.value.deviceForShort || cityData.listData[0], + // value: deviceDetail.value.name.split("瀛欒儭娌�")[0] || cityData.listData[0], + }, + ]; +} +// 闅愭偅鐐瑰叿浣撲俊鎭� +function handleDistrictDetail() { + const name = deviceDetail.value.hdName; + detailTitle.value = name; + detailList.value = [ + { + name: "闅愭偅绫诲瀷", + value: deviceDetail.value.disasterType || "娉ョ煶娴�", + }, + { + name: "涓荤绉戦暱", + value: "寮犳旦", + }, + { + name: "涓荤闀囬暱", + value: deviceDetail.value.supervisorAlcaldeUserName, + }, + { + name: "缇ゆ祴缇ら槻", + value: deviceDetail.value.groupTestGroupDefenseUserName, + }, + { + name: "闅愭偅浣嶇疆", + value: deviceDetail.value.position, + }, + { + name: "棰勯槻鏂规", + value: deviceDetail.value.preventionSuggestion, + }, + ]; +} +function loadClassNameDetail() { + if (className.value == "device") { + handlDeviceDetail(); + } else if (className.value == "district") { + handleDistrictDetail(); + } +} +const detailRef = ref(null); +//灞曠ず灞炴�ф +function calcDialogPostion() { + const position = dialogPositon.value; + if (!position) { + console.error("dialogPositon is null or invalid"); + return; + } - const bubble = detailRef.value; - if (!bubble) { - console.error("detailRef is null, DOM not ready"); - return; - } + const bubble = detailRef.value; + if (!bubble) { + console.error("detailRef is null, DOM not ready"); + return; + } - let winpos = window.viewer.scene.cartesianToCanvasCoordinates(position); - if (!winpos || isNaN(winpos.x) || isNaN(winpos.y)) { - console.error("Invalid canvas coordinates:", winpos); - return; - } + let winpos = window.viewer.scene.cartesianToCanvasCoordinates(position); + if (!winpos || isNaN(winpos.x) || isNaN(winpos.y)) { + console.error("Invalid canvas coordinates:", winpos); + return; + } - let poph = bubble.offsetHeight; - bubble.style.left = winpos.x - 200 + "px"; - let top = winpos.y - poph - 50; - bubble.style.top = top + "px"; + let poph = bubble.offsetHeight; + bubble.style.left = winpos.x - 200 + "px"; + let top = winpos.y - poph - 50; + bubble.style.top = top + "px"; } - - //鍏抽棴灞炴�ф - const coloseDialog = () => { - window.viewer.scene.postRender.removeEventListener(calcDialogPostion) - } - onMounted(() => { - loadClassNameDetail(); - nextTick(() => { - window.viewer.scene.postRender.addEventListener(calcDialogPostion); - }); +//鍏抽棴灞炴�ф +const coloseDialog = () => { + window.viewer.scene.postRender.removeEventListener(calcDialogPostion); +}; +onMounted(() => { + loadClassNameDetail(); + nextTick(() => { + window.viewer.scene.postRender.addEventListener(calcDialogPostion); + }); }); onUnmounted(() => { - // 瑙e喅dom涓璷ffHeight鎶ラ敊 - window.viewer.scene.postRender.removeEventListener(calcDialogPostion); + // 瑙e喅dom涓璷ffHeight鎶ラ敊 + window.viewer.scene.postRender.removeEventListener(calcDialogPostion); }); </script> <style lang="less" scoped> - .detail { - background: url("@/assets/img/tools/messagebg.png"); - background-size: 100% 100%; - width: 24.4375rem; - height: 24.5rem; - position: absolute; - top: 30%; - right: 30%; - } +.detail { + background: url("@/assets/img/tools/messagebg.png"); + background-size: 100% 100%; + width: 24.4375rem; + height: 24.5rem; + position: absolute; + top: 30%; + right: 30%; +} - .detail-top { - position: absolute; - top: 0.3125rem; - left: 1.25rem; - font-weight: 700; - font-size: 1.125rem; - font-weight: 700; - color: #fff; - line-height: 2.5rem; - width: 16.875rem; - cursor: pointer; - } +.detail-top { + position: absolute; + top: 0.3125rem; + left: 1.25rem; + font-weight: 700; + font-size: 1.125rem; + font-weight: 700; + color: #fff; + line-height: 2.5rem; + width: 16.875rem; + cursor: pointer; +} - .detail-close { - position: absolute; - right: 0.1875rem; - top: 0rem; - width: 1.25rem; - height: 1.25rem; - text-align: center; - line-height: 1.25rem; - text-align: center; +.detail-close { + position: absolute; + right: 0.1875rem; + top: 0rem; + width: 1.25rem; + height: 1.25rem; + text-align: center; + line-height: 1.25rem; + text-align: center; - font-weight: 700; - font-size: 1.125rem; - font-weight: 700; - color: #fff; - cursor: pointer; - } + font-weight: 700; + font-size: 1.125rem; + font-weight: 700; + color: #fff; + cursor: pointer; +} - .detail-context { - position: absolute; - top: 3.8rem; - left: 1.25rem; - width: 21.875rem; - } +.detail-context { + position: absolute; + top: 3.8rem; + left: 1.25rem; + width: 21.875rem; +} - .detail-item { - display: flex; - height: 1.4375rem; - margin-top: 0.9375rem; - margin-left: 0.625rem; - } - .detail-name { - width: 100px; - font-weight: 700; - color: #94e0c4; - &::after { - content: "锛�"; - } - } +.detail-item { + display: flex; + height: 1.4375rem; + margin-top: 0.9375rem; + margin-left: 0.625rem; +} +.detail-name { + width: 100px; + font-weight: 700; + color: #94e0c4; + &::after { + content: "锛�"; + } +} - .detail-value { - color: #e1eee9; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - width: 250px; - } +.detail-value { + color: #e1eee9; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: 250px; +} - .detail-btn { - background: url("@/assets/img/tools/messagebtn.png") no-repeat; - position: absolute; - bottom: 3.75rem; - right: 3.75rem; - width: 6.5625rem; - height: 1.625rem; - text-align: center; - color: #fff; - cursor: pointer; - } +.detail-btn { + background: url("@/assets/img/tools/messagebtn.png") no-repeat; + position: absolute; + bottom: 3.75rem; + right: 3.75rem; + width: 6.5625rem; + height: 1.625rem; + text-align: center; + color: #fff; + cursor: pointer; +} </style> diff --git a/src/components/tools/LayerTree.vue b/src/components/tools/LayerTree.vue index 214ca3e..7a44b05 100644 --- a/src/components/tools/LayerTree.vue +++ b/src/components/tools/LayerTree.vue @@ -13,18 +13,26 @@ </template> <script setup> -import { ref, onMounted, watch, nextTick, onUnmounted } from "vue"; +import { + ref, + onMounted, + watch, + nextTick, + onUnmounted, + computed, + watchEffect, +} from "vue"; import { createPoint, removeEntities, addTileset } from "@/utils/map"; import { deviceDictList, getDictName } from "@/constant/dict.js"; import { useRoute } from "vue-router"; import { loadAreaPolygon, clearAreaPolygon } from "@/utils/area"; import { checkedKeys } from "@/store/index"; -import { - getDuanMainData, - getDevicetListData, - getDistrictListData, -} from "@/api/index.js"; -import { init } from "echarts"; +import { getDuanMainData, getDistrictListData } from "@/api/index.js"; +import { getDeviceInfo, getDangerPoint } from "@/api/hpApi"; + +import { useSimStore } from "@/store/simulation"; + +const simStore = useSimStore(); const route = useRoute(); @@ -34,7 +42,7 @@ label: "涓夌淮鏈嶅姟", children: [ { label: "妯″瀷鏁版嵁" }, - { label: "鍦板舰鏁版嵁" }, + { label: "鍦板舰鏁版嵁" }, { label: "褰卞儚鏁版嵁" }, ], }, @@ -85,7 +93,6 @@ // // }); // // treeMap.set("褰卞儚鏁版嵁", ImageryLayer); // } - // 鍦板舰鏁版嵁 let TerrainLayer = null; @@ -216,16 +223,15 @@ } } -// 璁惧鍒楄〃 +// 鐩戞祴璁惧鍒楄〃 const devicetList = ref([]); -/** - * 鑾峰彇璁惧鍒楄〃骞跺垵濮嬪寲璁惧鐐� - */ +// 鐩戞祴璁惧鍒楄〃 const getDevicetList = async () => { - await getDevicetListData().then((res) => { - devicetList.value = res.data; - }); + const res = await getDeviceInfo(); // 璋冩暣getDeviceInfo浠ユ帴鍙楀姩鎬佸弬鏁帮紝濡傛灉闇�瑕佺殑璇� + devicetList.value = res.data.pageData.filter((item) => + item.deviceName?.includes("瀛欒儭娌�") + ); }; async function initDevicePoint() { @@ -233,7 +239,7 @@ await getDevicetList(); devicetList.value.forEach((item) => { item.type = getDictName(deviceDictList, item.dictDeviceType); - item.name = item.type; + item.name = item.deviceName.split("瀛欒儭娌�")[1]; item.id = item.deviceId; item.className = "device"; item.showLabel = true; @@ -245,34 +251,34 @@ treeMap.set("缁煎悎鐩戞祴璁惧淇℃伅", list); } -// 鍖哄煙鍒楄〃 -const districtList = ref([]); +// 闅愭偅鐐瑰垪琛� +watchEffect(() => { + const dangerPoints = simStore.DangerPoint.filter((item) => + item.position?.includes("瀛欒儭娌�") + ); -/** - * 鑾峰彇鍖哄煙鍒楄〃骞跺垵濮嬪寲鍖哄煙鐐� - */ -const getDistrictList = async () => { - await getDistrictListData().then((res) => { - districtList.value = res.data; - }); -}; + if (dangerPoints && dangerPoints.length > 0) { + const list = []; -async function initDistrictPoint() { - let list = []; - await getDistrictList(); - districtList.value.forEach((item) => { - item.showBillboard = true; - item.className = "district"; - // item.type = "娉ョ煶娴�"; //鏁版嵁icon璁剧疆 - const entity = createPoint(item); - entity.show = false; - list.push(entity); - }); - treeMap.set("瀛欒儭娌熼殣鎮g偣", list); -} + dangerPoints.forEach((item) => { + // console.log(item, "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"; + const entity = createPoint(item); + entity.show = false; + list.push(entity); + }); + + treeMap.set("瀛欒儭娌熼殣鎮g偣", list); + } +}); let divPointList = []; - /** * 鍒濆鍖栨柇闈㈢偣 */ @@ -320,7 +326,7 @@ */ function getData() { initDevicePoint(); - initDistrictPoint(); + // initDistrictPoint(); initDuanmianPoint(); addTetrahedron(); } @@ -393,6 +399,6 @@ overflow: hidden; } /deep/ .el-tree { - overflow: hidden !important; + overflow: hidden !important; } </style> diff --git a/src/views/GisView.vue b/src/views/GisView.vue index 71f268b..322259a 100644 --- a/src/views/GisView.vue +++ b/src/views/GisView.vue @@ -444,7 +444,7 @@ initMap(); // 鍦ㄤ綘鐨勫垵濮嬪寲浠g爜涓皟鐢ㄨ繖涓嚱鏁� addCityPolygon(); - // initHandler(); + initHandler(); // initView() loadAreaPolygon("/json/nsl_area.geojson"); loadAreaPolygonAll("/json/geometry.json", true); diff --git a/src/views/left/KGSimOption/PredictiveSimulation.vue b/src/views/left/KGSimOption/PredictiveSimulation.vue index 24f1adb..8b36034 100644 --- a/src/views/left/KGSimOption/PredictiveSimulation.vue +++ b/src/views/left/KGSimOption/PredictiveSimulation.vue @@ -164,7 +164,6 @@ const getRain = () => { getRainfallData().then((res) => { rainFall.value = res.data.pageData; - console.log(res.data, "res"); }); }; diff --git a/src/views/left/Left.vue b/src/views/left/Left.vue index 94546e9..20a3514 100644 --- a/src/views/left/Left.vue +++ b/src/views/left/Left.vue @@ -47,7 +47,6 @@ import { createPoint, removeEntities } from "@/utils/map"; // import { deviceDictList, getDictName } from "@/constant/dict.js"; -import { getDeviceData } from "@/api/index"; const emits = defineEmits(["start", "end"]); const list = [ @@ -349,11 +348,7 @@ // createPoint(item) }); } -function getData() { - getDeviceData().then((res) => { - devicetList.value = res.data; - }); -} + function createLabel(item) { const { name, x, y, showBillboard = false } = item; let position = Cesium.Cartesian3.for(x, y); @@ -438,7 +433,6 @@ emits("end"); } onMounted(() => { - // getData() // initDevicePoint() }); -- Gitblit v1.9.3