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