Update index.vue

This commit is contained in:
TimSpan 2024-12-27 15:14:10 +08:00
parent b723f2eaf1
commit df4e46b43c
1 changed files with 15 additions and 5 deletions

View File

@ -600,7 +600,7 @@ const scrollToMatchedNode = (searchValue: string) => {
}) })
} }
const treedataall = ref([]) const treedataall = ref([])
const searchValue = ref('') //
const treeRef = ref() // ref a-tree const treeRef = ref() // ref a-tree
// checkKeyExists___ key // checkKeyExists___ key
const checkKeyExists = (nodes: any, key: string): boolean => { const checkKeyExists = (nodes: any, key: string): boolean => {
@ -636,6 +636,7 @@ const gettree4 = (data: any) => {
printLeafs(tree, res1.data) printLeafs(tree, res1.data)
}) })
treedataall.value = [...data] treedataall.value = [...data]
console.log('🚀 ~ .then ~ treedataall.value:', treedataall.value)
options.value = [...data] options.value = [...data]
loading.value = false loading.value = false
}) })
@ -749,6 +750,11 @@ var _renderClusterMarker = function (context: any) {
var _renderMarker = function (context: any) { var _renderMarker = function (context: any) {
// console.log('🚀 ~ context:', context) // console.log('🚀 ~ context:', context)
// var offsetX = (Math.random() - 0.5) * 30
// var offsetY = (Math.random() - 0.5) * 30
// var offsetX = (Math.random() - 0.5) * 10
// var offsetY = (Math.random() - 0.5) * 10
// var offset = new AMap.Pixel(offsetX, offsetY) //
var offset = new AMap.Pixel(-9, -9) var offset = new AMap.Pixel(-9, -9)
context.marker.setIcon( context.marker.setIcon(
new AMap.Icon({ new AMap.Icon({
@ -757,9 +763,10 @@ var _renderMarker = function (context: any) {
imageSize: new AMap.Size(30, 30) imageSize: new AMap.Size(30, 30)
}) })
) )
context.marker.setOffset(offset) context.marker.setOffset(offset)
context.marker.on('click', function () { context.marker.on('click', function () {
// console.log('context.marker.on') console.log('context.marker.on', context)
deviceInfoWindow.value = new AMap.InfoWindow({ deviceInfoWindow.value = new AMap.InfoWindow({
isCustom: true, isCustom: true,
content: createSubstanceInfowindow2(context.data[0].x, '1'), content: createSubstanceInfowindow2(context.data[0].x, '1'),
@ -768,6 +775,7 @@ var _renderMarker = function (context: any) {
deviceInfoWindow.value.open(state.map, context.data[0].lnglat) deviceInfoWindow.value.open(state.map, context.data[0].lnglat)
}) })
} }
const createCluster = () => { const createCluster = () => {
// cluster = null // cluster = null
if (cluster) cluster.setMap(null) // if (cluster) cluster.setMap(null) //
@ -775,6 +783,7 @@ const createCluster = () => {
cluster = new AMap.MarkerCluster(state.map, points, { cluster = new AMap.MarkerCluster(state.map, points, {
gridSize: 80, gridSize: 80,
maxZoom: 12, maxZoom: 12,
averageCenter: true,
renderClusterMarker: _renderClusterMarker, // renderClusterMarker: _renderClusterMarker, //
renderMarker: _renderMarker // renderMarker: _renderMarker //
}) })
@ -799,7 +808,7 @@ const treedata = () => {
return {lnglat: [x.longitude == null ? 0 : x.longitude, x.latitude == null ? 0 : x.latitude], x: x} return {lnglat: [x.longitude == null ? 0 : x.longitude, x.latitude == null ? 0 : x.latitude], x: x}
}) })
count = points.length count = points.length
// console.log('points___________________________', points) console.log('points___________________________', points)
createCluster() // createCluster() //
// Marker // Marker
cluster.on('click', function (e: any) { cluster.on('click', function (e: any) {
@ -966,9 +975,9 @@ const gettotal = () => {
// //
let deviceInfoWindow = ref<any>() let deviceInfoWindow = ref<any>()
const selectA = (selectedKeys: any, e: any) => { const selectA = (selectedKeys: any, e: any) => {
console.log('selectedKeys', selectedKeys, e) console.log('selectedKeys___________________________', selectedKeys, 'e______________________', e)
if (selectedKeys[0].length >= 13) { if (selectedKeys[0].length >= 13) {
// let targetLangLat = [e.selectedNodes[0].longitude == null ? 0 : e.selectedNodes[0].longitude, e.selectedNodes[0].latitude == null ? 0 : e.selectedNodes[0].latitude] let targetLangLat = [e.selectedNodes[0].longitude == null ? 0 : e.selectedNodes[0].longitude, e.selectedNodes[0].latitude == null ? 0 : e.selectedNodes[0].latitude]
deviceInfoWindow.value = new AMap.InfoWindow({ deviceInfoWindow.value = new AMap.InfoWindow({
isCustom: true, //使 isCustom: true, //使
@ -1068,6 +1077,7 @@ const createSubstanceInfowindow2 = (obj: any, type: any) => {
closeX.src = closeimag closeX.src = closeimag
closeX.onclick = () => { closeX.onclick = () => {
deviceInfoWindow.value.close() deviceInfoWindow.value.close()
selectedKeys.value = [] //
} }
var popMian = document.createElement('div') var popMian = document.createElement('div')