import Layout from "@/layout/index.vue";
import { createPage } from "./helper";

/**
 * 后台布局路由
 * - Layout 负责侧栏 + 顶栏
 * - children 为业务页面，左侧菜单点击切换
 */
export default [
  {
    path: "/",
    component: Layout,
    redirect: "/device",
    children: [
      createPage({
        path: "device",
        name: "Device",
        component: () => import("@/views/device/index.vue"),
        title: "设备管理",
      }),
      createPage({
        path: "planting",
        name: "Planting",
        component: () => import("@/views/planting/index.vue"),
        title: "种植方案",
      }),
      createPage({
        path: "personnel",
        name: "Personnel",
        component: () => import("@/views/personnel/index.vue"),
        title: "人员管理",
        // 地图页关闭缓存，避免 keep-alive 导致容器尺寸/地图实例异常
        keepAlive: false,
      }),
    ],
  },
];
