Commit debf998af863ac4b4add940328f180ffabf29365

Authored by fengwotao
1 parent 7bd5af76

feat(src/packages): 优化高德地图标点弹窗和数据展示

1 { 1 {
2 "markers": [ 2 "markers": [
3 { 3 {
4 - "name": "模拟11111111111", 4 + "name": "模拟数据1",
5 "value": 20, 5 "value": 20,
6 "position": [103.856504, 30.687278], 6 "position": [103.856504, 30.687278],
7 "extraInfo": { 7 "extraInfo": {
8 "tbDeviceId": "@xxxxxxxxxxx", 8 "tbDeviceId": "@xxxxxxxxxxx",
9 - "name": "模拟11111111111",  
10 - "alias": "模拟11111111111", 9 + "name": "模拟数据1",
  10 + "alias": "模拟数据1",
11 "organizationDTO": { 11 "organizationDTO": {
12 - "name": "模拟11111111111" 12 + "name": "模拟数据1"
13 }, 13 },
14 "deviceState": "INACTIVE", 14 "deviceState": "INACTIVE",
15 "deviceProfile": { 15 "deviceProfile": {
@@ -23,15 +23,15 @@ @@ -23,15 +23,15 @@
23 } 23 }
24 }, 24 },
25 { 25 {
26 - "name": "模拟22222222222", 26 + "name": "模拟数据2",
27 "value": 30, 27 "value": 30,
28 "position": [104.095368, 30.716787], 28 "position": [104.095368, 30.716787],
29 "extraInfo": { 29 "extraInfo": {
30 "tbDeviceId": "@xxxxxxxxxxxxxxx", 30 "tbDeviceId": "@xxxxxxxxxxxxxxx",
31 - "name": "模拟22222222222",  
32 - "alias": "模拟22222222222", 31 + "name": "模拟数据2",
  32 + "alias": "模拟数据2",
33 "organizationDTO": { 33 "organizationDTO": {
34 - "name": "模拟22222222222" 34 + "name": "模拟数据2"
35 }, 35 },
36 "deviceState": "INACTIVE", 36 "deviceState": "INACTIVE",
37 "deviceProfile": { 37 "deviceProfile": {
@@ -11,7 +11,7 @@ import AMapLoader from '@amap/amap-jsapi-loader' @@ -11,7 +11,7 @@ import AMapLoader from '@amap/amap-jsapi-loader'
11 import { CreateComponentType } from '@/packages/index.d' 11 import { CreateComponentType } from '@/packages/index.d'
12 import { useChartDataFetch } from '@/hooks' 12 import { useChartDataFetch } from '@/hooks'
13 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' 13 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
14 -import { MarkerEnum, ThemeEnum, dataExtraInfoType, dataJsonType, dataJsonMarkersType, fileterDevice } from './config' 14 +import { MarkerEnum, ThemeEnum, dataExtraInfoType, dataJsonType, dataJsonMarkersType, filterDevice } from './config'
15 import { isArray } from '@/utils' 15 import { isArray } from '@/utils'
16 import djh from './images/djh.png' 16 import djh from './images/djh.png'
17 import online from './images/online.png' 17 import online from './images/online.png'
@@ -145,7 +145,7 @@ const handleCloseDrawer = () => (modelShow.value = false) @@ -145,7 +145,7 @@ const handleCloseDrawer = () => (modelShow.value = false)
145 const handleSearchParams = async (searchPage: any, params: any) => { 145 const handleSearchParams = async (searchPage: any, params: any) => {
146 try { 146 try {
147 const { items } = await getDeviceList(searchPage, params) 147 const { items } = await getDeviceList(searchPage, params)
148 - const values = fileterDevice(items) 148 + const values = filterDevice(items)
149 if (!values) return 149 if (!values) return
150 dataHandle(values) 150 dataHandle(values)
151 } finally { 151 } finally {
@@ -163,6 +163,7 @@ const mapClick = (markerInstance: any, markerItem: dataJsonMarkersType) => { @@ -163,6 +163,7 @@ const mapClick = (markerInstance: any, markerItem: dataJsonMarkersType) => {
163 }) 163 })
164 markerInstance.on('click', async (e: any) => { 164 markerInstance.on('click', async (e: any) => {
165 const { extraInfo } = e.target.getExtData() 165 const { extraInfo } = e.target.getExtData()
  166 + if (extraInfo.tbDeviceId.startsWith('@')) return //假的模拟数据则终止弹窗
166 let infoWindow = new AMapIns.InfoWindow({ 167 let infoWindow = new AMapIns.InfoWindow({
167 content: await createInfoWindow(extraInfo), 168 content: await createInfoWindow(extraInfo),
168 offset: new AMapIns.Pixel(0, -50) 169 offset: new AMapIns.Pixel(0, -50)