调整媒体地图

This commit is contained in:
wangchengming 2025-09-24 21:01:04 +08:00
parent ed62b825cf
commit 3a56ef92d2
2 changed files with 216 additions and 99 deletions

View File

@ -4,6 +4,10 @@
<div class="more-search-pane"> <div class="more-search-pane">
<div class="search-where-container"> <div class="search-where-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" class="searchPanelForm"> <el-form :model="queryParams" ref="queryRef" :inline="true" class="searchPanelForm">
<el-form-item label="媒体名称/编号:">
<el-input v-model="queryParams.keyword" placeholder="请输入媒体名称/编号" clearable
style="min-width: 30px" />
</el-form-item>
<el-form-item label="媒体类型:"> <el-form-item label="媒体类型:">
<el-select v-model="queryParams.mediaType" placeholder="请选择" @change="getMediaTypeTwo" <el-select v-model="queryParams.mediaType" placeholder="请选择" @change="getMediaTypeTwo"
clearable style="min-width: 30px"> clearable style="min-width: 30px">
@ -27,8 +31,43 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class="search-more-button">
<el-button v-if="!unfoldFlag" text class="foladText" @click="handleFlod">展开
<svg-icon icon-class="unfold" class="ml10" />
</el-button>
<el-button v-else text class="foladText" @click="handleFlod">收起
<svg-icon icon-class="packUp" class="ml10" />
</el-button>
</div> </div>
</div> </div>
</div>
<div class="searchSmallPanel" v-show="unfoldFlag">
<el-form :model="queryParams" ref="queryRef" :inline="true" class="searchSmallPanelForm">
<el-form-item label="城市:">
<el-select v-model="queryParams.provinceCode" placeholder="请选择" @change="getCityList" clearable
style="min-width: 30px">
<el-option v-for="item in province" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="">
<el-select v-model="queryParams.cityCode" placeholder="请选择" @change="getCountyList" clearable
style="min-width: 30px">
<el-option v-for="item in city" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="">
<el-select v-model="queryParams.areaCode" placeholder="请选择" @change="getTownList" clearable
style="min-width: 30px">
<el-option v-for="item in county" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="">
<el-select v-model="queryParams.townCode" placeholder="请选择" clearable style="min-width: 30px">
<el-option v-for="item in town" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
</el-form>
</div>
<div class="choseResultPanel"> <div class="choseResultPanel">
<el-form :inline="true" class="searchSmallPanelForm"> <el-form :inline="true" class="searchSmallPanelForm">
<el-form-item label="已选媒体:"> <el-form-item label="已选媒体:">
@ -44,20 +83,24 @@
</div> </div>
<el-card class="mediaCard"> <el-card class="mediaCard">
<el-row :gutter="10" class="my_row" style="padding: 0 20px;"> <el-row :gutter="10" class="my_row" style="padding: 0 20px;">
<el-col :span="12"> <el-col :span="8">
<el-form :model="queryParams" ref="queryRef" :inline="true" class="searchInputForm"> <el-form :model="queryParams" ref="queryRef" :inline="true" class="searchInputForm">
<el-form-item label="" prop="templateName"> <el-form-item label="" prop="templateName">
<el-select class="filterSelect" v-model="centerPointName" filterable remote reserve-keyword <el-select class="filterSelect" v-model="centerPointName" filterable remote reserve-keyword
:remote-method="getLocaleListList" :loading="selectLoading" @change="currentSelect" :remote-method="getLocaleListList" :loading="selectLoading" @change="currentSelect"
placeholder="请输入媒体名称/媒体编号/关键字" remote-show-suffix clearable style="width: 400px"> placeholder="请输入内容以设置热区" remote-show-suffix clearable style="width: 400px">
<el-option v-for="item in localeList" :key="item.mediaId" :label="item.mediaName" <el-option v-for="item in localeList" :key="item.id" :label="item.name" :value="item"
:value="item.mediaId" class="one-text"> class="one-text">
<div style="height: 24px; line-height: 24px;font-size: 16px;">{{ item.name }}</div>
<div style="color: #8492a6; font-size: 12px;height: 18px; line-height: 18px;">{{
item.address
}}</div>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-col> </el-col>
<el-col :span="12" style="text-align: right;"> <el-col :span="16" style="text-align: right;">
<el-dropdown placement="bottom-start"> <el-dropdown placement="bottom-start">
<el-button type="primary" class="mediaMapBtn">距离{{ distanceLable }}</el-button> <el-button type="primary" class="mediaMapBtn">距离{{ distanceLable }}</el-button>
<template #dropdown> <template #dropdown>
@ -70,8 +113,7 @@
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
<div class="clearBtn" @click="resetQuery">清除条件</div> <el-dropdown placement="bottom-start" style="margin-left: 12px;">
<el-dropdown placement="bottom-start" style="margin: 0 12px;">
<el-button type="primary" class="mediaMapExportBtn"> <el-button type="primary" class="mediaMapExportBtn">
导出PPT 导出PPT
</el-button> </el-button>
@ -86,10 +128,14 @@
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
<el-button type="primary" class="searchMapBtn" @click="handleQuery">查询</el-button>
<div class="clearBtn" @click="resetQuery">清除条件</div>
</el-col> </el-col>
</el-row> </el-row>
<div id="mapContainer" class="mediaMapContainer"> <div id="mapContainer" :class="unfoldFlag ? 'mediaMapContainerSmall' : 'mediaMapContainerLarge'">
</div> </div>
<div v-if="contextMenuVisible" class="custom-context-menu" :style="menuPosition" @click="handleChoseMedia"> <div v-if="contextMenuVisible" class="custom-context-menu" :style="menuPosition" @click="handleChoseMedia">
选择媒体 选择媒体
@ -225,6 +271,7 @@ import {
} from '@element-plus/icons-vue' } from '@element-plus/icons-vue'
import AMapLoader from "@amap/amap-jsapi-loader"; // import AMapLoader from "@amap/amap-jsapi-loader"; //
import { sysMediaTypeListByPid } from "@/api/system/mediaType" import { sysMediaTypeListByPid } from "@/api/system/mediaType"
import { sysRegionListByPid } from "@/api/system/administrativeRegion"
import { useBackgroundStore } from '@/store/modules/background' import { useBackgroundStore } from '@/store/modules/background'
import otherbg from '@/assets/images/otherbg.png' import otherbg from '@/assets/images/otherbg.png'
import dragTool from '@/assets/images/dragTool.png' import dragTool from '@/assets/images/dragTool.png'
@ -238,6 +285,11 @@ const bgStore = useBackgroundStore()
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const { apiKey, secretKey } = window._CONFIG const { apiKey, secretKey } = window._CONFIG
//
const province = ref([])
const city = ref([])
const county = ref([])
const town = ref([])
// ppt // ppt
const templateList = ref([]) const templateList = ref([])
const exportPPTDialogRef = ref(null) const exportPPTDialogRef = ref(null)
@ -248,7 +300,8 @@ const mediaTypeTwo = ref([])
const mediaTypeThree = ref([]) const mediaTypeThree = ref([])
// //
const multipleChoseArr = ref([]) const multipleChoseArr = ref([])
//
const unfoldFlag = ref(false)
const open = ref(false) const open = ref(false)
const detailForm = ref({}) const detailForm = ref({})
const fileList = ref([]) const fileList = ref([])
@ -290,6 +343,12 @@ const distanceLableArray = ref([
]) ])
const points = ref([]) const points = ref([])
//
let minLng = Infinity; // 西
let minLat = Infinity; //
let maxLng = -Infinity; //
let maxLat = -Infinity; //
// //
const contextMenuVisible = ref(false); const contextMenuVisible = ref(false);
const menuPosition = ref({ const menuPosition = ref({
@ -301,12 +360,13 @@ const curMediaInfo = ref(null)
const data = reactive({ const data = reactive({
queryParams: { queryParams: {
keyword: undefined, // keyword: undefined, //
x: undefined, //
y: undefined, //
distance: undefined,
mediaType: undefined, mediaType: undefined,
mediaCategory: undefined, mediaCategory: undefined,
displayForm: undefined displayForm: undefined,
provinceCode: undefined,
cityCode: undefined,
areaCode: undefined,
townCode: undefined,
} }
}) })
const { queryParams } = toRefs(data) const { queryParams } = toRefs(data)
@ -315,12 +375,13 @@ const { queryParams } = toRefs(data)
const resetQuery = () => { const resetQuery = () => {
queryParams.value = { queryParams.value = {
keyword: undefined, // keyword: undefined, //
x: undefined, //
y: undefined, //
distance: undefined,
mediaType: undefined, mediaType: undefined,
mediaCategory: undefined, mediaCategory: undefined,
displayForm: undefined displayForm: undefined,
provinceCode: undefined,
cityCode: undefined,
areaCode: undefined,
townCode: undefined,
} }
// //
distanceLable.value = '请选择' distanceLable.value = '请选择'
@ -343,8 +404,13 @@ const resetQuery = () => {
circleHandle.value = null; circleHandle.value = null;
} }
// //
renderMassMarks() handleQuery()
}
//
const handleQuery = () => {
getMediaList()
} }
// //
@ -366,28 +432,18 @@ const handleViewMedia = (_mediaId) => {
const getLocaleListList = (searchValue) => { const getLocaleListList = (searchValue) => {
selectLoading.value = true selectLoading.value = true
if (searchValue !== "") { if (searchValue !== "") {
queryParams.value.keyword = searchValue placeSearch.value.search(searchValue, function (status, result) {
mediaByMap(queryParams.value).then(res => { // resultPOI
if (res.code == 200) { if (result.poiList.pois?.length) {
localeList.value = res.data.length > 0 ? res.data : [] localeList.value = result.poiList?.pois
selectLoading.value = false
} }
}) selectLoading.value = false
});
// placeSearch.value.search(searchValue, function (status, result) {
// // resultPOI
// if (result.poiList.pois?.length) {
// localeList.value = result.poiList?.pois
// }
// selectLoading.value = false
// });
} }
} }
// //
const currentSelect = (val) => { const currentSelect = (val) => {
const chosedMedia = localeList.value.filter(item => item.mediaId == val)[0] centerPointName.value = val.name
if (chosedMedia) {
centerPointName.value = chosedMedia.mediaName
// //
distanceLable.value = circleRadius.value == 1000 ? '1000米' : circleRadius.value + '米' distanceLable.value = circleRadius.value == 1000 ? '1000米' : circleRadius.value + '米'
@ -404,31 +460,28 @@ const currentSelect = (val) => {
circleHandle.value = null; circleHandle.value = null;
} }
// addCenterMark(chosedMedia) addCenterMark(val)
createCircle(chosedMedia) createCircle(val)
} }
//
const addCenterMark = (val) => {
if (centerMarker.value) mapInstance.value.remove(centerMarker.value);
centerMarker.value = new AMap.Marker({
position: [val.location.lng, val.location.lat],
title: val.name,
zIndex: 100,
draggable: false, //
cursor: 'move'
});
//
mapInstance.value.add(centerMarker.value);
mapInstance.value.setFitView(centerMarker.value);
} }
// //
// const addCenterMark = (val) => {
// if (centerMarker.value) mapInstance.value.remove(centerMarker.value);
// centerMarker.value = new AMap.Marker({
// position: [val.x, val.y],
// title: val.mediaName,
// zIndex: 100,
// draggable: false, //
// cursor: 'move'
// });
// //
// mapInstance.value.add(centerMarker.value);
// mapInstance.value.setFitView(centerMarker.value);
// }
// //
const createCircle = (val) => { const createCircle = (val) => {
// //
circle.value = new AMap.Circle({ circle.value = new AMap.Circle({
center: [val.x, val.y], center: [val.location.lng, val.location.lat],
radius: circleRadius.value, radius: circleRadius.value,
strokeColor: '#4e54c8', strokeColor: '#4e54c8',
strokeOpacity: 0.8, strokeOpacity: 0.8,
@ -528,7 +581,6 @@ const calculateDistance = (point1, point2) => {
// //
const handleChangeDistance = (itemDistance) => { const handleChangeDistance = (itemDistance) => {
queryParams.value.distance = itemDistance.value
activeLableIndex.value = itemDistance.value activeLableIndex.value = itemDistance.value
distanceLable.value = itemDistance.value + '米' distanceLable.value = itemDistance.value + '米'
// //
@ -587,7 +639,8 @@ const loadMap = () => {
hideContextMenu() hideContextMenu()
}); });
// //
renderMassMarks(); // renderMassMarks();
getMediaList()
resolve(); resolve();
@ -896,31 +949,8 @@ const renderMassMarks = () => {
size: new AMap.Size(18, 18) size: new AMap.Size(18, 18)
}, },
]; ];
// MassMarks
// if (points.value.length > 0 && mapInstance.value) {
let minLng = Infinity; // 西
let minLat = Infinity; //
let maxLng = -Infinity; //
let maxLat = -Infinity; //
//
points.value = []
mediaByMap(queryParams.value).then(res => {
if (res.code == 200) {
res.data.forEach(itemPoint => {
if (itemPoint.dataScopeDeptId == 220) points.value.push({ "lnglat": [itemPoint.x, itemPoint.y], "mediaId": itemPoint.mediaId, 'mediaName': itemPoint.mediaName, "style": 0 })
else if (itemPoint.dataScopeDeptId == 219) points.value.push({ "lnglat": [itemPoint.x, itemPoint.y], "mediaId": itemPoint.mediaId, 'mediaName': itemPoint.mediaName, "style": 1 })
//
const lng = itemPoint.x;
const lat = itemPoint.y;
if (lng < minLng) minLng = lng;
if (lat < minLat) minLat = lat;
if (lng > maxLng) maxLng = lng;
if (lat > maxLat) maxLat = lat;
});
}
}).then(res => {
// MassMarks // MassMarks
massMarks.value = new AMap.MassMarks(points.value, { massMarks.value = new AMap.MassMarks(points.value, {
opacity: 1, opacity: 1,
@ -954,7 +984,7 @@ const renderMassMarks = () => {
// //
mapInstance.value.setBounds(bounds); mapInstance.value.setBounds(bounds);
}) }
} }
const showContextMenu = (pixel) => { const showContextMenu = (pixel) => {
// //
@ -1019,6 +1049,36 @@ const getMediaTypeThree = (value) => {
mediaTypeThree.value = res.data mediaTypeThree.value = res.data
}) })
} }
// /
const getProvinceList = () => {
sysRegionListByPid({ parentId: '0' }).then(res => {
province.value = res.data
})
}
// /
const getCityList = (value) => {
sysRegionListByPid({ parentId: value }).then(res => {
queryParams.value.cityId = undefined
queryParams.value.countyId = undefined
queryParams.value.townId = undefined
city.value = res.data
})
}
// /
const getCountyList = (value) => {
sysRegionListByPid({ parentId: value }).then(res => {
queryParams.value.countyId = undefined
queryParams.value.townId = undefined
county.value = res.data
})
}
//
const getTownList = (value) => {
sysRegionListByPid({ parentId: value }).then(res => {
queryParams.value.townId = undefined
town.value = res.data
})
}
// //
const handleChoseMedia = () => { const handleChoseMedia = () => {
hideContextMenu() hideContextMenu()
@ -1027,11 +1087,42 @@ const handleChoseMedia = () => {
if (rowIndex == -1) multipleChoseArr.value.push({ id: curMediaInfo.value.mediaId, mediaName: curMediaInfo.value.mediaName }) if (rowIndex == -1) multipleChoseArr.value.push({ id: curMediaInfo.value.mediaId, mediaName: curMediaInfo.value.mediaName })
} }
} }
//
const handleFlod = () => {
unfoldFlag.value = !unfoldFlag.value
//
loadMap()
}
// //
const handleCloseTag = (tag) => { const handleCloseTag = (tag) => {
const rowIndex = multipleChoseArr.value.findIndex(item => item.id == tag.id) const rowIndex = multipleChoseArr.value.findIndex(item => item.id == tag.id)
multipleChoseArr.value.splice(rowIndex, 1) multipleChoseArr.value.splice(rowIndex, 1)
} }
//
const getMediaList = () => {
points.value = []
mediaByMap(queryParams.value).then(res => {
if (res.code == 200) {
res.data.forEach(itemPoint => {
if (itemPoint.dataScopeDeptId == 220) points.value.push({ "lnglat": [itemPoint.x, itemPoint.y], "mediaId": itemPoint.mediaId, 'mediaName': itemPoint.mediaName, "style": 0 })
else if (itemPoint.dataScopeDeptId == 219) points.value.push({ "lnglat": [itemPoint.x, itemPoint.y], "mediaId": itemPoint.mediaId, 'mediaName': itemPoint.mediaName, "style": 1 })
//
const lng = itemPoint.x;
const lat = itemPoint.y;
if (lng < minLng) minLng = lng;
if (lat < minLat) minLat = lat;
if (lng > maxLng) maxLng = lng;
if (lat > maxLat) maxLat = lat;
});
}
}).then(res => {
//
renderMassMarks();
})
}
onUnmounted(() => { onUnmounted(() => {
stopActiveTool() stopActiveTool()
if (mapInstance.value) { if (mapInstance.value) {
@ -1042,6 +1133,7 @@ onUnmounted(() => {
onMounted(() => { onMounted(() => {
bgStore.setBgImage(otherbg) bgStore.setBgImage(otherbg)
getMediaTypeOne() getMediaTypeOne()
getProvinceList()
getpptTemplatePageList() getpptTemplatePageList()
loadMap() loadMap()
}); });
@ -1075,6 +1167,19 @@ onMounted(() => {
background: #1a75e6; background: #1a75e6;
} }
.searchMapBtn {
height: 34px;
border-radius: 4px;
background: #1a75e6;
font-family: Microsoft YaHei;
font-weight: 400;
font-size: 16px;
text-align: left;
color: #FFFFFF;
padding: 10px;
margin-left: 12px;
margin-top: -4px;
}
.mediaMapExportBtn { .mediaMapExportBtn {
// min-width: 122px; // min-width: 122px;
@ -1163,12 +1268,19 @@ onMounted(() => {
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.mediaMapContainer { .mediaMapContainerLarge {
width: 100%; width: 100%;
height: calc(100vh - 256px); height: calc(100vh - 256px);
background: #3f8bff; background: #3f8bff;
} }
.mediaMapContainerSmall {
width: 100%;
height: calc(100vh - 290px);
background: #3f8bff;
}
.custom-map-controls { .custom-map-controls {
position: absolute; position: absolute;
top: 5px; top: 5px;
@ -1317,6 +1429,11 @@ onMounted(() => {
height: 100% !important; height: 100% !important;
} }
.one-text {
height: 50px;
padding-top: 4px;
}
// 线 // 线
.splineBar { .splineBar {
width: 100%; width: 100%;

View File

@ -845,12 +845,12 @@ onUnmounted(() => {
// //
onMounted(() => { onMounted(() => {
bgStore.setBgImage(otherbg) bgStore.setBgImage(otherbg)
loadMap()
// id // id
getpptTemplatePageList() getpptTemplatePageList()
getOutMediaPageList() getOutMediaPageList()
getMediaTypeOne() getMediaTypeOne()
getProvinceList() getProvinceList()
loadMap()
}); });
</script> </script>