fix: BUG修改
This commit is contained in:
parent
09e417e0a3
commit
e346bec514
@ -139,6 +139,7 @@ const globalStore = GlobalStore();
|
||||
const tableData = ref<any>([]);
|
||||
const layerJson = ref<any>([]);
|
||||
const clearBool = ref(true);
|
||||
const initGraphicLength = ref(0);
|
||||
let map: any = props.mapInstance;
|
||||
let graphicLayer: any = props.graphicInstance;
|
||||
let dataIndex = 0 as any;
|
||||
@ -156,6 +157,7 @@ const getConfig = async () => {
|
||||
layerJson.value = JSON.parse(result.configValue);
|
||||
console.log(layerJson.value);
|
||||
if (layerJson.value.length > 0) {
|
||||
initGraphicLength.value = layerJson.value.length;
|
||||
layerJson.value.map((item: any, index: number) => {
|
||||
if (item.type == "fixedRoute") {
|
||||
const obj = {
|
||||
@ -340,8 +342,14 @@ const closeDiv = () => {
|
||||
};
|
||||
onUnmounted(() => {
|
||||
map = null;
|
||||
if (clearBool) {
|
||||
graphicLayer.clear();
|
||||
if (clearBool.value) {
|
||||
let arr = graphicLayer.getGraphics();
|
||||
console.log(arr);
|
||||
for (let i = arr.length - 1; i >= initGraphicLength.value; i--) {
|
||||
const graphic = graphicLayer.getGraphicById(arr[i].id);
|
||||
graphic && graphicLayer.removeGraphic(graphic);
|
||||
}
|
||||
// graphicLayer.clear();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -178,6 +178,7 @@ const viewParams = ref({
|
||||
});
|
||||
const infoShow = ref(false);
|
||||
const clearBool = ref(true);
|
||||
const initGraphicLength = ref(0);
|
||||
let map: any = props.mapInstance;
|
||||
let graphicLayer: any = props.graphicInstance;
|
||||
onMounted(() => {});
|
||||
@ -187,6 +188,8 @@ const saveJson = async () => {
|
||||
// ElMessage("当前没有任何数据,无需保存!");
|
||||
// return;
|
||||
// }
|
||||
|
||||
initGraphicLength.value = graphicLayer.getGraphics().length;
|
||||
clearBool.value = false;
|
||||
emits("saveJson", graphicLayer);
|
||||
};
|
||||
@ -470,8 +473,14 @@ const closeDiv = () => {
|
||||
};
|
||||
onUnmounted(() => {
|
||||
map = null;
|
||||
if (clearBool) {
|
||||
graphicLayer.clear();
|
||||
if (clearBool.value) {
|
||||
let arr = graphicLayer.getGraphics();
|
||||
console.log(arr);
|
||||
for (let i = arr.length - 1; i >= initGraphicLength.value; i--) {
|
||||
const graphic = graphicLayer.getGraphicById(arr[i].id);
|
||||
graphic && graphicLayer.removeGraphic(graphic);
|
||||
}
|
||||
// graphicLayer.clear();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -49,13 +49,18 @@ const tableData = ref<any>([]);
|
||||
const checkVal = ref(false);
|
||||
const layerJson = ref<any>([]);
|
||||
const clearBool = ref(true);
|
||||
const initGraphicLength = ref(0);
|
||||
let map: any = props.mapInstance;
|
||||
let graphicLayer: any = props.graphicInstance;
|
||||
let dataIndex = 0;
|
||||
onMounted(() => {
|
||||
graphicLayer?.on(mars3d.EventType.drawCreated, function (event: any) {
|
||||
console.log("矢量对象绘制完成", event);
|
||||
productTableData();
|
||||
|
||||
tableData.value.push({
|
||||
key: event.graphic.id,
|
||||
name: getGraphicName(event.graphic)
|
||||
});
|
||||
});
|
||||
bindLayerPopup(); // 在图层上绑定popup,对所有加到这个图层的矢量数据都生效
|
||||
bindLayerContextMenu(); // 在图层绑定右键菜单,对所有加到这个图层的矢量数据都生效
|
||||
@ -72,6 +77,7 @@ const getConfig = async () => {
|
||||
layerJson.value = JSON.parse(result.configValue);
|
||||
console.log(layerJson.value);
|
||||
if (layerJson.value.length > 0) {
|
||||
initGraphicLength.value = layerJson.value.length;
|
||||
layerJson.value.map((item: any, index: number) => {
|
||||
if (item.type == "point") {
|
||||
const graphic = item;
|
||||
@ -122,34 +128,6 @@ const getGraphicName = (graphic: any) => {
|
||||
graphic.name = `未命名${dataIndex}`;
|
||||
return `${graphic.type} - ${graphic.name}`;
|
||||
};
|
||||
// 生成表格数据
|
||||
const productTableData = () => {
|
||||
console.log(graphicLayer.graphics);
|
||||
const list = graphicLayer.graphics;
|
||||
for (let i = list.length - 1; i >= 0; i--) {
|
||||
const graphic = list[i];
|
||||
if (graphic.isPrivate) {
|
||||
continue;
|
||||
}
|
||||
tableData.value.push({
|
||||
key: graphic.id,
|
||||
name: getGraphicName(graphic)
|
||||
});
|
||||
}
|
||||
// let position = [] as any;
|
||||
// const graphic = new mars3d.graphic.PointEntity({
|
||||
// position: position,
|
||||
// style: {
|
||||
// color: "#00ffff",
|
||||
// pixelSize: 6,
|
||||
// outlineColor: "#ffffff",
|
||||
// outlineWidth: 2
|
||||
// },
|
||||
// attr: { index: dataIndex }
|
||||
// });
|
||||
// graphicLayer.addGraphic(graphic);
|
||||
// dataIndex++;
|
||||
};
|
||||
// 绑定右键菜单
|
||||
const bindLayerContextMenu = () => {
|
||||
graphicLayer.bindContextMenu([
|
||||
@ -254,8 +232,14 @@ const closeDiv = () => {
|
||||
};
|
||||
onUnmounted(() => {
|
||||
map = null;
|
||||
if (clearBool) {
|
||||
graphicLayer.clear();
|
||||
if (clearBool.value) {
|
||||
let arr = graphicLayer.getGraphics();
|
||||
console.log(arr);
|
||||
for (let i = arr.length - 1; i >= initGraphicLength.value; i--) {
|
||||
const graphic = graphicLayer.getGraphicById(arr[i].id);
|
||||
graphic && graphicLayer.removeGraphic(graphic);
|
||||
}
|
||||
// graphicLayer.clear();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -537,6 +537,9 @@ const showMapData = (arr: any) => {
|
||||
});
|
||||
console.log(newRoutePath);
|
||||
graphicLayer.addGraphic(newRoutePath);
|
||||
// 启动漫游
|
||||
newRoutePath.flyTo();
|
||||
newRoutePath.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -139,6 +139,7 @@ const globalStore = GlobalStore();
|
||||
const tableData = ref<any>([]);
|
||||
const layerJson = ref<any>([]);
|
||||
const clearBool = ref(true);
|
||||
const initGraphicLength = ref(0);
|
||||
let map: any = props.mapInstance;
|
||||
let graphicLayer: any = props.graphicInstance;
|
||||
let dataIndex = 0 as any;
|
||||
@ -156,6 +157,7 @@ const getConfig = async () => {
|
||||
layerJson.value = JSON.parse(result.configValue);
|
||||
console.log(layerJson.value);
|
||||
if (layerJson.value.length > 0) {
|
||||
initGraphicLength.value = layerJson.value.length;
|
||||
layerJson.value.map((item: any, index: number) => {
|
||||
if (item.type == "fixedRoute") {
|
||||
const obj = {
|
||||
@ -340,8 +342,14 @@ const closeDiv = () => {
|
||||
};
|
||||
onUnmounted(() => {
|
||||
map = null;
|
||||
if (clearBool) {
|
||||
graphicLayer.clear();
|
||||
if (clearBool.value) {
|
||||
let arr = graphicLayer.getGraphics();
|
||||
console.log(arr);
|
||||
for (let i = arr.length - 1; i >= initGraphicLength.value; i--) {
|
||||
const graphic = graphicLayer.getGraphicById(arr[i].id);
|
||||
graphic && graphicLayer.removeGraphic(graphic);
|
||||
}
|
||||
// graphicLayer.clear();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -178,9 +178,12 @@ const viewParams = ref({
|
||||
});
|
||||
const infoShow = ref(false);
|
||||
const clearBool = ref(true);
|
||||
const initGraphicLength = ref(0);
|
||||
let map: any = props.mapInstance;
|
||||
let graphicLayer: any = props.graphicInstance;
|
||||
onMounted(() => {});
|
||||
onMounted(() => {
|
||||
initGraphicLength.value = graphicLayer.getGraphics().length;
|
||||
});
|
||||
// 保存配置的图上JSON数据
|
||||
const saveJson = async () => {
|
||||
// if (graphicLayer.length == 0) {
|
||||
@ -470,8 +473,14 @@ const closeDiv = () => {
|
||||
};
|
||||
onUnmounted(() => {
|
||||
map = null;
|
||||
if (clearBool) {
|
||||
graphicLayer.clear();
|
||||
if (clearBool.value) {
|
||||
let arr = graphicLayer.getGraphics();
|
||||
console.log(arr);
|
||||
for (let i = arr.length - 1; i >= initGraphicLength.value; i--) {
|
||||
const graphic = graphicLayer.getGraphicById(arr[i].id);
|
||||
graphic && graphicLayer.removeGraphic(graphic);
|
||||
}
|
||||
// graphicLayer.clear();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -49,13 +49,18 @@ const tableData = ref<any>([]);
|
||||
const checkVal = ref(false);
|
||||
const layerJson = ref<any>([]);
|
||||
const clearBool = ref(true);
|
||||
const initGraphicLength = ref(0);
|
||||
let map: any = props.mapInstance;
|
||||
let graphicLayer: any = props.graphicInstance;
|
||||
let dataIndex = 0;
|
||||
onMounted(() => {
|
||||
graphicLayer?.on(mars3d.EventType.drawCreated, function (event: any) {
|
||||
console.log("矢量对象绘制完成", event);
|
||||
productTableData();
|
||||
|
||||
tableData.value.push({
|
||||
key: event.graphic.id,
|
||||
name: getGraphicName(event.graphic)
|
||||
});
|
||||
});
|
||||
bindLayerPopup(); // 在图层上绑定popup,对所有加到这个图层的矢量数据都生效
|
||||
bindLayerContextMenu(); // 在图层绑定右键菜单,对所有加到这个图层的矢量数据都生效
|
||||
@ -72,6 +77,7 @@ const getConfig = async () => {
|
||||
layerJson.value = JSON.parse(result.configValue);
|
||||
console.log(layerJson.value);
|
||||
if (layerJson.value.length > 0) {
|
||||
initGraphicLength.value = layerJson.value.length;
|
||||
layerJson.value.map((item: any, index: number) => {
|
||||
if (item.type == "point") {
|
||||
const graphic = item;
|
||||
@ -122,34 +128,6 @@ const getGraphicName = (graphic: any) => {
|
||||
graphic.name = `未命名${dataIndex}`;
|
||||
return `${graphic.type} - ${graphic.name}`;
|
||||
};
|
||||
// 生成表格数据
|
||||
const productTableData = () => {
|
||||
console.log(graphicLayer.graphics);
|
||||
const list = graphicLayer.graphics;
|
||||
for (let i = list.length - 1; i >= 0; i--) {
|
||||
const graphic = list[i];
|
||||
if (graphic.isPrivate) {
|
||||
continue;
|
||||
}
|
||||
tableData.value.push({
|
||||
key: graphic.id,
|
||||
name: getGraphicName(graphic)
|
||||
});
|
||||
}
|
||||
// let position = [] as any;
|
||||
// const graphic = new mars3d.graphic.PointEntity({
|
||||
// position: position,
|
||||
// style: {
|
||||
// color: "#00ffff",
|
||||
// pixelSize: 6,
|
||||
// outlineColor: "#ffffff",
|
||||
// outlineWidth: 2
|
||||
// },
|
||||
// attr: { index: dataIndex }
|
||||
// });
|
||||
// graphicLayer.addGraphic(graphic);
|
||||
// dataIndex++;
|
||||
};
|
||||
// 绑定右键菜单
|
||||
const bindLayerContextMenu = () => {
|
||||
graphicLayer.bindContextMenu([
|
||||
@ -254,8 +232,14 @@ const closeDiv = () => {
|
||||
};
|
||||
onUnmounted(() => {
|
||||
map = null;
|
||||
if (clearBool) {
|
||||
graphicLayer.clear();
|
||||
if (clearBool.value) {
|
||||
let arr = graphicLayer.getGraphics();
|
||||
console.log(arr);
|
||||
for (let i = arr.length - 1; i >= initGraphicLength.value; i--) {
|
||||
const graphic = graphicLayer.getGraphicById(arr[i].id);
|
||||
graphic && graphicLayer.removeGraphic(graphic);
|
||||
}
|
||||
// graphicLayer.clear();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<div class="map-content" id="map-content">
|
||||
<div id="mars3dContainer" class="mars3d-container"></div>
|
||||
<!-- 搜索框 -->
|
||||
<div class="input-search" v-if="plusMenu.searchAble">
|
||||
<div class="input-search">
|
||||
<el-input
|
||||
v-model="inputVal"
|
||||
@blur="closeSearch"
|
||||
@ -22,7 +22,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- 菜单操作 -->
|
||||
<div class="menu-operate" v-if="plusMenu.menuAble">
|
||||
<div class="menu-operate">
|
||||
<div class="menu-operate-item" v-for="(item, i) in data" :key="i">
|
||||
<div class="toolbar-item" @click="showWidget(item.name)">
|
||||
<img :src="item.icon" alt="" srcset="" style="width: 16px; height: 16px" />
|
||||
@ -358,11 +358,6 @@ const props = {
|
||||
};
|
||||
// 白膜列表
|
||||
const albugineaList = ref([]);
|
||||
// 优化菜单
|
||||
const plusMenu = ref({
|
||||
searchAble: false,
|
||||
menuAble: false
|
||||
});
|
||||
const hours = computed(() => Math.floor(sunProperty.value.currDate / 60));
|
||||
const minutes = computed(() => Math.floor(sunProperty.value.currDate / 60));
|
||||
let map: any;
|
||||
@ -468,21 +463,7 @@ onMounted(async () => {
|
||||
await initMars3d(configJson.value);
|
||||
await initTree();
|
||||
await getConfig();
|
||||
await getPlusConfig();
|
||||
});
|
||||
// 获取地图优化操作配置
|
||||
const getPlusConfig = async () => {
|
||||
let requestData = {
|
||||
configKey: "plusConfig"
|
||||
};
|
||||
const { result } = await getSystemConfig(requestData);
|
||||
console.log(result, "6666666");
|
||||
if (result) {
|
||||
let arr = JSON.parse(result.configValue);
|
||||
plusMenu.value.searchAble = arr[0].value;
|
||||
plusMenu.value.menuAble = arr[1].value;
|
||||
}
|
||||
};
|
||||
// 展示保存的地图标绘配置
|
||||
const showMapData = (arr: any) => {
|
||||
if (arr && arr.length > 0) {
|
||||
@ -536,6 +517,9 @@ const showMapData = (arr: any) => {
|
||||
});
|
||||
console.log(newRoutePath);
|
||||
graphicLayer.addGraphic(newRoutePath);
|
||||
// 启动漫游
|
||||
newRoutePath.flyTo();
|
||||
newRoutePath.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user