Commit 540a0ebf8c22582f36562a0da8183b3a90072a92
1 parent
6fcb269e
feat(src/packages/): 高德地图新增标点点击显示弹窗信息
Showing
13 changed files
with
588 additions
and
1 deletions
| @@ -46,6 +46,7 @@ export const getPlatformInfo = () => defHttp.get({ url: Api.PLATFORM }) | @@ -46,6 +46,7 @@ export const getPlatformInfo = () => defHttp.get({ url: Api.PLATFORM }) | ||
| 46 | export const getConfigurationList = (params: object) => { | 46 | export const getConfigurationList = (params: object) => { |
| 47 | return defHttp.get({ url: `${Api.CONFIGURATION}`, params }) | 47 | return defHttp.get({ url: `${Api.CONFIGURATION}`, params }) |
| 48 | } | 48 | } |
| 49 | + | ||
| 49 | //组态设置是否公开或私有 | 50 | //组态设置是否公开或私有 |
| 50 | export const setConfigurationIsShare = (params: string,isShare:boolean,data:object) => { | 51 | export const setConfigurationIsShare = (params: string,isShare:boolean,data:object) => { |
| 51 | return defHttp.post({ | 52 | return defHttp.post({ |
| @@ -53,3 +54,15 @@ export const setConfigurationIsShare = (params: string,isShare:boolean,data:obje | @@ -53,3 +54,15 @@ export const setConfigurationIsShare = (params: string,isShare:boolean,data:obje | ||
| 53 | data | 54 | data |
| 54 | }) | 55 | }) |
| 55 | } | 56 | } |
| 57 | + | ||
| 58 | +// 获取设备状态,在线 or 离线时间 | ||
| 59 | +export const getDeviceActiveTime = (entityId: string) => { | ||
| 60 | + return defHttp.get( | ||
| 61 | + { | ||
| 62 | + url: `/plugins/telemetry/DEVICE/${entityId}/values/attributes?keys=active`, | ||
| 63 | + }, | ||
| 64 | + { | ||
| 65 | + joinPrefix: false, | ||
| 66 | + } | ||
| 67 | + ); | ||
| 68 | +}; |
| 1 | +import { PublicConfigClass } from '@/packages/public' | ||
| 2 | +import { CreateComponentType } from '@/packages/index.d' | ||
| 3 | +import { OverrideMapAmapConfig } from './index' | ||
| 4 | +import { chartInitConfig } from '@/settings/designSetting' | ||
| 5 | +import cloneDeep from 'lodash/cloneDeep' | ||
| 6 | +import dataJson from './data.json' | ||
| 7 | + | ||
| 8 | +export enum ThemeEnum { | ||
| 9 | + NORMAL = 'normal', | ||
| 10 | + DARK = 'dark', | ||
| 11 | + LIGHT = 'light', | ||
| 12 | + WHITES_MOKE = 'whitesmoke', | ||
| 13 | + FRESH = 'fresh', | ||
| 14 | + GREY = 'grey', | ||
| 15 | + GRAFFITI = 'graffiti', | ||
| 16 | + MACARON = 'macaron', | ||
| 17 | + BLUE = 'blue', | ||
| 18 | + DARKBLUE = 'darkblue', | ||
| 19 | + WINE = 'wine', | ||
| 20 | + WEIXIN = 'tileLayer' | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +export enum LangEnum { | ||
| 24 | + ZH_CN = 'zh_cn', | ||
| 25 | + EN = 'en', | ||
| 26 | + ZH_EN = 'zh_en' | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +export enum ViewModeEnum { | ||
| 30 | + PLANE = '2D', | ||
| 31 | + STEREOSCOPIC = '3D' | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +export enum FeaturesEnum { | ||
| 35 | + BG = 'bg', | ||
| 36 | + POINT = 'point', | ||
| 37 | + ROAD = 'road', | ||
| 38 | + BUILDING = 'building' | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +export enum MarkerEnum { | ||
| 42 | + // 圆圈 | ||
| 43 | + CIRCLE_MARKER = 'CircleMarker', | ||
| 44 | + // 定位标点 | ||
| 45 | + MARKER = 'Marker', | ||
| 46 | + // 暂无 | ||
| 47 | + NONE = 'none' | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | +export const option = { | ||
| 51 | + dataset: dataJson, | ||
| 52 | + mapOptions: { | ||
| 53 | + pitch: 60, | ||
| 54 | + skyColor: '#53A9DE', | ||
| 55 | + amapKey: 'd5f3e16589dbecae64d05fe90e2ba4f2', | ||
| 56 | + amapStyleKey: ThemeEnum.DARK, | ||
| 57 | + amapStyleKeyCustom: '', | ||
| 58 | + amapLon: 104.108689, | ||
| 59 | + amapLat: 30.66176, | ||
| 60 | + amapZindex: 11, | ||
| 61 | + marker: { | ||
| 62 | + fillColor: '#E98984FF', | ||
| 63 | + fillOpacity: 0.5, | ||
| 64 | + strokeColor: 'white', | ||
| 65 | + strokeWeight: 2, | ||
| 66 | + strokeOpacity: 0.5, | ||
| 67 | + zIndex: 10, | ||
| 68 | + bubble: true, | ||
| 69 | + cursor: 'pointer', | ||
| 70 | + clickable: true | ||
| 71 | + }, | ||
| 72 | + mapMarkerType: MarkerEnum.MARKER, | ||
| 73 | + viewMode: ViewModeEnum.PLANE, | ||
| 74 | + lang: LangEnum.ZH_CN, | ||
| 75 | + features: [FeaturesEnum.BG, FeaturesEnum.POINT, FeaturesEnum.ROAD, FeaturesEnum.BUILDING] | ||
| 76 | + } | ||
| 77 | +} | ||
| 78 | + | ||
| 79 | +export default class Config extends PublicConfigClass implements CreateComponentType { | ||
| 80 | + public key = OverrideMapAmapConfig.key | ||
| 81 | + public attr = { ...chartInitConfig, w: 1000, h: 800, zIndex: -1 } | ||
| 82 | + public chartConfig = cloneDeep(OverrideMapAmapConfig) | ||
| 83 | + public option = cloneDeep(option) | ||
| 84 | +} |
| 1 | +<template> | ||
| 2 | + <collapse-item name="基础" :expanded="true"> | ||
| 3 | + <setting-item-box name="语言类型" :alone="true"> | ||
| 4 | + <setting-item> | ||
| 5 | + <n-select size="small" v-model:value="optionData.mapOptions.lang" :options="langOptions" /> | ||
| 6 | + </setting-item> | ||
| 7 | + </setting-item-box> | ||
| 8 | + <setting-item-box name="Key" :alone="true"> | ||
| 9 | + <setting-item name="请务必使用自己的高德应用 key"> | ||
| 10 | + <n-input v-model:value="optionData.mapOptions.amapKey" size="small"></n-input> | ||
| 11 | + </setting-item> | ||
| 12 | + </setting-item-box> | ||
| 13 | + <setting-item-box name="自定义地图样式ID" :alone="true"> | ||
| 14 | + <setting-item> | ||
| 15 | + <n-input size="small" v-model:value="optionData.mapOptions.amapStyleKeyCustom" /> | ||
| 16 | + </setting-item> | ||
| 17 | + </setting-item-box> | ||
| 18 | + </collapse-item> | ||
| 19 | + <collapse-item name="地图" :expanded="true"> | ||
| 20 | + <setting-item-box name="主题"> | ||
| 21 | + <setting-item> | ||
| 22 | + <n-select size="small" v-model:value="optionData.mapOptions.amapStyleKey" :options="themeOptions" /> | ||
| 23 | + </setting-item> | ||
| 24 | + </setting-item-box> | ||
| 25 | + <setting-item-box name="内容" :alone="true"> | ||
| 26 | + <n-checkbox-group v-model:value="optionData.mapOptions.features"> | ||
| 27 | + <n-space item-style="display: flex;"> | ||
| 28 | + <n-checkbox :value="item.value" :label="item.label" v-for="(item, index) in featuresOptions" :key="index" /> | ||
| 29 | + </n-space> | ||
| 30 | + </n-checkbox-group> | ||
| 31 | + </setting-item-box> | ||
| 32 | + <setting-item-box name="位置"> | ||
| 33 | + <setting-item name="经度"> | ||
| 34 | + <n-input-number v-model:value="optionData.mapOptions.amapLon" :show-button="false" size="small"> | ||
| 35 | + <template #suffix>°</template> | ||
| 36 | + </n-input-number> | ||
| 37 | + </setting-item> | ||
| 38 | + <setting-item name="纬度"> | ||
| 39 | + <n-input-number v-model:value="optionData.mapOptions.amapLat" :show-button="false" size="small"> | ||
| 40 | + <template #suffix>°</template> | ||
| 41 | + </n-input-number> | ||
| 42 | + </setting-item> | ||
| 43 | + <setting-item name="初始缩放"> | ||
| 44 | + <n-input-number v-model:value="optionData.mapOptions.amapZindex" :min="0" size="small"></n-input-number> | ||
| 45 | + </setting-item> | ||
| 46 | + </setting-item-box> | ||
| 47 | + <setting-item-box name="模式" :alone="true"> | ||
| 48 | + <setting-item> | ||
| 49 | + <n-radio-group v-model:value="optionData.mapOptions.viewMode" name="radiogroup"> | ||
| 50 | + <n-space> | ||
| 51 | + <n-radio v-for="song in viewModeOptions" :key="song.value" :value="song.value"> | ||
| 52 | + {{ song.label }} | ||
| 53 | + </n-radio> | ||
| 54 | + </n-space> | ||
| 55 | + </n-radio-group> | ||
| 56 | + </setting-item> | ||
| 57 | + </setting-item-box> | ||
| 58 | + <template v-if="optionData.mapOptions.viewMode === '3D'"> | ||
| 59 | + <setting-item-box> | ||
| 60 | + <setting-item name="天空色"> | ||
| 61 | + <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.mapOptions.skyColor"></n-color-picker> | ||
| 62 | + </setting-item> | ||
| 63 | + <setting-item name="俯仰角"> | ||
| 64 | + <n-input-number v-model:value="optionData.mapOptions.pitch" :min="0" :max="83" size="small"></n-input-number> | ||
| 65 | + </setting-item> | ||
| 66 | + </setting-item-box> | ||
| 67 | + </template> | ||
| 68 | + </collapse-item> | ||
| 69 | + <collapse-item name="标记" :expanded="true"> | ||
| 70 | + <setting-item-box name="样式"> | ||
| 71 | + <setting-item name="类型"> | ||
| 72 | + <n-select size="small" v-model:value="optionData.mapOptions.mapMarkerType" :options="MarkerOptions" /> | ||
| 73 | + </setting-item> | ||
| 74 | + <setting-item name="颜色"> | ||
| 75 | + <n-color-picker v-model:value="optionData.mapOptions.marker.fillColor" size="small"></n-color-picker> | ||
| 76 | + </setting-item> | ||
| 77 | + </setting-item-box> | ||
| 78 | + </collapse-item> | ||
| 79 | +</template> | ||
| 80 | + | ||
| 81 | +<script setup lang="ts"> | ||
| 82 | +import { PropType } from 'vue' | ||
| 83 | +import { option, MarkerEnum, ThemeEnum, LangEnum, ViewModeEnum, FeaturesEnum } from './config' | ||
| 84 | +import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' | ||
| 85 | + | ||
| 86 | +defineProps({ | ||
| 87 | + optionData: { | ||
| 88 | + type: Object as PropType<typeof option>, | ||
| 89 | + required: true | ||
| 90 | + } | ||
| 91 | +}) | ||
| 92 | + | ||
| 93 | +const themeOptions = [ | ||
| 94 | + { | ||
| 95 | + value: ThemeEnum.NORMAL, | ||
| 96 | + label: '标准' | ||
| 97 | + }, | ||
| 98 | + { | ||
| 99 | + value: ThemeEnum.DARK, | ||
| 100 | + label: '幻影黑' | ||
| 101 | + }, | ||
| 102 | + { | ||
| 103 | + value: ThemeEnum.LIGHT, | ||
| 104 | + label: '月光银' | ||
| 105 | + }, | ||
| 106 | + { | ||
| 107 | + value: ThemeEnum.WHITES_MOKE, | ||
| 108 | + label: '远山黛' | ||
| 109 | + }, | ||
| 110 | + { | ||
| 111 | + value: ThemeEnum.FRESH, | ||
| 112 | + label: '草色青' | ||
| 113 | + }, | ||
| 114 | + { | ||
| 115 | + value: ThemeEnum.GREY, | ||
| 116 | + label: '雅士灰' | ||
| 117 | + }, | ||
| 118 | + { | ||
| 119 | + value: ThemeEnum.GRAFFITI, | ||
| 120 | + label: '涂鸦' | ||
| 121 | + }, | ||
| 122 | + { | ||
| 123 | + value: ThemeEnum.MACARON, | ||
| 124 | + label: '马卡龙' | ||
| 125 | + }, | ||
| 126 | + { | ||
| 127 | + value: ThemeEnum.BLUE, | ||
| 128 | + label: '靛青蓝' | ||
| 129 | + }, | ||
| 130 | + { | ||
| 131 | + value: ThemeEnum.DARKBLUE, | ||
| 132 | + label: '极夜蓝' | ||
| 133 | + }, | ||
| 134 | + { | ||
| 135 | + value: ThemeEnum.WINE, | ||
| 136 | + label: '酱籽' | ||
| 137 | + }, | ||
| 138 | + { | ||
| 139 | + value: ThemeEnum.WEIXIN, | ||
| 140 | + label: '卫星' | ||
| 141 | + } | ||
| 142 | +] | ||
| 143 | + | ||
| 144 | +const langOptions = [ | ||
| 145 | + { | ||
| 146 | + value: LangEnum.ZH_CN, | ||
| 147 | + label: '中文简体' | ||
| 148 | + }, | ||
| 149 | + { | ||
| 150 | + value: LangEnum.EN, | ||
| 151 | + label: '英文' | ||
| 152 | + }, | ||
| 153 | + { | ||
| 154 | + value: LangEnum.ZH_EN, | ||
| 155 | + label: '中英文对照' | ||
| 156 | + } | ||
| 157 | +] | ||
| 158 | + | ||
| 159 | +const viewModeOptions = [ | ||
| 160 | + { | ||
| 161 | + value: ViewModeEnum.PLANE, | ||
| 162 | + label: '2D' | ||
| 163 | + }, | ||
| 164 | + { | ||
| 165 | + value: ViewModeEnum.STEREOSCOPIC, | ||
| 166 | + label: '3D' | ||
| 167 | + } | ||
| 168 | +] | ||
| 169 | + | ||
| 170 | +const featuresOptions = [ | ||
| 171 | + { | ||
| 172 | + value: FeaturesEnum.BG, | ||
| 173 | + label: '显示地图背景' | ||
| 174 | + }, | ||
| 175 | + { | ||
| 176 | + value: FeaturesEnum.POINT, | ||
| 177 | + label: '显示标识' | ||
| 178 | + }, | ||
| 179 | + { | ||
| 180 | + value: FeaturesEnum.ROAD, | ||
| 181 | + label: '显示道路' | ||
| 182 | + }, | ||
| 183 | + { | ||
| 184 | + value: FeaturesEnum.BUILDING, | ||
| 185 | + label: '显示建筑' | ||
| 186 | + } | ||
| 187 | +] | ||
| 188 | + | ||
| 189 | +const MarkerOptions = [ | ||
| 190 | + { | ||
| 191 | + value: MarkerEnum.CIRCLE_MARKER, | ||
| 192 | + label: '圆形标点' | ||
| 193 | + }, | ||
| 194 | + { | ||
| 195 | + value: MarkerEnum.MARKER, | ||
| 196 | + label: '定位标点' | ||
| 197 | + }, | ||
| 198 | + { | ||
| 199 | + value: MarkerEnum.NONE, | ||
| 200 | + label: '隐藏标点' | ||
| 201 | + } | ||
| 202 | +] | ||
| 203 | +</script> |
| 1 | +{ | ||
| 2 | + "markers": [ | ||
| 3 | + { | ||
| 4 | + "name": "x", | ||
| 5 | + "value": 20, | ||
| 6 | + "position": [103.856504, 30.687278], | ||
| 7 | + "extraInfo": { | ||
| 8 | + "tbDeviceId": "xxxxxxxxxxx", | ||
| 9 | + "name": "xx", | ||
| 10 | + "alias": "xx", | ||
| 11 | + "organizationDTO": { | ||
| 12 | + "name": "xx" | ||
| 13 | + }, | ||
| 14 | + "deviceState": "INACTIVE", | ||
| 15 | + "deviceProfile": { | ||
| 16 | + "transportType": "MQTT" | ||
| 17 | + }, | ||
| 18 | + "deviceInfo": { | ||
| 19 | + "address": "四川省", | ||
| 20 | + "longitude": 103.856504, | ||
| 21 | + "latitude": 30.687278 | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + }, | ||
| 25 | + { | ||
| 26 | + "name": "xx", | ||
| 27 | + "value": 30, | ||
| 28 | + "position": [104.095368, 30.716787], | ||
| 29 | + "extraInfo": { | ||
| 30 | + "tbDeviceId": "xxxxxxxxxxxxxxx", | ||
| 31 | + "name": "xxx", | ||
| 32 | + "alias": "xx", | ||
| 33 | + "organizationDTO": { | ||
| 34 | + "name": "xx" | ||
| 35 | + }, | ||
| 36 | + "deviceState": "INACTIVE", | ||
| 37 | + "deviceProfile": { | ||
| 38 | + "transportType": "TCP" | ||
| 39 | + }, | ||
| 40 | + "deviceInfo": { | ||
| 41 | + "address": "四川省", | ||
| 42 | + "longitude": 104.095368, | ||
| 43 | + "latitude": 30.716787 | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + ] | ||
| 48 | +} |
851 Bytes
582 Bytes
514 Bytes
1.35 KB
| 1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | ||
| 2 | +import { ChatCategoryEnum, ChatCategoryEnumName } from '@/packages/components/Charts/index.d' | ||
| 3 | +import { useWidgetKey } from '@/packages/external/useWidgetKey' | ||
| 4 | + | ||
| 5 | +const { key, conKey, chartKey } = useWidgetKey('OverrideMapAmap', true) | ||
| 6 | + | ||
| 7 | +export const OverrideMapAmapConfig: ConfigType = { | ||
| 8 | + key, | ||
| 9 | + chartKey, | ||
| 10 | + conKey, | ||
| 11 | + title: '高德地图', | ||
| 12 | + category: ChatCategoryEnum.MAP, | ||
| 13 | + categoryName: ChatCategoryEnumName.MAP, | ||
| 14 | + package: PackagesCategoryEnum.CHARTS, | ||
| 15 | + chartFrame: ChartFrameEnum.COMMON, | ||
| 16 | + image: 'map_amap.png' | ||
| 17 | +} |
| 1 | +<template> | ||
| 2 | + <div ref="vChartRef"></div> | ||
| 3 | +</template> | ||
| 4 | + | ||
| 5 | +<script setup lang="ts"> | ||
| 6 | +import { ref, PropType, toRefs, watch } from 'vue' | ||
| 7 | +import AMapLoader from '@amap/amap-jsapi-loader' | ||
| 8 | +import { CreateComponentType } from '@/packages/index.d' | ||
| 9 | +import { useChartDataFetch } from '@/hooks' | ||
| 10 | +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | ||
| 11 | +import { MarkerEnum, ThemeEnum } from './config' | ||
| 12 | +import { isArray } from '@/utils' | ||
| 13 | +import djh from './images/djh.png' | ||
| 14 | +import online from './images/online1.png' | ||
| 15 | +import lx1 from './images/lx1.png' | ||
| 16 | +import { getDeviceActiveTime } from '@/api/external/common/index' | ||
| 17 | +import dayjs from 'dayjs' | ||
| 18 | + | ||
| 19 | +const props = defineProps({ | ||
| 20 | + chartConfig: { | ||
| 21 | + type: Object as PropType<CreateComponentType>, | ||
| 22 | + required: true | ||
| 23 | + } | ||
| 24 | +}) | ||
| 25 | + | ||
| 26 | +let { | ||
| 27 | + amapKey, | ||
| 28 | + amapStyleKey, | ||
| 29 | + amapLon, | ||
| 30 | + amapLat, | ||
| 31 | + amapZindex, | ||
| 32 | + mapMarkerType, | ||
| 33 | + lang, | ||
| 34 | + amapStyleKeyCustom, | ||
| 35 | + features, | ||
| 36 | + viewMode, | ||
| 37 | + pitch, | ||
| 38 | + skyColor, | ||
| 39 | + marker | ||
| 40 | +} = toRefs(props.chartConfig.option.mapOptions) | ||
| 41 | + | ||
| 42 | +let mapIns: any = null | ||
| 43 | +let markers: any = [] | ||
| 44 | +let AMapIns: any = null | ||
| 45 | +const vChartRef = ref<HTMLElement>() | ||
| 46 | + | ||
| 47 | +const initMap = (newData: any) => { | ||
| 48 | + // 初始化 | ||
| 49 | + AMapLoader.load({ | ||
| 50 | + key: amapKey.value, //api服务key--另外需要在public中使用安全密钥!!! | ||
| 51 | + version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15 | ||
| 52 | + plugins: ['AMap.PlaceSearch', 'AMap.AutoComplete'] // 需要使用的的插件列表 | ||
| 53 | + }) | ||
| 54 | + .then(AMap => { | ||
| 55 | + AMapIns = AMap | ||
| 56 | + mapIns = new AMap.Map(vChartRef.value, { | ||
| 57 | + resizeEnable: true, | ||
| 58 | + zoom: amapZindex.value, // 地图显示的缩放级别 | ||
| 59 | + center: [amapLon.value, amapLat.value], | ||
| 60 | + lang: lang.value, | ||
| 61 | + features: features.value, | ||
| 62 | + pitch: pitch.value, // 地图俯仰角度,有效范围 0 度- 83 度 | ||
| 63 | + skyColor: skyColor.value, | ||
| 64 | + viewMode: viewMode.value, // 地图模式 | ||
| 65 | + willReadFrequently: true | ||
| 66 | + }) | ||
| 67 | + dataHandle(props.chartConfig.option.dataset) | ||
| 68 | + let satellite = new AMap.TileLayer.Satellite() | ||
| 69 | + let roadNet = new AMap.TileLayer.RoadNet() | ||
| 70 | + if (newData.amapStyleKey === ThemeEnum.WEIXIN) { | ||
| 71 | + mapIns.add([satellite, roadNet]) | ||
| 72 | + } else { | ||
| 73 | + mapIns.remove([satellite, roadNet]) | ||
| 74 | + mapIns.setMapStyle( | ||
| 75 | + `amap://styles/${amapStyleKeyCustom.value !== '' ? amapStyleKeyCustom.value : amapStyleKey.value}` | ||
| 76 | + ) | ||
| 77 | + } | ||
| 78 | + //点击地图任意地方关闭infoWindow窗体 | ||
| 79 | + mapIns.on('click', () => { | ||
| 80 | + mapIns.clearInfoWindow() | ||
| 81 | + }) | ||
| 82 | + }) | ||
| 83 | + .catch(e => { | ||
| 84 | + console.error(e) | ||
| 85 | + }) | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | +const createInfoWindow = async (extraInfo: any) => { | ||
| 89 | + try { | ||
| 90 | + const { name, alias, organizationDTO, deviceState, deviceProfile, deviceInfo, tbDeviceId } = extraInfo | ||
| 91 | + const res = await getDeviceActiveTime(tbDeviceId) | ||
| 92 | + let { lastUpdateTs } = res[0] | ||
| 93 | + lastUpdateTs = dayjs(lastUpdateTs).format('YYYY-MM-DD HH:mm:ss') | ||
| 94 | + return ` | ||
| 95 | + <div style="width:15vw;height:18vh;background-color:white;"> | ||
| 96 | + <div style="margin:0px 10px"> | ||
| 97 | + <div style="display:flex;justify-content:space-between; margin:20px 0px;"> | ||
| 98 | + <div style="font-size:16px;font-weight:bold">${alias || name}</div> | ||
| 99 | + ${ | ||
| 100 | + deviceState === 'INACTIVE' | ||
| 101 | + ? `<div style="display:flex;align-items:center;"><img style="width:15px;height:15px" src="${djh}" class="mr-1">待激活</div>` | ||
| 102 | + : deviceState === 'ONLINE' | ||
| 103 | + ? `<div style="display:flex;align-items:center; "> | ||
| 104 | + <img style="width:15px;height:15px" src="${online}" class="mr-1">在线</div>` | ||
| 105 | + : `<div style="display:flex;align-items:center;"><img style="width:15px;height:15px" src="${lx1}" class="mr-1">离线</div>` | ||
| 106 | + } | ||
| 107 | + </div> | ||
| 108 | + <div>所属组织:${organizationDTO.name}</div> | ||
| 109 | + <div style="margin-top:6px;">接入协议:${deviceProfile.transportType}</div> | ||
| 110 | + <div style="margin-top:6px;"> | ||
| 111 | + 设备位置:${!deviceInfo.address ? '该设备暂无地理位置' : deviceInfo.address} | ||
| 112 | + </div> | ||
| 113 | + <div style="margin-top:6px;"> | ||
| 114 | + ${deviceState === 'ONLINE' ? '在线' : deviceState === 'INACTIVE' ? '创建' : '离线'}时间:${lastUpdateTs} | ||
| 115 | + </div> | ||
| 116 | + </div> | ||
| 117 | + </div> | ||
| 118 | + ` | ||
| 119 | + } catch (e) { | ||
| 120 | + console.error(e) | ||
| 121 | + } | ||
| 122 | +} | ||
| 123 | + | ||
| 124 | +const dataHandle = (newData: any) => { | ||
| 125 | + if (!mapIns && !AMapIns) { | ||
| 126 | + initMap(props.chartConfig.option) | ||
| 127 | + return | ||
| 128 | + } | ||
| 129 | + if (isArray(newData.markers)) { | ||
| 130 | + // 先清除旧标记 | ||
| 131 | + mapIns.remove(markers) | ||
| 132 | + markers = [] | ||
| 133 | + // 记录新标记 | ||
| 134 | + if (mapMarkerType.value === MarkerEnum.MARKER) { | ||
| 135 | + newData.markers.forEach((markerItem: any) => { | ||
| 136 | + const markerInstance = new AMapIns.Marker({ | ||
| 137 | + position: [markerItem.position[0], markerItem.position[1]], | ||
| 138 | + offset: new AMapIns.Pixel(-13, -30) | ||
| 139 | + }) | ||
| 140 | + // markers.push(markerInstance) 原作者这种方式添加,地图标注获取不到当前点击对象 | ||
| 141 | + // markerInstance.setMap(mapIns) | ||
| 142 | + markerInstance.setExtData({ | ||
| 143 | + extraInfo: markerItem.extraInfo | ||
| 144 | + }) | ||
| 145 | + mapIns.add(markerInstance) | ||
| 146 | + markerInstance.setLabel({ | ||
| 147 | + content: markerItem.extraInfo.alias || markerItem.extraInfo.name | ||
| 148 | + }) | ||
| 149 | + markerInstance.on('click', async (e: any) => { | ||
| 150 | + const { extraInfo } = e.target.getExtData() | ||
| 151 | + let infoWindow = new AMapIns.InfoWindow({ | ||
| 152 | + content: await createInfoWindow(extraInfo), | ||
| 153 | + offset: new AMapIns.Pixel(0, -50) | ||
| 154 | + }) | ||
| 155 | + infoWindow.open(mapIns, e.target.getPosition()) | ||
| 156 | + }) | ||
| 157 | + }) | ||
| 158 | + } else if (mapMarkerType.value === MarkerEnum.CIRCLE_MARKER) { | ||
| 159 | + newData.markers.forEach((markerItem: any) => { | ||
| 160 | + const markerInstance = new AMapIns.CircleMarker({ | ||
| 161 | + center: [ | ||
| 162 | + !markerItem.position[0] ? 0 : markerItem.position[0], | ||
| 163 | + !markerItem.position[1] ? 0 : markerItem.position[1] | ||
| 164 | + ], | ||
| 165 | + radius: markerItem.value, | ||
| 166 | + ...marker.value, | ||
| 167 | + }) | ||
| 168 | + // markers.push(markerInstance) //原作者这种方式添加,地图标注获取不到当前点击对象 | ||
| 169 | + // markerInstance.setMap(mapIns) | ||
| 170 | + markerInstance.setExtData({ | ||
| 171 | + extraInfo: markerItem.extraInfo | ||
| 172 | + }) | ||
| 173 | + mapIns.add(markerInstance) | ||
| 174 | + markerInstance.on('click', async (e: any) => { | ||
| 175 | + console.log(e) | ||
| 176 | + const { extraInfo } = e.target.getExtData() | ||
| 177 | + let infoWindow = new AMapIns.InfoWindow({ | ||
| 178 | + content: await createInfoWindow(extraInfo), | ||
| 179 | + offset: new AMapIns.Pixel(0, -50) | ||
| 180 | + }) | ||
| 181 | + infoWindow.open(mapIns, e.target.getPosition()) | ||
| 182 | + }) | ||
| 183 | + }) | ||
| 184 | + } | ||
| 185 | + } | ||
| 186 | +} | ||
| 187 | + | ||
| 188 | +const stopWatch = watch( | ||
| 189 | + () => props.chartConfig.option.mapOptions, | ||
| 190 | + option => { | ||
| 191 | + initMap(option) | ||
| 192 | + }, | ||
| 193 | + { | ||
| 194 | + immediate: true, | ||
| 195 | + deep: true | ||
| 196 | + } | ||
| 197 | +) | ||
| 198 | + | ||
| 199 | +watch( | ||
| 200 | + () => props.chartConfig.option.dataset, | ||
| 201 | + newData => { | ||
| 202 | + try { | ||
| 203 | + dataHandle(newData) | ||
| 204 | + } catch (error) { | ||
| 205 | + console.log(error) | ||
| 206 | + } | ||
| 207 | + }, | ||
| 208 | + { | ||
| 209 | + deep: false | ||
| 210 | + } | ||
| 211 | +) | ||
| 212 | + | ||
| 213 | +// 预览 | ||
| 214 | +useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => { | ||
| 215 | + stopWatch() | ||
| 216 | + dataHandle(newData) | ||
| 217 | +}) | ||
| 218 | +</script> |
| @@ -21,6 +21,7 @@ import { OverrideLineGradientsConfig } from '@/packages/components/external/Char | @@ -21,6 +21,7 @@ import { OverrideLineGradientsConfig } from '@/packages/components/external/Char | ||
| 21 | import { OverrideProcessConfig } from '@/packages/components/external/Charts/Mores/OverrideProcess' | 21 | import { OverrideProcessConfig } from '@/packages/components/external/Charts/Mores/OverrideProcess' |
| 22 | import { OverridePieCircleConfig } from '@/packages/components/external/Charts/Pies/OverridePieCircle' | 22 | import { OverridePieCircleConfig } from '@/packages/components/external/Charts/Pies/OverridePieCircle' |
| 23 | import { OverrideMapBaseConfig } from '@/packages/components/external/Charts/Maps/OverrideMapBase' | 23 | import { OverrideMapBaseConfig } from '@/packages/components/external/Charts/Maps/OverrideMapBase' |
| 24 | +import { OverrideMapAmapConfig } from '@/packages/components/external/Charts/Maps/OverrideMapAmap' | ||
| 24 | import { OverrideVideoConfig } from '@/packages/components/external/Informations/Mores/OverrideVideo' | 25 | import { OverrideVideoConfig } from '@/packages/components/external/Informations/Mores/OverrideVideo' |
| 25 | import { OverrideWaterPoloConfig } from '@/packages/components/external/Charts/Mores/OverrideWaterPolo' | 26 | import { OverrideWaterPoloConfig } from '@/packages/components/external/Charts/Mores/OverrideWaterPolo' |
| 26 | import { OverrideDialConfig } from '@/packages/components/external/Charts/Mores/OverrideDial' | 27 | import { OverrideDialConfig } from '@/packages/components/external/Charts/Mores/OverrideDial' |
| @@ -104,6 +105,7 @@ export function useInjectLib(packagesList: EPackagesType) { | @@ -104,6 +105,7 @@ export function useInjectLib(packagesList: EPackagesType) { | ||
| 104 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideProcessConfig)//重写图表下的native ui | 105 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideProcessConfig)//重写图表下的native ui |
| 105 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverridePieCircleConfig)//重写图表下的饼图 | 106 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverridePieCircleConfig)//重写图表下的饼图 |
| 106 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideMapBaseConfig)//重写图表下的地图 | 107 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideMapBaseConfig)//重写图表下的地图 |
| 108 | + addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideMapAmapConfig)//重写图表下的高德地图 | ||
| 107 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideWaterPoloConfig)//重写图表下的水球图 | 109 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideWaterPoloConfig)//重写图表下的水球图 |
| 108 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideDialConfig)//重写图表下的表盘 | 110 | addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.CHARTS, OverrideDialConfig)//重写图表下的表盘 |
| 109 | // | 111 | // |
| @@ -16,7 +16,8 @@ export const hideAsideComponentsObj = { | @@ -16,7 +16,8 @@ export const hideAsideComponentsObj = { | ||
| 16 | 'VPieCircle' //饼图-环形 | 16 | 'VPieCircle' //饼图-环形 |
| 17 | ], | 17 | ], |
| 18 | Maps: [ | 18 | Maps: [ |
| 19 | - 'VMapBase' //地图(可选省份) | 19 | + 'VMapBase', //地图(可选省份) |
| 20 | + 'VMapAmap', //高德地图 | ||
| 20 | ], | 21 | ], |
| 21 | Mores: [ | 22 | Mores: [ |
| 22 | 'VProcess', //NaiveUI-进度 | 23 | 'VProcess', //NaiveUI-进度 |
| @@ -45,6 +46,7 @@ export const hideAsideComponentsObj = { | @@ -45,6 +46,7 @@ export const hideAsideComponentsObj = { | ||
| 45 | 'VLineGradients', //双折线渐变面积图 | 46 | 'VLineGradients', //双折线渐变面积图 |
| 46 | 'VPieCircle', //饼图-环形 | 47 | 'VPieCircle', //饼图-环形 |
| 47 | 'VMapBase', //地图(可选省份) | 48 | 'VMapBase', //地图(可选省份) |
| 49 | + 'VMapAmap',//高德地图 | ||
| 48 | 'VProcess', //NaiveUI-进度 | 50 | 'VProcess', //NaiveUI-进度 |
| 49 | 'VTextGradient', //渐变文字 | 51 | 'VTextGradient', //渐变文字 |
| 50 | 'VTextBarrage', //弹幕文字 | 52 | 'VTextBarrage', //弹幕文字 |