Update index.vue
This commit is contained in:
parent
b723f2eaf1
commit
df4e46b43c
|
@ -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')
|
||||||
|
|
Loading…
Reference in New Issue