From f71fff252df9b33ca92a67c44e849a9bd59679fa Mon Sep 17 00:00:00 2001 From: panyuyi Date: Wed, 12 Mar 2025 21:07:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=B0=B4=E9=97=B8?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=8E=A5=E5=8F=A3=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../waterSetting/runScene/layerTree/index.js | 3 +- src/views/dike/safeOperation/index.vue | 44 ++++--- src/views/reservoir/safeOperation/index.vue | 109 +++++++++++------- .../overviewAnalysis/index.vue | 12 +- .../statisticsAnalysis/index.vue | 54 ++++----- src/views/sluice/safeOperation/index.vue | 107 +++++++++++------ 6 files changed, 196 insertions(+), 133 deletions(-) diff --git a/src/views/aiSupervision/waterSetting/runScene/layerTree/index.js b/src/views/aiSupervision/waterSetting/runScene/layerTree/index.js index c1b26d2..7065248 100644 --- a/src/views/aiSupervision/waterSetting/runScene/layerTree/index.js +++ b/src/views/aiSupervision/waterSetting/runScene/layerTree/index.js @@ -219,9 +219,8 @@ export async function addLayer(layerData) { return; } if (!layerType || !(action = layerActions[layerType])) return; - console.log(action) const layer = await action(layerData); - console.log(layer) + console.log(layer); layer && window.viewer.addLayer(layer); if (["013000"].includes(layerType)) { // 3d tiles diff --git a/src/views/dike/safeOperation/index.vue b/src/views/dike/safeOperation/index.vue index 0a539d8..7ad7792 100644 --- a/src/views/dike/safeOperation/index.vue +++ b/src/views/dike/safeOperation/index.vue @@ -17,7 +17,7 @@ > -->
-
+
图层管理
@@ -36,7 +36,7 @@ :data="treeData" default-expand-all node-key="id" - ref="tree" + ref="treeRef" show-checkbox highlight-current :props="defaultProps" @@ -140,17 +140,21 @@ export default { }); let id = res1.records?.[0]?.id; let res2 = await getLayerData(id); - this.treeData = res2.data.children; - getSceneConfig(id).then((res) => { - console.log("配置 >>>>> ", res); - this.configData = res.data || null; - if (res.data?.layerId) { - this.checkList = JSON.parse(res.data?.layerId); - this.layerList = this.treeData.filter((item) => { - return this.checkList.includes(item.id); - }); - } - }); + this.treeData = res2.data?.children || []; + let res3 = await getSceneConfig(id); + this.configData = res3.data || null; + if (res3.data?.layerId && typeof res3.data.layerId === "string") { + this.checkList = JSON.parse(res3.data?.layerId); + this.treeData.forEach((item) => { + if (item.layers) { + let arr = item.layers?.filter((item) => + this.checkList.includes(item.id) + ); + this.layerList.push(...arr); + } + }); + } + this.initMap(); }, handleChangeMode() { this.mapSceneType = this.mapSceneType === 3 ? 2 : 3; @@ -232,7 +236,14 @@ export default { this.viewerAddEventListener(); }, 300); }, - + handleChangeTreeShow() { + this.showTreeBox = !this.showTreeBox; + if (this.showTreeBox) { + this.$nextTick(() => { + this.$refs.treeRef?.setCheckedKeys(this.checkList); + }); + } + }, handleAddHtmlLayer(position, data) { console.log("添加DivIcon >>>>> ", position, data); htmlLayer?.clear(); @@ -329,7 +340,6 @@ export default { }, }, created() { - this.initData(); emitter.on("openDialog", this.openDialog); // devRun(() => { // setTimeout(() => { @@ -341,9 +351,7 @@ export default { // }); }, mounted() { - setTimeout(() => { - this.initMap(); - }, 50); + this.initData(); }, beforeDestroy() { window.viewer = null; diff --git a/src/views/reservoir/safeOperation/index.vue b/src/views/reservoir/safeOperation/index.vue index 51b3e97..33c4a0c 100644 --- a/src/views/reservoir/safeOperation/index.vue +++ b/src/views/reservoir/safeOperation/index.vue @@ -17,7 +17,7 @@ > -->
-
+
图层管理
@@ -36,7 +36,7 @@ :data="treeData" default-expand-all node-key="id" - ref="tree" + ref="treeRef" show-checkbox highlight-current :props="defaultProps" @@ -157,17 +157,21 @@ export default { }); let id = res1.records?.[0]?.id; let res2 = await getLayerData(id); - this.treeData = res2.data.children; - getSceneConfig(id).then((res) => { - console.log("配置 >>>>> ", res); - this.configData = res.data || null; - if (res.data?.layerId) { - this.checkList = JSON.parse(res.data?.layerId); - this.layerList = this.treeData.filter((item) => { - return this.checkList.includes(item.id); - }); - } - }); + this.treeData = res2.data?.children || []; + let res3 = await getSceneConfig(id); + this.configData = res3.data || null; + if (res3.data?.layerId && typeof res3.data.layerId === "string") { + this.checkList = JSON.parse(res3.data?.layerId); + this.treeData.forEach((item) => { + if (item.layers) { + let arr = item.layers?.filter((item) => + this.checkList.includes(item.id) + ); + this.layerList.push(...arr); + } + }); + } + this.initMap(); }, handleChangeMode() { this.mapSceneType = this.mapSceneType === 3 ? 2 : 3; @@ -182,10 +186,15 @@ export default { ); }, handleGetResInfo(data) { - console.log("handleGetResInfo >>>>> ", data); this.resInfoData = data; }, initMap() { + if (!sycim) { + setTimeout(() => { + this.initMap(); + }, 1000); + return; + } viewer = new sycim.Viewer("reservoir-map-container"); window.viewer = viewer; let baseLayer = sycim.ImageryLayerFactory.createImageryLayer( @@ -207,32 +216,50 @@ export default { depthTestAgainstTerrain: true, }, }); - // 三维模型才需要 - // viewer.on( - // sycim.SceneEventType.CAMERA_CHANGED, - // () => { - // viewer.setOptions({ - // globe: { - // depthTestAgainstTerrain: viewer.cameraPosition.alt > 10000 ? false : true - // } - // }); - // }, - // viewer - // ); + setTimeout(() => { - viewer.scene.camera.setView({ - destination: new Cesium.Cartesian3.fromDegrees(113.27, 23.13, 600000), - // orientation: { - // heading: 0, - // pitch: -90, - // roll: 0, - // }, - duration: 2, - }); + if (this.layerList.length) { + this.layerList.forEach((item) => { + addLayer(item); + }); + } + if (this.configData) { + let pos = JSON.parse(this.configData.cameraPosture); + viewer.scene.camera.setView({ + destination: new Cesium.Cartesian3.fromDegrees( + pos.lng, + pos.lat, + pos.alt + ), + + duration: 2, + }); + } else { + viewer.scene.camera.setView({ + destination: new Cesium.Cartesian3.fromDegrees( + 113.27, + 23.13, + 600000 + ), + // orientation: { + // heading: 0, + // pitch: -90, + // roll: 0, + // }, + duration: 2, + }); + } this.viewerAddEventListener(); }, 300); }, - + handleChangeTreeShow() { + this.showTreeBox = !this.showTreeBox; + if (this.showTreeBox) { + this.$nextTick(() => { + this.$refs.treeRef?.setCheckedKeys(this.checkList); + }); + } + }, handleAddHtmlLayer(position, data) { console.log("添加DivIcon >>>>> ", position, data); htmlLayer?.clear(); @@ -316,13 +343,10 @@ export default { } }, handleCheckTree(data, checked) { - console.log("data, checked >>>>> ", data, checked); - console.log("getCheckedNodes >>>>> ", this.$refs.tree.getCheckedNodes()); if (data.pid === "root" || data.layers) return; if (checked) { this.checkList = [...this.checkList, data.id]; - const list = this.$refs.tree.getCheckedNodes(); - console.log("checkList >>>>> ", this.checkList); + const list = this.$refs.treeRef?.getCheckedNodes(); addLayer(data); this.legendList = getSelectedLayersLegend(list); this.layerList.push(data); @@ -334,7 +358,6 @@ export default { }, }, created() { - this.initData(); emitter.on("openDialog", this.openDialog); // devRun(() => { // setTimeout(() => { @@ -346,9 +369,7 @@ export default { // }); }, mounted() { - setTimeout(() => { - this.initMap(); - }, 50); + this.initData(); }, beforeDestroy() { window.viewer = null; diff --git a/src/views/sluice/runManage/patrolMaintenance/overviewAnalysis/index.vue b/src/views/sluice/runManage/patrolMaintenance/overviewAnalysis/index.vue index 161d17e..3c35dd7 100644 --- a/src/views/sluice/runManage/patrolMaintenance/overviewAnalysis/index.vue +++ b/src/views/sluice/runManage/patrolMaintenance/overviewAnalysis/index.vue @@ -180,7 +180,7 @@ export default { getTableData() { // 渲染工程分布 this.renderEcharts({ - group: "C_1", + group: "C_SZ_1", echartsInstanceName: "proEchartInstance", echartsDomName: "proEchart", echartsOptions: { @@ -197,7 +197,7 @@ export default { // 渲染图表和统计总数 if (res.data?.yaxis?.length) { let num = res.data.yaxis[0]?.series.find( - (v) => v.code === "DF_PROJECT_ADCD_SUM" + (v) => v.code === "SZ_PROJECT_ADCD_SUM" )?.sum; this.projectSum = Number(num ?? null); } @@ -205,7 +205,7 @@ export default { }); // 获取巡查分析数据 this.renderEcharts({ - group: "C_2", + group: "C_SZ_2", echartsInstanceName: "patrolEchartInstance", echartsDomName: "patrolEchart", echartsOptions: { @@ -229,7 +229,7 @@ export default { }); // 获取巡查分析数据 this.renderEcharts({ - group: "C_3", + group: "C_SZ_3", echartsInstanceName: "compareEchartInstance", echartsDomName: "compareEchart", echartsOptions: { @@ -244,9 +244,9 @@ export default { // 渲染图表和统计总数 if (res.data?.yaxis?.length) { let newArr = res.data.yaxis.flatMap((v) => v.series); - let num1 = newArr.find((v) => v.code === "DF_QX_ADCD_SUM")?.sum; + let num1 = newArr.find((v) => v.code === "SZ_QX_ADCD_SUM")?.sum; this.flawSum = Number(num1 ?? null); - let num2 = newArr.find((v) => v.code === "DF_YH_ADCD_SUM")?.sum; + let num2 = newArr.find((v) => v.code === "SZ_YH_ADCD_SUM")?.sum; this.yhSum = Number(num2 ?? null); } } diff --git a/src/views/sluice/runManage/patrolMaintenance/statisticsAnalysis/index.vue b/src/views/sluice/runManage/patrolMaintenance/statisticsAnalysis/index.vue index 9ae03f1..6d3971d 100644 --- a/src/views/sluice/runManage/patrolMaintenance/statisticsAnalysis/index.vue +++ b/src/views/sluice/runManage/patrolMaintenance/statisticsAnalysis/index.vue @@ -21,17 +21,17 @@ remote filterable reserve-keyword - :remote-method="handleGetRemoteDikeMethod" - @focus="handleGetRemoteDikeMethod('')" - @change="handleChangeDike" - v-model="paramsData.dikeCode" - placeholder="请选择堤防" + :remote-method="handleGetRemoteProMethod" + @focus="handleGetRemoteProMethod('')" + @change="handleChangeSelect" + v-model="paramsData.wagaCode" + placeholder="请选择水闸" > v.dikeCode === this.paramsData.dikeCode + handleChangeSelect() { + let res = this.proList.find( + (v) => v.wagaCode === this.paramsData.wagaCode ); this.paramsData.dikeType = res.dikeType; - this.paramsData.dikeName = res.dikeName; + this.paramsData.wagaName = res.wagaName; }, - handleGetRemoteDikeMethod(query) { + handleGetRemoteProMethod(query) { getRunProjectList({ pageSize: 10, pageNum: 1, data: { - dikeName: query, + wagaName: query, }, }).then((res) => { if (res) { - this.dikeList = res.records; + this.proList = res.records; } }); }, @@ -270,7 +271,7 @@ export default { // 获取页面数据 getTableData() { // 巡查记录分析 - this.requestFunc({ group: "C_14" }).then((res) => { + this.requestFunc({ group: "C_SZ_14" }).then((res) => { if (res.data) { // 渲染图表和统计总数 if (res.data?.yaxis?.length) { @@ -354,7 +355,7 @@ export default { } }); // 巡查缺陷分析 - this.requestFunc({ group: "C_15" }).then((res) => { + this.requestFunc({ group: "C_SZ_15" }).then((res) => { if (res.data) { if (res.data?.yaxis?.length) { this.flawSum = res.data.yaxis @@ -435,7 +436,7 @@ export default { } }); // 缺陷问题等级分析 - this.requestFunc({ group: "C_16" }).then((res) => { + this.requestFunc({ group: "C_SZ_16" }).then((res) => { if (res.data) { this.$nextTick(() => { // 柱形图 @@ -546,13 +547,13 @@ export default { } }); // 缺陷养护对比分析 - this.requestFunc({ group: "C_17" }).then((res) => { + this.requestFunc({ group: "C_SZ_17" }).then((res) => { if (res.data) { if (res.data.yaxis?.length) { this.yhSum = Number( res.data.yaxis .flatMap((v) => v.series) - ?.find((v) => v.code === "DF_BD_YH_SUM")?.sum ?? null + ?.find((v) => v.code === "SZ_BD_YH_SUM")?.sum ?? null ); } this.$nextTick(() => { @@ -622,13 +623,12 @@ export default { ], seriesOptions: {}, }); - console.log("options >>>>> ", options); this.yhCompareRefPieInstance.setOption(options); }); } }); // 项目统计总数 - this.requestFunc({ group: "C_18" }).then((res) => { + this.requestFunc({ group: "C_SZ_18" }).then((res) => { if (res.data) { if (res.data?.yaxis?.length) { let newArr = res.data.yaxis.flatMap((v) => v.series); @@ -646,7 +646,7 @@ export default { }, resetSearch() { this.paramsData.timeRange = []; - this.paramsData.dikeCode = null; + this.paramsData.wagaCode = null; this.getTableData(); }, }, diff --git a/src/views/sluice/safeOperation/index.vue b/src/views/sluice/safeOperation/index.vue index 950b40f..86d4a49 100644 --- a/src/views/sluice/safeOperation/index.vue +++ b/src/views/sluice/safeOperation/index.vue @@ -17,7 +17,7 @@ > -->
-
+
图层管理
@@ -36,7 +36,7 @@ :data="treeData" default-expand-all node-key="id" - ref="tree" + ref="treeRef" show-checkbox highlight-current :props="defaultProps" @@ -58,7 +58,7 @@
-
<
+
{ - let id = res.records?.[0]?.id; - getLayerData(id).then((res) => { - this.treeData = res.data.children; - }); }); + let id = res1.records?.[0]?.id; + let res2 = await getLayerData(id); + this.treeData = res2.data?.children || []; + let res3 = await getSceneConfig(id); + this.configData = res3.data || null; + if (res3.data?.layerId && typeof res3.data.layerId === "string") { + this.checkList = JSON.parse(res3.data?.layerId); + this.treeData.forEach((item) => { + if (item.layers) { + let arr = item.layers?.filter((item) => + this.checkList.includes(item.id) + ); + this.layerList.push(...arr); + } + }); + } + this.initMap(); }, handleChangeMode() { this.mapSceneType = this.mapSceneType === 3 ? 2 : 3; @@ -157,6 +171,12 @@ export default { this.resInfoData = data; }, initMap() { + if (!sycim) { + setTimeout(() => { + this.initMap(); + }, 1000); + return; + } viewer = new sycim.Viewer("reservoir-map-container"); window.viewer = viewer; let baseLayer = sycim.ImageryLayerFactory.createImageryLayer( @@ -178,32 +198,50 @@ export default { depthTestAgainstTerrain: true, }, }); - // 三维模型才需要 - // viewer.on( - // sycim.SceneEventType.CAMERA_CHANGED, - // () => { - // viewer.setOptions({ - // globe: { - // depthTestAgainstTerrain: viewer.cameraPosition.alt > 10000 ? false : true - // } - // }); - // }, - // viewer - // ); + setTimeout(() => { - viewer.scene.camera.setView({ - destination: new Cesium.Cartesian3.fromDegrees(113.27, 23.13, 600000), - // orientation: { - // heading: 0, - // pitch: -90, - // roll: 0, - // }, - duration: 2, - }); + if (this.layerList.length) { + this.layerList.forEach((item) => { + addLayer(item); + }); + } + if (this.configData) { + let pos = JSON.parse(this.configData.cameraPosture); + viewer.scene.camera.setView({ + destination: new Cesium.Cartesian3.fromDegrees( + pos.lng, + pos.lat, + pos.alt + ), + + duration: 2, + }); + } else { + viewer.scene.camera.setView({ + destination: new Cesium.Cartesian3.fromDegrees( + 113.27, + 23.13, + 600000 + ), + // orientation: { + // heading: 0, + // pitch: -90, + // roll: 0, + // }, + duration: 2, + }); + } this.viewerAddEventListener(); }, 300); }, - + handleChangeTreeShow() { + this.showTreeBox = !this.showTreeBox; + if (this.showTreeBox) { + this.$nextTick(() => { + this.$refs.treeRef?.setCheckedKeys(this.checkList); + }); + } + }, handleAddHtmlLayer(position, data) { console.log("添加DivIcon >>>>> ", position, data); htmlLayer?.clear(); @@ -300,7 +338,6 @@ export default { }, }, created() { - this.initData(); emitter.on("openDialog", this.openDialog); // devRun(() => { // setTimeout(() => { @@ -312,9 +349,7 @@ export default { // }); }, mounted() { - setTimeout(() => { - this.initMap(); - }, 50); + this.initData(); }, beforeDestroy() { window.viewer = null;