Update index.vue
This commit is contained in:
parent
b723f2eaf1
commit
df4e46b43c
|
@ -600,7 +600,7 @@ const scrollToMatchedNode = (searchValue: string) => {
|
|||
})
|
||||
}
|
||||
const treedataall = ref([])
|
||||
const searchValue = ref('') //搜索
|
||||
|
||||
const treeRef = ref() // 创建一个 ref 用来引用 a-tree 组件
|
||||
// checkKeyExists___验证 key 方法
|
||||
const checkKeyExists = (nodes: any, key: string): boolean => {
|
||||
|
@ -636,6 +636,7 @@ const gettree4 = (data: any) => {
|
|||
printLeafs(tree, res1.data)
|
||||
})
|
||||
treedataall.value = [...data]
|
||||
console.log('🚀 ~ .then ~ treedataall.value:', treedataall.value)
|
||||
options.value = [...data]
|
||||
loading.value = false
|
||||
})
|
||||
|
@ -749,6 +750,11 @@ var _renderClusterMarker = function (context: any) {
|
|||
|
||||
var _renderMarker = function (context: any) {
|
||||
// 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)
|
||||
context.marker.setIcon(
|
||||
new AMap.Icon({
|
||||
|
@ -757,9 +763,10 @@ var _renderMarker = function (context: any) {
|
|||
imageSize: new AMap.Size(30, 30)
|
||||
})
|
||||
)
|
||||
|
||||
context.marker.setOffset(offset)
|
||||
context.marker.on('click', function () {
|
||||
// console.log('context.marker.on')
|
||||
console.log('context.marker.on', context)
|
||||
deviceInfoWindow.value = new AMap.InfoWindow({
|
||||
isCustom: true,
|
||||
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)
|
||||
})
|
||||
}
|
||||
|
||||
const createCluster = () => {
|
||||
// cluster = null
|
||||
if (cluster) cluster.setMap(null) // 避免重复创建
|
||||
|
@ -775,6 +783,7 @@ const createCluster = () => {
|
|||
cluster = new AMap.MarkerCluster(state.map, points, {
|
||||
gridSize: 80,
|
||||
maxZoom: 12,
|
||||
averageCenter: true,
|
||||
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式
|
||||
renderMarker: _renderMarker // 自定义非聚合点样式
|
||||
})
|
||||
|
@ -799,7 +808,7 @@ const treedata = () => {
|
|||
return {lnglat: [x.longitude == null ? 0 : x.longitude, x.latitude == null ? 0 : x.latitude], x: x}
|
||||
})
|
||||
count = points.length
|
||||
// console.log('points___________________________', points)
|
||||
console.log('points___________________________', points)
|
||||
createCluster() // 初始化聚合点
|
||||
// 在点击聚合点时创建Marker
|
||||
cluster.on('click', function (e: any) {
|
||||
|
@ -966,9 +975,9 @@ const gettotal = () => {
|
|||
//
|
||||
let deviceInfoWindow = ref<any>()
|
||||
const selectA = (selectedKeys: any, e: any) => {
|
||||
console.log('selectedKeys', selectedKeys, e)
|
||||
console.log('selectedKeys___________________________', selectedKeys, 'e______________________', e)
|
||||
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({
|
||||
isCustom: true, //使用自定义窗体
|
||||
|
@ -1068,6 +1077,7 @@ const createSubstanceInfowindow2 = (obj: any, type: any) => {
|
|||
closeX.src = closeimag
|
||||
closeX.onclick = () => {
|
||||
deviceInfoWindow.value.close()
|
||||
selectedKeys.value = [] // 取消树选中状态 (受控)设置选中的树节点
|
||||
}
|
||||
|
||||
var popMian = document.createElement('div')
|
||||
|
|
Loading…
Reference in New Issue