From da67648220f86993fac22b8199165995df3d8563 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期五, 21 三月 2025 17:35:51 +0800 Subject: [PATCH] 走航融合(待完成) --- src/views/underwaymix/UnderwayMixMode.vue | 200 ++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 171 insertions(+), 29 deletions(-) diff --git a/src/views/underwaymix/UnderwayMixMode.vue b/src/views/underwaymix/UnderwayMixMode.vue index 3d690d3..c0dbe9b 100644 --- a/src/views/underwaymix/UnderwayMixMode.vue +++ b/src/views/underwaymix/UnderwayMixMode.vue @@ -51,8 +51,23 @@ @change="handleMixClick" > </CheckButton> + <CheckButton + :disabled="!mixActive" + active-text="椋庨櫓鐑姏鍥�" + inactive-text="椋庨櫓鐑姏鍥�" + :default-value="false" + @change="handleHeatMapClick" + > + </CheckButton> + <!-- <CheckButton + active-text="鎼滅储缃戞牸" + inactive-text="鎼滅储缃戞牸" + :default-value="false" + @change="handleHeatMapSearchClick" + > + </CheckButton> --> </el-row> - <div class="m-t-8">缃戞牸瑕佺礌</div> + <!-- <div class="m-t-8">缃戞牸瑕佺礌</div> <el-row class="m-t-8"> <CheckButton active-text="鏄剧ず缃戞牸" @@ -99,7 +114,6 @@ </el-row> <div class="m-t-8">璧拌埅瑕佺礌</div> <el-row class="m-t-8"> - <!-- <el-divider content-position="left"></el-divider> --> <el-button type="primary" @@ -110,7 +124,7 @@ > {{ underwayVisible ? '闅愯棌璧拌埅璺嚎' : '鏄剧ず璧拌埅璺嚎' }} </el-button> - </el-row> + </el-row> --> </template> <template #footer> </template> </BaseCard> @@ -126,7 +140,10 @@ </el-row> </el-col> </el-row> - <GridStyleTool :gridCtrls="gridCtrls"></GridStyleTool> + <GridStyleTool + :gridCtrls="gridCtrls" + @show-underway="handleUnderwayClick" + ></GridStyleTool> </el-row> <!-- </div> --> </template> @@ -137,9 +154,11 @@ import gridApi from '@/api/gridApi'; import { SatelliteGrid } from '@/model/SatelliteGrid'; import GridStyleTool from './component/GridStyleTool.vue'; +import { useGridStore } from '@/stores/grid-info'; + +const gridStore = useGridStore(); const satelliteGrid = new SatelliteGrid('璧拌埅铻嶅悎'); - const gridCtrls = ref([satelliteGrid]); // 鍊熺敤鍗槦閬ユ祴妯″潡涓殑100绫崇綉鏍� @@ -163,6 +182,7 @@ const gridDataDetailMap = new Map(); const mixActive = ref(false); +const heatActive = ref(false); const gridVisible = ref(true); const underwayVisible = ref(false); const rankVisible = ref(false); @@ -206,7 +226,32 @@ } function prepareGrid(gridInfo) { - satelliteGrid.gridPrepare(gridInfo); + satelliteGrid.gridPrepare(gridInfo, (polygon) => { + //榧犳爣绉诲叆浜嬩欢 + polygon.on('mouseover', () => { + polygon.setOptions({ + //淇敼澶氳竟褰㈠睘鎬х殑鏂规硶 + strokeWeight: 2, + strokeColor: 'red' + }); + }); + //榧犳爣绉诲嚭浜嬩欢 + polygon.on('mouseout', () => { + polygon.setOptions({ + strokeWeight: 1, + strokeColor: 'white' + }); + }); + }); + // satelliteGrid.setGridEvent('click', (gridCell, gridDataDetail) => { + // // const polygon = e.target + // // const { gridCell } = polygon.getExtData(); + // // const cellIndex = gridCell.cellIndex; + // gridStore.selectedGridCellAndDataDetail = { + // gridCell, + // gridDataDetail + // }; + // }); } // watch(mission, (nV, oV) => { @@ -249,9 +294,20 @@ tag: d.id, data: gdd, extData: { - name: `璧拌埅缃戞牸 - ${d.mixDataId}` + name: `璧拌埅缃戞牸 - ${d.mixDataId}`, + type: 0 } }); + satelliteGrid.setGridEvent( + [d.id], + 'click', + (gridCell, gridDataDetail) => { + gridStore.selectedGridCellAndDataDetail = { + gridCell, + gridDataDetail + }; + } + ); gridCtrls.value = [satelliteGrid]; // gridCtrls.value = Array.from(satelliteGrid.mapViewsMap); // console.log(gridCtrls.value); @@ -260,6 +316,7 @@ }); } +let mixTag; function handleMixClick() { mixActive.value = !mixActive.value; const tags = fusionDataList.value @@ -271,13 +328,70 @@ showRankTxt: false }); if (mixActive.value) { - satelliteGrid.mixGrid(tags); + mixTag = satelliteGrid.mixGrid(tags); + satelliteGrid.setGridEvent( + [mixTag], + 'click', + (gridCell, gridDataDetail) => { + gridStore.selectedGridCellAndDataDetail = { + gridCell, + gridDataDetail + }; + } + ); + gridCtrls.value = [satelliteGrid]; } else { satelliteGrid.changeVisibility({ tags, showGridViews: true }); } +} + +let heatTag; +function handleHeatMapClick() { + heatActive.value = !heatActive.value; + satelliteGrid.changeVisibility({ + showGridViews: false, + showDataTxt: false, + showRankTxt: false + }); + if (heatActive.value) { + heatTag = satelliteGrid.drawHeatGrid(mixTag); + satelliteGrid.setGridEvent( + [heatTag], + 'click', + (gridCell, gridDataDetail) => { + gridStore.selectedGridCellAndDataDetail = { + gridCell, + gridDataDetail + }; + } + ); + gridCtrls.value = [satelliteGrid]; + } else { + satelliteGrid.changeVisibility({ + tags: [mixTag], + showGridViews: true + }); + } +} + +function handleHeatMapSearchClick() { + const res = satelliteGrid.search( + { + groupId: 1, + cellId: 2893, + pm25: 50 + }, + 120, + 90, + 10, + 10, + 3 + ); + + console.log(res); } function handleGridClick() { @@ -291,9 +405,18 @@ }); } -function handleUnderwayClick() { +function handleUnderwayClick({ isShow, dataId }) { underwayVisible.value = !underwayVisible.value; - underwayVisible.value ? draw() : mapLine.hideLine(); + + if (isShow) { + draw(dataId); + } else { + const d = fusionDataList.value.find((v) => v.id == dataId); + const mission = missionStore.missionList.find((v) => { + return v.missionCode == d.mixDataId; + }); + mapLine.hideLine(mission.missionCode); + } } function handleRankClick() { @@ -389,30 +512,49 @@ }); } -function draw() { +function draw(dataId) { if (isUnmounted.value) return; - selectedfusionData.value.forEach((i) => { - const d = fusionDataList.value[i]; + // selectedfusionData.value.forEach((i) => { + // const d = fusionDataList.value[i]; - const mission = missionStore.missionList.find((v) => { - return v.missionCode == d.mixDataId; - }); + // const mission = missionStore.missionList.find((v) => { + // return v.missionCode == d.mixDataId; + // }); - if (factorDataMap.has(mission.missionCode)) { - const fd = factorDataMap.get(mission.missionCode); - drawLine(mission.missionCode, fd); - } else { - search(mission).then((res) => { - const fd = new FactorDatas(); - fd.setData(res.data, drawMode.value, () => { - fd.refreshHeight(factorType.value); - factorDataMap.set(mission.missionCode, fd); - drawLine(mission.missionCode, fd); - }); - }); - } + // if (factorDataMap.has(mission.missionCode)) { + // const fd = factorDataMap.get(mission.missionCode); + // drawLine(mission.missionCode, fd); + // } else { + // search(mission).then((res) => { + // const fd = new FactorDatas(); + // fd.setData(res.data, drawMode.value, () => { + // fd.refreshHeight(factorType.value); + // factorDataMap.set(mission.missionCode, fd); + // drawLine(mission.missionCode, fd); + // }); + // }); + // } + // }); + + const d = fusionDataList.value.find((v) => v.id == dataId); + const mission = missionStore.missionList.find((v) => { + return v.missionCode == d.mixDataId; }); + + if (factorDataMap.has(mission.missionCode)) { + const fd = factorDataMap.get(mission.missionCode); + drawLine(mission.missionCode, fd); + } else { + search(mission).then((res) => { + const fd = new FactorDatas(); + fd.setData(res.data, drawMode.value, () => { + fd.refreshHeight(factorType.value); + factorDataMap.set(mission.missionCode, fd); + drawLine(mission.missionCode, fd); + }); + }); + } } function drawLine(missionCode, fd) { -- Gitblit v1.9.3