参航单位使用船侧数据,优化地图弹窗与统计数据交互逻辑。
This commit is contained in:
parent
378d1b8778
commit
621b368d38
|
|
@ -236,7 +236,7 @@ export async function showUnitReport(mapId, unit, coordinate, callbackOnClose =
|
||||||
}
|
}
|
||||||
|
|
||||||
const description = `
|
const description = `
|
||||||
<table class="popup-table" style="min-width:320px;">
|
<table class="popup-table" style="min-width:280px;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">单位参航信息</td>
|
<td colspan="2">单位参航信息</td>
|
||||||
|
|
@ -259,7 +259,7 @@ export async function showUnitReport(mapId, unit, coordinate, callbackOnClose =
|
||||||
</tr>
|
</tr>
|
||||||
</table>`;
|
</table>`;
|
||||||
|
|
||||||
showPopupDetails({ mapId, coordinate, description, maxWidth: "350px", callbackOnClose: callbackOnClose });
|
showPopupDetails({ mapId, coordinate, description, maxWidth: "300px", callbackOnClose: callbackOnClose });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function changeCursor(layerId, mapId = "homeMap", cursor = "pointer") {
|
export function changeCursor(layerId, mapId = "homeMap", cursor = "pointer") {
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,8 @@ export default {
|
||||||
selectedUnits: [],
|
selectedUnits: [],
|
||||||
/** unitTotal 全量缓存,便于按 Banner 选择做前端过滤 */
|
/** unitTotal 全量缓存,便于按 Banner 选择做前端过滤 */
|
||||||
unitTotalRawList: [],
|
unitTotalRawList: [],
|
||||||
|
// 全量单位列表,用于地图点选时绑定 Banner
|
||||||
|
totalUnits: [],
|
||||||
numbers: [
|
numbers: [
|
||||||
{
|
{
|
||||||
label: '参航单位数量',
|
label: '参航单位数量',
|
||||||
|
|
@ -143,8 +145,8 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
initMapbox('workUnitMap_uuv', {
|
initMapbox('workUnitMap_uuv', {
|
||||||
tileKey: 'gaode',
|
tileKey: 'gaode',
|
||||||
zoom: 3,
|
zoom: 2.8,
|
||||||
center: [110, 33],
|
center: [120, 31],
|
||||||
minZoom: 2,
|
minZoom: 2,
|
||||||
maxZoom: 29
|
maxZoom: 29
|
||||||
})
|
})
|
||||||
|
|
@ -184,6 +186,7 @@ export default {
|
||||||
const filtered = raw.filter(row => nameSet.has(row.unit_name))
|
const filtered = raw.filter(row => nameSet.has(row.unit_name))
|
||||||
this.applyUnitTotalRows(filtered)
|
this.applyUnitTotalRows(filtered)
|
||||||
|
|
||||||
|
console.log('applyFilteredUnitTotal', this.selectedUnits);
|
||||||
// 地图显示最后一个选中单位的相关信息
|
// 地图显示最后一个选中单位的相关信息
|
||||||
showUnitReport('workUnitMap_uuv', this.selectedUnits.at(-1).unit_name, [this.selectedUnits.at(-1).unit_lon, this.selectedUnits.at(-1).unit_lat])
|
showUnitReport('workUnitMap_uuv', this.selectedUnits.at(-1).unit_name, [this.selectedUnits.at(-1).unit_lon, this.selectedUnits.at(-1).unit_lat])
|
||||||
},
|
},
|
||||||
|
|
@ -299,12 +302,13 @@ export default {
|
||||||
*/
|
*/
|
||||||
getHovUnit() {
|
getHovUnit() {
|
||||||
hovUnit().then(res => {
|
hovUnit().then(res => {
|
||||||
const map = new Map()
|
// 参航单位不一定下潜
|
||||||
; (res.array || []).forEach(unit => {
|
// const map = new Map();
|
||||||
const k = unit.unit_id || unit.unitId || unit.unit_name
|
// (res.array || []).forEach(unit => {
|
||||||
if (!map.has(k)) map.set(k, unit)
|
// const k = unit.unit_id || unit.unitId || unit.unit_name
|
||||||
})
|
// if (!map.has(k)) map.set(k, unit)
|
||||||
this.unitOptions = Array.from(map.values())
|
// })
|
||||||
|
// this.unitOptions = Array.from(map.values());
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -314,11 +318,19 @@ export default {
|
||||||
*/
|
*/
|
||||||
getShipUnit() {
|
getShipUnit() {
|
||||||
shipUnit().then(res => {
|
shipUnit().then(res => {
|
||||||
|
this.totalUnits = res.array || [];
|
||||||
|
const map = new Map();
|
||||||
|
this.totalUnits.forEach(unit => {
|
||||||
|
const k = unit.unit_id || unit.unitId || unit.unit_name
|
||||||
|
if (!map.has(k)) map.set(k, unit)
|
||||||
|
})
|
||||||
|
this.unitOptions = Array.from(map.values())
|
||||||
|
|
||||||
const geojson = {
|
const geojson = {
|
||||||
type: 'FeatureCollection',
|
type: 'FeatureCollection',
|
||||||
features: []
|
features: []
|
||||||
};
|
};
|
||||||
(res.array || []).forEach(element => {
|
this.totalUnits.forEach(element => {
|
||||||
geojson.features.push({
|
geojson.features.push({
|
||||||
type: 'Feature',
|
type: 'Feature',
|
||||||
geometry: {
|
geometry: {
|
||||||
|
|
@ -338,6 +350,9 @@ export default {
|
||||||
Vue.config.maps['workUnitMap_uuv'].on('click', 'workUnit', async (e) => {
|
Vue.config.maps['workUnitMap_uuv'].on('click', 'workUnit', async (e) => {
|
||||||
if (!e.features || e.features.length <= 0)
|
if (!e.features || e.features.length <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// 绑定地图单击的单位与 Banner 选项,保持地图点选与 Banner 选项同步
|
||||||
|
this.selectedUnits = this.totalUnits.filter(u => u.unit_name === e.features[0].properties.unit_name);
|
||||||
// 地图点选弹窗显示单位信息
|
// 地图点选弹窗显示单位信息
|
||||||
showUnitReport('workUnitMap_uuv', e.features[0].properties.unit_name, e.features[0].geometry.coordinates, this.resetFilter);
|
showUnitReport('workUnitMap_uuv', e.features[0].properties.unit_name, e.features[0].geometry.coordinates, this.resetFilter);
|
||||||
// 同步更新单位统计图
|
// 同步更新单位统计图
|
||||||
|
|
@ -347,15 +362,9 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
resetFilter() {
|
resetFilter() {
|
||||||
const raw = this.unitTotalRawList || []
|
// 关闭地图弹窗后恢复全部单位统计显示
|
||||||
const sel = this.selectedUnits || []
|
this.selectedUnits = [];
|
||||||
if (!sel.length) {
|
this.applyUnitTotalRows(this.unitTotalRawList || []);
|
||||||
this.applyUnitTotalRows(raw)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const nameSet = new Set(sel.map(u => u && u.unit_name).filter(Boolean))
|
|
||||||
const filtered = raw.filter(row => nameSet.has(row.unit_name))
|
|
||||||
this.applyUnitTotalRows(filtered)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue