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. 49
      ruoyi-ui/src/views/childRoom/index.vue

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

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

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

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

Loading…
Cancel
Save