Browse Source

Merge branch 'ctw' of http://124.70.32.114:3100/woka/cesium-map-object into mh

# Conflicts:
#	ruoyi-ui/src/views/childRoom/index.vue
master
menghao 2 months ago
parent
commit
4d064b02cc
  1. 1
      ruoyi-ui/src/views/childRoom/RightPanel.vue
  2. 121
      ruoyi-ui/src/views/childRoom/index.vue

1
ruoyi-ui/src/views/childRoom/RightPanel.vue

@ -359,6 +359,7 @@ export default {
this.$emit('hide')
},
// 线
handleSelectPlan(plan) {
this.$emit('select-plan', plan)
},

121
ruoyi-ui/src/views/childRoom/index.vue

@ -569,7 +569,6 @@ export default {
}
},
/** 从数据库拉取最新的航线列表数据 */
/** 从数据库拉取最新的数据 */
async getList() {
try {
// 1.
@ -618,21 +617,21 @@ export default {
},
/** 弹窗点击“确定”:正式将数据保存到后端数据库 */
async confirmSaveNewRoute() {
// 1.
//
if (!this.newRouteName || this.newRouteName.trim() === '') {
this.$message.error('新增航线未命名,请输入名称后保存!');
return;
}
// ID
const currentScenarioId = this.selectedPlanId;
if (!currentScenarioId) {
this.$message.warning('请先在左侧选择一个方案,再保存航线!');
return;
}
// 2.
// Routes
const routeData = {
callSign: this.newRouteName,
scenarioId: currentScenarioId,
scenarioId: currentScenarioId || 1, // 使ID1
platformId: 1,
attributes: "{}",
waypoints: this.tempMapPoints.map((p, index) => ({
@ -645,55 +644,45 @@ export default {
turnAngle: 0.0
}))
};
try {
const response = await addRoutes(routeData);
if (response.code === 200) {
this.$message.success('航线及其航点已成功保存至当前方案');
const savedRoute = response.data;
const newRouteId = savedRoute ? savedRoute.id : null;
// 1. 线 clearRoute
if (this.$refs.cesiumMap) {
this.drawDom = false;
if (this.$refs.cesiumMap.clearTempRoute) this.$refs.cesiumMap.clearTempRoute();
}
// 2.
await this.getList();
// 3.
this.$nextTick(async () => {
if (newRouteId) {
// ID UI
if (!this.activeRouteIds.includes(newRouteId)) {
this.activeRouteIds.push(newRouteId);
}
// getList
this.selectedRouteId = newRouteId;
this.selectedRouteDetails = {
id: newRouteId,
name: this.newRouteName,
waypoints: routeData.waypoints
};
// 线
if (this.$refs.cesiumMap) {
this.$refs.cesiumMap.renderRouteWaypoints(routeData.waypoints, newRouteId);
}
try {
// API
const response = await addRoutes(routeData);
if (response.code === 200) {
this.$message.success('航线及其航点已成功保存至当前方案');
// ID
const savedRoute = response.data;
const newRouteId = savedRoute ? savedRoute.id : null;
if (this.$refs.cesiumMap) {
this.$refs.cesiumMap.clearRoute();
// ID线
if (newRouteId) {
if (!this.activeRouteIds.includes(savedRoute.id)) {
this.activeRouteIds.push(savedRoute.id);
}
});
// 4. UI
this.showNameDialog = false;
this.newRouteName = '';
this.tempMapPoints = [];
//
this.selectedRouteDetails = {
id: newRouteId,
name: this.newRouteName,
waypoints: routeData.waypoints
};
//使 ID 线
this.$refs.cesiumMap.renderRouteWaypoints(routeData.waypoints, newRouteId);
}
}
} catch (error) {
console.error("保存失败:", error);
// UI
this.showNameDialog = false;
this.drawDom = false;
this.newRouteName = '';
this.tempMapPoints = [];
// 线
await this.getList();
}
},
} catch (error) {
console.error("保存航线失败:", error);
this.$message.error('保存失败,请检查后端服务');
}
},
//
openWaypointDialog(waypoint) {
this.selectedWaypoint = waypoint;
@ -1374,23 +1363,23 @@ export default {
}
if (this.selectedRouteDetails && this.selectedRouteDetails.id === route.id) {
if (this.activeRouteIds.length > 0) {
const lastId = this.activeRouteIds[this.activeRouteIds.length - 1];
getRoutes(lastId).then(res => {
if (res.code === 200 && res.data) {
this.selectedRouteId = res.data.id;
this.selectedRouteDetails = {
id: res.data.id,
name: res.data.callSign,
waypoints: res.data.waypoints || []
};
}
}).catch(e => {
console.error("获取航线详情失败", e);
});
} else {
this.selectedRouteId = null;
this.selectedRouteDetails = null;
const lastId = this.activeRouteIds[this.activeRouteIds.length - 1];
getRoutes(lastId).then(res => {
if (res.code === 200 && res.data) {
this.selectedRouteId = res.data.id;
this.selectedRouteDetails = {
id: res.data.id,
name: res.data.callSign,
waypoints: res.data.waypoints || []
};
}
}).catch(e => {
console.error("获取航线详情失败", e);
});
} else {
this.selectedRouteId = null;
this.selectedRouteDetails = null;
}
}
this.$message.info(`已隐藏航线: ${route.name}`);
} else {

Loading…
Cancel
Save