diff --git a/ruoyi-ui/src/views/childRoom/RightPanel.vue b/ruoyi-ui/src/views/childRoom/RightPanel.vue
index 3633faa..2b32a52 100644
--- a/ruoyi-ui/src/views/childRoom/RightPanel.vue
+++ b/ruoyi-ui/src/views/childRoom/RightPanel.vue
@@ -71,7 +71,7 @@
-
+
@@ -359,7 +359,6 @@ export default {
this.$emit('hide')
},
- // 新建航线事件
handleSelectPlan(plan) {
this.$emit('select-plan', plan)
},
@@ -407,11 +406,6 @@ export default {
active: this.activeRouteIds.includes(routeId)
}
},
-
- handleDeleteRoute(route) {
- // 暂时留空,后续实现
- },
-
handleOpenWaypointDialog(point) {
this.$emit('open-waypoint-dialog', point)
},
diff --git a/ruoyi-ui/src/views/childRoom/index.vue b/ruoyi-ui/src/views/childRoom/index.vue
index 84a2431..eae1084 100644
--- a/ruoyi-ui/src/views/childRoom/index.vue
+++ b/ruoyi-ui/src/views/childRoom/index.vue
@@ -125,6 +125,7 @@
@select-plan="selectPlan"
@select-route="selectRoute"
@create-route="createRoute"
+ @delete-route="handleDeleteRoute"
@create-plan="createPlan"
@open-plan-dialog="openPlanDialog"
@open-route-dialog="openRouteDialog"
@@ -272,6 +273,7 @@ import LeftMenu from './LeftMenu'
import RightPanel from './RightPanel'
import BottomLeftPanel from './BottomLeftPanel'
import TopHeader from './TopHeader'
+import { listScenario} from "@/api/system/scenario";
import { listRoutes, getRoutes, addRoutes,delRoutes } from "@/api/system/routes";
import { updateWaypoints } from "@/api/system/waypoints";
export default {
@@ -436,20 +438,7 @@ export default {
],
// 航线数据 - 改为方案-航线-航点三级结构
- plans: [
- {
- id: 1,
- name: '方案A',
- routes: [
- ]
- },
- {
- id: 2,
- name: '方案B',
- routes: [
- ]
- }
- ],
+ plans: [],
// 时间控制
timeProgress: 45,
@@ -580,12 +569,23 @@ export default {
}
},
/** 从数据库拉取最新的航线列表数据 */
+ /** 从数据库拉取最新的数据 */
async getList() {
- const query = {}; // 移除固定的 scenarioId,获取所有航线
try {
- const response = await listRoutes(query);
- if (response.code === 200) {
- this.routes = response.rows.map(item => ({
+ // 1. 获取所有方案
+ const scenarioRes = await listScenario({});
+ if (scenarioRes.code === 200) {
+ this.plans = scenarioRes.rows.map(s => ({
+ id: s.id,
+ name: s.name,
+ routes: []
+ }));
+ }
+
+ // 2. 获取所有航线
+ const routeRes = await listRoutes({});
+ if (routeRes.code === 200) {
+ const allRoutes = routeRes.rows.map(item => ({
id: item.id,
name: item.callSign,
points: item.waypoints ? item.waypoints.length : 0,
@@ -593,9 +593,18 @@ export default {
conflict: false,
scenarioId: item.scenarioId
}));
+
+ // 3. 将航线分配到对应的方案中
+ this.plans.forEach(plan => {
+ plan.routes = allRoutes.filter(r => r.scenarioId === plan.id);
+ });
+
+ // 保存一份扁平的 routes 供搜索或其他组件使用
+ this.routes = allRoutes;
}
} catch (error) {
- this.$message.error("获取航线列表失败");
+ console.error("数据加载失败:", error);
+ this.$message.error("获取方案列表失败");
}
},
handleMapDrawComplete(points) {