feat(platform): 部署配置向导 + 地图管理,地图编辑器接入统一存取与 AI 助手
- 配置向导:登录按 deployment 画像引导平台选型(导航方式/模块/场景),未完成则路由守卫强制进入 /wizard;选型驱动菜单按需裁剪,并联动 SimpleLite 写 plugins/active-scenes.json + 透传 --scenes 选择性加载导航场景插件 - 地图管理页:服务器地图列表/使用/重命名/删除、地图合并、多地图连接管理 - 地图编辑器:项目存取改为存入地图管理统一目录(同名替换确认),支持 ?map=/?new= 进入,新增右侧可停靠 AI 助手面板 - 集成 PTL 拣选模块;新增车队分配面板(运维总览/筛选联动) - SimpleLiteBuildSync 同步运行时依赖 DLL;重新构建前端静态资源 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import http from './http'
|
||||
import type {
|
||||
WizardOptions,
|
||||
DeploymentProfileDto,
|
||||
SaveWizardRequest,
|
||||
EffectivePagesDto
|
||||
} from '@/types/wizard'
|
||||
|
||||
// 与 api/auth.ts 一致:VITE_USE_MOCK==='true' 时走本地假数据,便于无后端联调。
|
||||
const MOCK = import.meta.env.VITE_USE_MOCK === 'true'
|
||||
|
||||
const MOCK_OPTIONS: WizardOptions = {
|
||||
navigationKinds: [
|
||||
{ id: 'magnetic', name: '磁导航', group: 'navigation', description: '磁条循迹 + 地标 / RFID 定位' },
|
||||
{ id: 'qrcode', name: '二维码导航', group: 'navigation', description: '二维码地标 + 码值地图' },
|
||||
{ id: 'laser', name: '激光导航', group: 'navigation', description: '反光板 / SLAM + 激光避障' }
|
||||
],
|
||||
modules: [
|
||||
{ id: 'wms', name: 'WMS 仓储管理', group: 'module', description: '库位 / 库存 / 出入库管理' },
|
||||
{ id: 'ptl', name: 'PTL 拣选系统', group: 'module', description: 'Pick-to-Light 亮灯拣选与播种' }
|
||||
],
|
||||
scenarios: {
|
||||
templates: [
|
||||
{ id: 'tpl-sps', name: 'SPS 物料配送', category: 'SPS' },
|
||||
{ id: 'tpl-pack', name: '电池 Pack 自动化产线', category: 'BatteryPack' },
|
||||
{ id: 'tpl-loop', name: '环线运行', category: 'Loop' },
|
||||
{ id: 'tpl-p2p', name: '点对点柔性搬运', category: 'P2P' }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mockProfile: DeploymentProfileDto = {
|
||||
configured: false,
|
||||
platformType: 'standard',
|
||||
modules: [],
|
||||
navigationKinds: [],
|
||||
scenarios: [],
|
||||
updatedBy: 'mock',
|
||||
activeSceneIds: [],
|
||||
hiddenPages: []
|
||||
}
|
||||
|
||||
export async function getWizardOptions(): Promise<WizardOptions> {
|
||||
if (MOCK) return MOCK_OPTIONS
|
||||
const { data } = await http.get<WizardOptions>('/wizard/options')
|
||||
return data
|
||||
}
|
||||
|
||||
export async function getWizardProfile(): Promise<DeploymentProfileDto> {
|
||||
if (MOCK) return mockProfile
|
||||
const { data } = await http.get<DeploymentProfileDto>('/wizard/profile')
|
||||
return data
|
||||
}
|
||||
|
||||
export async function saveWizardProfile(req: SaveWizardRequest): Promise<DeploymentProfileDto> {
|
||||
if (MOCK) {
|
||||
mockProfile = {
|
||||
...mockProfile,
|
||||
platformType: req.platformType ?? mockProfile.platformType,
|
||||
modules: req.modules ?? [],
|
||||
navigationKinds: req.navigationKinds ?? [],
|
||||
scenarios: req.scenarios ?? [],
|
||||
configured: true,
|
||||
activeSceneIds: (req.navigationKinds ?? []).map((k) => `scene.${k}`)
|
||||
}
|
||||
return mockProfile
|
||||
}
|
||||
const { data } = await http.put<DeploymentProfileDto>('/wizard/profile', req)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function getEffectivePages(): Promise<EffectivePagesDto> {
|
||||
if (MOCK) {
|
||||
return { configured: mockProfile.configured, tailorablePages: [], enabledPages: [], hiddenPages: [] }
|
||||
}
|
||||
const { data } = await http.get<EffectivePagesDto>('/wizard/effective-pages')
|
||||
return data
|
||||
}
|
||||
Reference in New Issue
Block a user