|
@@ -1393,38 +1393,39 @@ export default {
|
|
|
const serviceId = service.id || service.serviceId;
|
|
const serviceId = service.id || service.serviceId;
|
|
|
const serviceType = service.type || 'SCENE';
|
|
const serviceType = service.type || 'SCENE';
|
|
|
|
|
|
|
|
|
|
+ const finishUnload = () => {
|
|
|
|
|
+ const idx = this.loadedCustomServiceIds.indexOf(serviceId);
|
|
|
|
|
+ if (idx > -1) {
|
|
|
|
|
+ this.loadedCustomServiceIds.splice(idx, 1);
|
|
|
|
|
+ console.log('已从loadedCustomServiceIds中移除服务:', serviceId);
|
|
|
|
|
+ }
|
|
|
|
|
+ window.store.actions.setChangeLayers();
|
|
|
|
|
+ this.saveLoadedServices();
|
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
if (serviceType === 'SCENE' && service.loadedLayerNames && service.loadedLayerNames.length > 0) {
|
|
if (serviceType === 'SCENE' && service.loadedLayerNames && service.loadedLayerNames.length > 0) {
|
|
|
console.log('使用loadedLayerNames卸载SCENE图层:', service.loadedLayerNames);
|
|
console.log('使用loadedLayerNames卸载SCENE图层:', service.loadedLayerNames);
|
|
|
|
|
+ let unloadedCount = 0;
|
|
|
service.loadedLayerNames.forEach((layerName, index) => {
|
|
service.loadedLayerNames.forEach((layerName, index) => {
|
|
|
console.log('卸载图层:', layerName);
|
|
console.log('卸载图层:', layerName);
|
|
|
- const isLast = index === service.loadedLayerNames.length - 1;
|
|
|
|
|
layerManagement.layersDelete('S3M', layerName, () => {
|
|
layerManagement.layersDelete('S3M', layerName, () => {
|
|
|
console.log('图层已卸载:', layerName);
|
|
console.log('图层已卸载:', layerName);
|
|
|
- if (isLast) {
|
|
|
|
|
- const idx = this.loadedCustomServiceIds.indexOf(serviceId);
|
|
|
|
|
- if (idx > -1) {
|
|
|
|
|
- this.loadedCustomServiceIds.splice(idx, 1);
|
|
|
|
|
- console.log('已从loadedCustomServiceIds中移除服务:', serviceId);
|
|
|
|
|
- }
|
|
|
|
|
- window.store.actions.setChangeLayers();
|
|
|
|
|
- this.saveLoadedServices();
|
|
|
|
|
|
|
+ unloadedCount++;
|
|
|
|
|
+ if (unloadedCount === service.loadedLayerNames.length) {
|
|
|
|
|
+ finishUnload();
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
} else if (service.layers && service.layers.length > 0) {
|
|
} else if (service.layers && service.layers.length > 0) {
|
|
|
|
|
+ let unloadedCount = 0;
|
|
|
service.layers.forEach((layer, index) => {
|
|
service.layers.forEach((layer, index) => {
|
|
|
console.log('卸载图层:', layer.type, layer.layerName);
|
|
console.log('卸载图层:', layer.type, layer.layerName);
|
|
|
- const isLast = index === service.layers.length - 1;
|
|
|
|
|
layerManagement.layersDelete(layer.type, layer.layerName, () => {
|
|
layerManagement.layersDelete(layer.type, layer.layerName, () => {
|
|
|
console.log('图层已卸载:', layer.layerName);
|
|
console.log('图层已卸载:', layer.layerName);
|
|
|
- if (isLast) {
|
|
|
|
|
- const idx = this.loadedCustomServiceIds.indexOf(serviceId);
|
|
|
|
|
- if (idx > -1) {
|
|
|
|
|
- this.loadedCustomServiceIds.splice(idx, 1);
|
|
|
|
|
- console.log('已从loadedCustomServiceIds中移除服务:', serviceId);
|
|
|
|
|
- }
|
|
|
|
|
- window.store.actions.setChangeLayers();
|
|
|
|
|
- this.saveLoadedServices();
|
|
|
|
|
|
|
+ unloadedCount++;
|
|
|
|
|
+ if (unloadedCount === service.layers.length) {
|
|
|
|
|
+ finishUnload();
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -1434,12 +1435,7 @@ export default {
|
|
|
console.log('卸载参数 - serviceId:', serviceId, 'type:', type, 'layerName:', layerName);
|
|
console.log('卸载参数 - serviceId:', serviceId, 'type:', type, 'layerName:', layerName);
|
|
|
layerManagement.layersDelete(type, layerName, () => {
|
|
layerManagement.layersDelete(type, layerName, () => {
|
|
|
console.log('服务已卸载:', service.name);
|
|
console.log('服务已卸载:', service.name);
|
|
|
- const idx = this.loadedCustomServiceIds.indexOf(serviceId);
|
|
|
|
|
- if (idx > -1) {
|
|
|
|
|
- this.loadedCustomServiceIds.splice(idx, 1);
|
|
|
|
|
- }
|
|
|
|
|
- window.store.actions.setChangeLayers();
|
|
|
|
|
- this.saveLoadedServices();
|
|
|
|
|
|
|
+ finishUnload();
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|