|
@@ -181,7 +181,6 @@ import {
|
|
|
Ref, ref, watch
|
|
Ref, ref, watch
|
|
|
} from 'vue'
|
|
} from 'vue'
|
|
|
import '@/../node_modules/leaflet/dist/leaflet.css'
|
|
import '@/../node_modules/leaflet/dist/leaflet.css'
|
|
|
-import useStore from '@/pages/store'
|
|
|
|
|
// ----- 修复L 增加tooltip 缩放报错 重要!!
|
|
// ----- 修复L 增加tooltip 缩放报错 重要!!
|
|
|
|
|
|
|
|
(L.Tooltip as any).prototype._animateZoom = function (e: { zoom: any; center: any; }) {
|
|
(L.Tooltip as any).prototype._animateZoom = function (e: { zoom: any; center: any; }) {
|
|
@@ -217,31 +216,37 @@ export interface Item {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export interface BaseMap {
|
|
export interface BaseMap {
|
|
|
- DID?: number,
|
|
|
|
|
width: number,
|
|
width: number,
|
|
|
height: number,
|
|
height: number,
|
|
|
mapId: string,
|
|
mapId: string,
|
|
|
name?: string
|
|
name?: string
|
|
|
imgUrl: string,
|
|
imgUrl: string,
|
|
|
trackType?: number, // 1电扶梯 2给排水 3通风 4照明 5车站环境检测 6车站暖通 7车站动环
|
|
trackType?: number, // 1电扶梯 2给排水 3通风 4照明 5车站环境检测 6车站暖通 7车站动环
|
|
|
- showTip?: boolean
|
|
|
|
|
|
|
+ showTip?: boolean,
|
|
|
|
|
+ uuid?: string
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const props = withDefaults(defineProps<{
|
|
const props = withDefaults(defineProps<{
|
|
|
isEdit?: boolean, // 是否编辑
|
|
isEdit?: boolean, // 是否编辑
|
|
|
baseMap?: BaseMap
|
|
baseMap?: BaseMap
|
|
|
}>(), {
|
|
}>(), {
|
|
|
- isEdit: false,
|
|
|
|
|
|
|
+ isEdit: true,
|
|
|
baseMap: () => ({
|
|
baseMap: () => ({
|
|
|
- imgUrl: '', width: 0, height: 0, mapId: '', showTip: false
|
|
|
|
|
|
|
+ imgUrl: '/system/track/djy.png', width: 1400, height: 430, mapId: 'd33d83d7-02cb-2ce3-37e1-e563320b93dd', showTip: false
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
const emit = defineEmits<{(evt: 'markerClick', value: Item): void }>()
|
|
const emit = defineEmits<{(evt: 'markerClick', value: Item): void }>()
|
|
|
const Map = ref()
|
|
const Map = ref()
|
|
|
-const iconList = ref([] as { icon: string, name: string }[])
|
|
|
|
|
|
|
+const iconList = ref([
|
|
|
|
|
+ { name: '电扶梯', icon: 'https://gsm.jdjinsui.com/gsmImage/system/track/电扶梯正常.png' }
|
|
|
|
|
+] as { icon: string, name: string }[])
|
|
|
const currentItem: Ref<Item | undefined> = ref()
|
|
const currentItem: Ref<Item | undefined> = ref()
|
|
|
const isCheck = ref(false)
|
|
const isCheck = ref(false)
|
|
|
-const options = ref([] as BaseMap[])
|
|
|
|
|
|
|
+const options = ref([
|
|
|
|
|
+ {
|
|
|
|
|
+ imgUrl: '/system/track/djy.png', width: 1400, height: 430, mapId: 'd33d83d7-02cb-2ce3-37e1-e563320b93dd', name: 'test', uuid: 'e5cdf830-587a-11ef-a53a-f3fe72299e7d'
|
|
|
|
|
+ }
|
|
|
|
|
+] as BaseMap[])
|
|
|
const selected = ref('')
|
|
const selected = ref('')
|
|
|
const assetOption = ref([])
|
|
const assetOption = ref([])
|
|
|
const formRef = ref()
|
|
const formRef = ref()
|
|
@@ -264,7 +269,6 @@ const showPoup = ref(false)
|
|
|
const currentMap: Ref<BaseMap | undefined> = ref()
|
|
const currentMap: Ref<BaseMap | undefined> = ref()
|
|
|
const currentMarker = ref()
|
|
const currentMarker = ref()
|
|
|
const allMarker = ref([] as L.Marker[])
|
|
const allMarker = ref([] as L.Marker[])
|
|
|
-const store = useStore()
|
|
|
|
|
|
|
|
|
|
// 资产下拉
|
|
// 资产下拉
|
|
|
function selectChange(_: string, option: Item) {
|
|
function selectChange(_: string, option: Item) {
|
|
@@ -436,7 +440,7 @@ async function changeMap(_: string, option: BaseMap) {
|
|
|
// 添加底图
|
|
// 添加底图
|
|
|
if (!option.imgUrl || !option.width || !option.height || !option.mapId) return window.$notification.error({ content: '底图缺少相关参数', duration: 3000, keepAliveOnHover: true })
|
|
if (!option.imgUrl || !option.width || !option.height || !option.mapId) return window.$notification.error({ content: '底图缺少相关参数', duration: 3000, keepAliveOnHover: true })
|
|
|
currentMap.value = option
|
|
currentMap.value = option
|
|
|
- L.imageOverlay(import.meta.env.VITE_IMG_URL + option.imgUrl, [ [ 0, 0 ], [ option.height, option.width ] ]).addTo(Map.value)
|
|
|
|
|
|
|
+ L.imageOverlay(`https://gsm.jdjinsui.com/gsmImage${option.imgUrl}`, [ [ 0, 0 ], [ option.height, option.width ] ]).addTo(Map.value)
|
|
|
Map.value.setView([ option.height / 2, option.width / (props.isEdit ? 3.5 : 2) ], 0)
|
|
Map.value.setView([ option.height / 2, option.width / (props.isEdit ? 3.5 : 2) ], 0)
|
|
|
// 获取底图绑定的maker
|
|
// 获取底图绑定的maker
|
|
|
bindMarker(option.mapId)
|
|
bindMarker(option.mapId)
|
|
@@ -557,13 +561,7 @@ function destory() {
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
document.title = 'leaflet画图'
|
|
document.title = 'leaflet画图'
|
|
|
- if (Object.keys(store.currentStratum).length) {
|
|
|
|
|
- if (Map.value) {
|
|
|
|
|
- changeMap('', store.currentStratum)
|
|
|
|
|
- } else {
|
|
|
|
|
- initMap(store.currentStratum)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ initMap(props.baseMap)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
watch(() => props.baseMap, (v) => {
|
|
watch(() => props.baseMap, (v) => {
|