1.首页调整为显示最近的10个航次;

2.地图右上角增加小图标(船),鼠标滑动到图标上后显示这10个航次的列表;
3.点击:记录高亮、移除其他高亮图层、加载对应的航次高亮图层、,再次点击,取消航次记录高亮,移除该航次高亮突出;
4.Checkbox框:选中代表该航次图层显示在地图上,取消则隐藏该航次图层。默认10个航次全部选中;
5.增加4500米、6000米等深线按钮,点击触发:加载/取消对应的等深线图层
This commit is contained in:
zhangqi 2025-09-24 16:56:51 +08:00
parent a8a3ce85b5
commit a922d431bd
4 changed files with 244 additions and 96 deletions

View File

@ -5,6 +5,7 @@
const path = require('path')
module.exports = {
lintOnSave: false,
dev: {
// Paths
@ -26,7 +27,7 @@ module.exports = {
},
'/geoserver': {
// target: 'http://120.48.105.88', // 线上
target: 'http://124.16.219.154:8080', // 测试环境
target: 'http://124.222.8.13:9801', // 测试环境
changeOrigin: true, // 是否跨域
secure: false, // 是否使用https
pathRewrite: {

View File

@ -55,10 +55,11 @@ export function saveVisits(data) {
// }
// 航次列表
export function getVoyage() {
export function getVoyage(query) {
return request({
url: '/voyage/reg/page.htm',
method: 'get'
method: 'get',
params: query
})
}

View File

@ -63,30 +63,44 @@
<img src="../../static/images/guiji.png" alt="">
</div>
<div class="guiji_2">
<!-- <img src="../../static/images/guiji_1.jpg" alt="" /> -->
<div class="daohang">
<ul>
<li>
<a @click="onAll">All</a>
</li>
<li>
<a @click="clearAll">clear</a>
</li>
<li
v-for="(item, index) in voyageList"
:key="index"
:class="chooseIndex === index ? 'active' : ''"
@click="toChoose(item, index)"
>
<a>{{ item.voyage_name }}</a>
</li>
</ul>
</div>
<div id="cesiumContainer" ref="cesiumContainer"
onmouseleave="document.getElementById('mouseWheelTip').style.display = 'none'"
style="height: 100%;width:100%;">
<div class="son" style="display: none;">弹框插槽</div>
<div id="mouseWheelTip" style="display: none;">地图缩放按下 Ctrl + 鼠标滚轮</div>
<el-popover
placement="left-start"
title="航次列表"
width="300"
trigger="hover"
>
<div class="contour-line">
<span>等深线</span>
<el-button
size="mini"
v-for="depth in depthOptions"
:key="depth"
:type="selectedDepths.includes(depth) ? 'primary' : ''"
@click="toggleDepth(depth)"
>
{{ depth }}
</el-button>
</div>
<el-table
ref="multipleTable"
:data="voyageList"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
highlight-current-row
:current-row-key="currentVoyage"
>
<el-table-column type="selection" width="50" />
<el-table-column property="voyage_name" label="航次" />
</el-table>
<div class="right-top" slot="reference">
<img class="boat" src="../../static/images/boat_icon.png" alt="">
</div>
</el-popover>
</div>
</div>
</div>
@ -232,7 +246,7 @@
<script>
import Footer from '../components/public/Footer'
import { getVoyage, getVoyageLine, getParamsList, statisticsNums } from '../api/home'
import { getVoyage, statisticsNums } from '../api/home'
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import 'swiper/swiper-bundle.css'
import { sampleDatasetList, voyageRegList } from '@/api/dataTransfer'
@ -290,19 +304,21 @@ export default {
}
}
},
chooseIndex: -1,
voyageList: [],
voyageList: [], //
currentVoyage: null, //
highlightLayer: null, //
dataUpdateList: [],
sampleDataUpdateList: [],
viewer: null,
//
CesiumHostAddr: '',
CesiumHostAddr: `${window.location.protocol}//${window.location.hostname}:${window.location.port}/`,
//
imageryViewModels: [],
//
trackLineLayers: [],
//
rendered: []
multipleSelection: [], //
trackLayerMap: {}, // { voyage_name: layerInstance }
depthOptions: [4500, 6000], //
selectedDepths: [], //
contourLayerMap: {}, // key
}
},
@ -313,35 +329,26 @@ export default {
},
created() {
this.getVoyageList()
this.getParams()
this.getStatisticsNums()
this.dataUpdate()
this.sampleDataUpdate()
},
mounted() {
},
methods: {
//
getParams() {
getParamsList().then(res => {
const arr = res.array
if (arr.length) {
arr.forEach(item => {
if (item.param_name === 'CesiumHostAddr') {
// this.CesiumHostAddr = item.param_value
this.CesiumHostAddr = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/tiles/`
this.imageryViewModels = setImageryViewModels(this.CesiumHostAddr)
this.initCesium()
}
})
}
})
},
methods: {
//
getVoyageList() {
getVoyage().then(res => {
getVoyage({
start: 0,
limit: 10
}).then(res => {
this.voyageList = res.page.records
this.$nextTick(() => {
//
this.$refs.multipleTable.toggleAllSelection()
})
})
},
@ -421,60 +428,170 @@ export default {
}
)
this.viewer.imageryLayers.addImageryProvider(shipline)
// 6000线
const contour6000 = new Cesium.WebMapTileServiceImageryProvider(
{
url: this.CesiumHostAddr + 'geoserver/gwc/service/wmts/rest/ougp:contour6000/{TileMatrixSet}/{TileMatrixSet}:{TileMatrix}/{TileRow}/{TileCol}?format=image/png',
layer: 'ougp:contour6000',
},
//
handleRowClick(row, column, event) {
//
if (this.currentVoyage === row.voyage_name) {
this.clearHighlight();
return;
}
//
this.currentVoyage = row.voyage_name;
//
if (this.highlightLayer) {
this.viewer.imageryLayers.remove(this.highlightLayer);
this.highlightLayer = null;
}
//
this.addHighlightLayer(row.voyage_name);
},
//
addHighlightLayer(voyageName) {
const highlightLayer = new Cesium.WebMapTileServiceImageryProvider({
url: `${this.CesiumHostAddr}geoserver/gwc/service/wmts/rest/dsds:${voyageName}-highlight/{TileMatrixSet}/{TileMatrixSet}:{TileMatrix}/{TileRow}/{TileCol}?format=image/png`,
layer: `dsds:${voyageName}-highlight`,
style: 'default',
format: 'image/png',
tileMatrixSetID: 'EPSG:4326',
tilingScheme: new Cesium.GeographicTilingScheme()
}
)
this.viewer.imageryLayers.addImageryProvider(contour6000)
});
this.highlightLayer = this.viewer.imageryLayers.addImageryProvider(highlightLayer);
},
//
clearAll() {
this.chooseIndex = -1
if (this.trackLineLayers.length) {
this.trackLineLayers.forEach(line => {
this.viewer.imageryLayers.remove(line)
})
//
clearHighlight() {
//
if (this.highlightLayer) {
this.viewer.imageryLayers.remove(this.highlightLayer);
this.highlightLayer = null;
}
this.rendered = []
//
this.currentVoyage = null;
// El-Table
this.$refs.multipleTable.setCurrentRow(null);
},
//
onAll() {
if (this.voyageList.length) {
this.voyageList.forEach(ele => {
this.toChoose(ele, -1)
})
//
handleSelectionChange(val) {
//
const newVoyages = val.map(item => item.voyage_name);
const oldVoyages = this.multipleSelection.map(item => item.voyage_name);
//
const voyagesToAdd = newVoyages.filter(voyage => !oldVoyages.includes(voyage));
//
const voyagesToRemove = oldVoyages.filter(voyage => !newVoyages.includes(voyage));
//
voyagesToRemove.forEach(voyage => {
this.removeSingleLineImg(voyage);
});
//
voyagesToAdd.forEach(voyage => {
// val
const correspondingItem = val.find(item => item.voyage_name === voyage);
if (correspondingItem) {
this.addSingleLineImg(correspondingItem);
}
});
//
this.multipleSelection = val;
},
//
toChoose(item, index) {
this.chooseIndex = index
//
if (this.rendered.length) {
const isRendered = this.rendered.find(ele => ele === item.voyage_name)
if (isRendered) return
//
addSingleLineImg(item) {
const voyageName = item.voyage_name;
//
if (this.trackLayerMap[voyageName]) {
console.warn(`航次 ${voyageName} 的轨迹图层已存在`);
return;
}
//
const trackLine = new Cesium.WebMapTileServiceImageryProvider(
{
url: `${this.CesiumHostAddr}geoserver/gwc/service/wmts/rest/dsds:${item.voyage_name}/{TileMatrixSet}/{TileMatrixSet}:{TileMatrix}/{TileRow}/{TileCol}?format=image/png`,
layer: `dsds:${item.voyage_name}`,
//
const trackLine = new Cesium.WebMapTileServiceImageryProvider({
url: `${this.CesiumHostAddr}geoserver/gwc/service/wmts/rest/dsds:${voyageName}/{TileMatrixSet}/{TileMatrixSet}:{TileMatrix}/{TileRow}/{TileCol}?format=image/png`,
layer: `dsds:${voyageName}`,
style: 'default',
format: 'image/png',
tileMatrixSetID: 'EPSG:4326',
tilingScheme: new Cesium.GeographicTilingScheme()
});
// Cesium
const layerInstance = this.viewer.imageryLayers.addImageryProvider(trackLine);
this.trackLayerMap[voyageName] = layerInstance; //
},
//
removeSingleLineImg(voyageName) {
const layerInstance = this.trackLayerMap[voyageName];
if (layerInstance) {
// CesiumimageryLayers
this.viewer.imageryLayers.remove(layerInstance);
//
delete this.trackLayerMap[voyageName];
} else {
console.warn(`未找到航次 ${voyageName} 的轨迹图层`);
}
},
toggleDepth(depth) {
// **1: **
// this.selectedDepths = [depth]; //
// **2: **
const index = this.selectedDepths.indexOf(depth);
if (index > -1) {
this.selectedDepths.splice(index, 1); //
this.removeSingleContourLine(depth); // 线
} else {
this.selectedDepths.push(depth); //
this.addSingleContourLine(depth); // 线
}
},
// 线
addSingleContourLine(deep) {
//
if (this.contourLayerMap[deep]) {
//
console.warn(`等深线 ${deep} 米图层已存在`);
return;
}
const contour = new Cesium.WebMapTileServiceImageryProvider({
url: `${this.CesiumHostAddr}geoserver/gwc/service/wmts/rest/ougp:contour${deep}/{TileMatrixSet}/{TileMatrixSet}:{TileMatrix}/{TileRow}/{TileCol}?format=image/png`,
layer: `ougp:contour${deep}`,
style: 'default',
format: 'image/png',
tileMatrixSetID: 'EPSG:4326',
tilingScheme: new Cesium.GeographicTilingScheme()
});
//
const layerInstance = this.viewer.imageryLayers.addImageryProvider(contour);
this.contourLayerMap[deep] = layerInstance; //
},
// 线
removeSingleContourLine(deep) {
//
const layerInstance = this.contourLayerMap[deep];
if (layerInstance) {
// CesiumimageryLayers
this.viewer.imageryLayers.remove(layerInstance);
//
delete this.contourLayerMap[deep];
} else {
console.warn(`未找到 ${deep} 米等深线图层`);
}
)
const trackLineLayer = this.viewer.imageryLayers.addImageryProvider(trackLine)
this.trackLineLayers.push(trackLineLayer)
//
this.rendered.push(item.voyage_name)
},
//
getStatisticsNums() {
@ -1289,6 +1406,23 @@ export default {
position: relative;
}
.right-top {
width: 30px;
height: 30px;
position: absolute;
right: 20px;
top: 20px;
z-index: 1000;
background-color: rgba(0, 0, 0, 0.7);
border-radius: 50%;
cursor: pointer;
padding: 8px;
}
.boat {
border-radius: 50%;
}
.text-ellipsis--3-lines {
/* 限制显示的行数 */
-webkit-line-clamp: 3;
@ -1301,4 +1435,16 @@ export default {
/* 文本溢出时显示省略号 */
text-overflow: ellipsis;
}
/* 增强当前行高亮效果 */
.el-table__body tr.current-row>td {
background-color: #ecf5ff !important;
color: #409eff;
}
/* 鼠标悬停效果 */
.el-table__body tr:hover>td {
background-color: #f5f7fa !important;
cursor: pointer;
}
</style>

BIN
static/images/boat_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB