|
|
@@ -10,9 +10,8 @@
|
|
|
<div class="drawer-element-content">
|
|
|
<div class="name element-item">
|
|
|
<span class="mr30">名称:</span>
|
|
|
- {{ layerState.layerName }}
|
|
|
- <!-- <a-input v-model:value="layerState.layerName" style="width:110px" placeholder="element name"
|
|
|
- @change="changeLayer" /> -->
|
|
|
+ <a-input v-model:value="layerState.layerName" style="width:110px" placeholder="element name"
|
|
|
+ @change="changeLayer" />
|
|
|
</div>
|
|
|
<div class="longitude element-item" v-if="layerState.currentType === geoType.Point">
|
|
|
<span class="mr30">经度:</span>
|
|
|
@@ -108,17 +107,26 @@ watch(() => props.mapClickElement, (newValue, oldValue) => {
|
|
|
visible.value = true;
|
|
|
state.photoDrawerVisible = false
|
|
|
} else if (newValue.type === 'PHOTO') {
|
|
|
+ const expandedKeyList: string[] = [];
|
|
|
// 图片标注列表
|
|
|
const photoList: any = mapLayers.value.filter((item: any) => item.type === 3);
|
|
|
if (photoList.length === 0) {
|
|
|
return;
|
|
|
}
|
|
|
- const pid = photoList[0].id;
|
|
|
- expandedKeys.value = [pid];
|
|
|
- selectedKeys.value = [`resource__${newValue.id}`];
|
|
|
- selectedLayer.value = getCurrentLayer(`resource__${newValue.id}`)
|
|
|
- state.photoDrawerVisible = true
|
|
|
- visible.value = false;
|
|
|
+ const list = photoList[0];
|
|
|
+ expandedKeyList.push(list.id);
|
|
|
+ list.elements.forEach((item: any) => {
|
|
|
+ item.elements.forEach((element: any) => {
|
|
|
+ if (element.id === newValue.id) {
|
|
|
+ expandedKeyList.push(element.pid)
|
|
|
+ expandedKeys.value = expandedKeyList;
|
|
|
+ selectedKeys.value = [`resource__${newValue.id}`];
|
|
|
+ selectedLayer.value = getCurrentLayer(`resource__${newValue.id}`)
|
|
|
+ state.photoDrawerVisible = true
|
|
|
+ visible.value = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}, { deep: true });
|
|
|
@@ -178,18 +186,19 @@ watch(() => store.state.Layers, newData => {
|
|
|
}, { deep: true })
|
|
|
|
|
|
function setMapCoverByElement(elements: LayerResource[]) {
|
|
|
- elements.forEach(element => {
|
|
|
- const name = element.name
|
|
|
- const content: any = element.resource?.content;
|
|
|
- const color = content.properties.color;
|
|
|
- const pictureInfo = content.picture;
|
|
|
- if (pictureInfo) {
|
|
|
- const list: any = element.resource?.content.geometry.coordinates;
|
|
|
- const coordinates = list.slice(0, 2);
|
|
|
- // 绘制图片标注文件夹
|
|
|
- useGMapCoverHook.updatePhotoElement(pictureInfo.file_id, name, pictureInfo.thumbnail_url, coordinates);
|
|
|
- } else {
|
|
|
- // 绘制默认文件夹
|
|
|
+ elements.forEach((element: any) => {
|
|
|
+ if (element.elements && element.elements.length) {// 图片标注
|
|
|
+ element.elements.forEach((item: any) => {
|
|
|
+ const name = item.name;
|
|
|
+ const content: any = item.resource?.content;
|
|
|
+ const pictureInfo = content.picture;
|
|
|
+ const coordinates: any = content.geometry.coordinates;
|
|
|
+ useGMapCoverHook.updatePhotoElement(pictureInfo.file_id, name, pictureInfo.thumbnail_url, coordinates);
|
|
|
+ })
|
|
|
+ } else {// 默认文件夹
|
|
|
+ const name = element.name;
|
|
|
+ const content: any = element.resource?.content;
|
|
|
+ const color = content.properties.color;
|
|
|
updateMapElement(element, name, color);
|
|
|
}
|
|
|
})
|
|
|
@@ -225,12 +234,12 @@ function selectLayer(keys: string[], e) {
|
|
|
selectedKey.value = e.node.eventKey
|
|
|
selectedLayer.value = getCurrentLayer(selectedKey.value)
|
|
|
const info = e.selectedNodes[0];
|
|
|
- const { type } = info.props.parent;
|
|
|
- if (type === 2) {// 默认文件夹
|
|
|
+ const type = info.props.type;
|
|
|
+ if (type === 'DEFAULT') {// 默认文件夹
|
|
|
setBaseInfo()
|
|
|
- visible.value = true
|
|
|
- } else if (type === 3) {// 图片标注
|
|
|
- state.photoDrawerVisible = true
|
|
|
+ visible.value = true;
|
|
|
+ } else if (type === 'PHOTO') {// 图片标注
|
|
|
+ state.photoDrawerVisible = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -250,7 +259,6 @@ function getCurrentLayer(id: string) {
|
|
|
})
|
|
|
}
|
|
|
findCan(Layers)
|
|
|
- // const layer = Layers.find(item => item.elements.find(el => el.id === key))
|
|
|
return layer
|
|
|
}
|
|
|
function setBaseInfo() {
|
|
|
@@ -327,16 +335,36 @@ async function getElementGroups(type?: string) {
|
|
|
isDistributed: true
|
|
|
})
|
|
|
mapLayers.value = result.data.map((item: any) => {
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- elements: item.elements.map((o: any) => {
|
|
|
+ const data = { ...item };
|
|
|
+ if (item.elements) {// 默认文件夹
|
|
|
+ data.elements = item.elements.map((o: any) => {
|
|
|
return {
|
|
|
...o,
|
|
|
- id: item.type === 3 ? o.resource.content.picture.file_id : o.id,// 图片标注类型时,id更改为fileId
|
|
|
+ id: o.id,
|
|
|
height: o.resource.content.geometry.coordinates[2]
|
|
|
}
|
|
|
})
|
|
|
+ } else {// 图片标注
|
|
|
+ data.elements = item.child_groups.map((o: any) => {
|
|
|
+ return {
|
|
|
+ ...o,
|
|
|
+ elements: o.elements.map((val: any) => {
|
|
|
+ const values = { ...val };
|
|
|
+ const coordinates = values.resource?.content.geometry.coordinates as GeojsonCoordinate;
|
|
|
+ const transResult = wgs84togcj02(
|
|
|
+ coordinates[0],
|
|
|
+ coordinates[1]
|
|
|
+ ) as GeojsonCoordinate
|
|
|
+ values.id = val.resource.content.picture.file_id;
|
|
|
+ values.pid = 'resource__' + o.id;
|
|
|
+ values.resource.content.geometry.coordinates = transResult;
|
|
|
+ return values;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ delete data.child_groups;
|
|
|
}
|
|
|
+ return data;
|
|
|
})
|
|
|
mapLayers.value = updateWgs84togcj02()
|
|
|
if (type && type === 'init') {
|