66 lines
1.7 KiB
Markdown
66 lines
1.7 KiB
Markdown
# 状态中心 Web 版
|
||
|
||
## 一键启动联调环境
|
||
|
||
在项目根目录执行:
|
||
|
||
macOS/Linux:
|
||
|
||
```bash
|
||
./.venv_test/bin/python scripts/dev.py start
|
||
```
|
||
|
||
Windows PowerShell:
|
||
|
||
```powershell
|
||
.\.venv_test\Scripts\python.exe scripts\dev.py start
|
||
```
|
||
|
||
启动器会复用或创建 Docker MySQL 容器 `rpa-center-mysql`,然后启动 FastAPI 和 Vite。
|
||
|
||
```bash
|
||
python scripts/dev.py status
|
||
python scripts/dev.py stop
|
||
```
|
||
|
||
`status` 只有在 MySQL 端口、FastAPI `/health`(包含数据库探测)和 Vite 端口都正常时才返回成功。
|
||
|
||
## 手动启动
|
||
|
||
```bash
|
||
cd state_center_web
|
||
npm install
|
||
npm run dev
|
||
```
|
||
|
||
默认地址:`http://localhost:5173`
|
||
|
||
后端另开一个终端:
|
||
|
||
macOS/Linux:
|
||
|
||
```bash
|
||
python -m pip install -r state_center/requirements.txt
|
||
DEV_MODE=true python -m uvicorn state_center.app.main:app --reload --port 8000
|
||
```
|
||
|
||
Windows PowerShell:
|
||
|
||
```powershell
|
||
$env:DEV_MODE = "true"
|
||
python -m pip install -r state_center\requirements.txt
|
||
python -m uvicorn state_center.app.main:app --reload --port 8000
|
||
```
|
||
|
||
浏览器访问:`http://localhost:5173/`。同一套页面适用于 Windows 和 macOS;前端不会自行推导流程下一节点,所有节点状态都来自 FastAPI。
|
||
|
||
## 说明
|
||
|
||
- 页面全中文。
|
||
- 后端可连时,直接读 `state_center` 的 FastAPI 接口。
|
||
- 后端没起时,页面自动切到本地演示数据,仍可看到单据列表、流程状态图和待办面板。
|
||
- 页面顶部会明确显示“本地演示数据”或“后端已连接”。
|
||
- 对码待办可直接选择候选货品;人工节点按节点显示对应动作。
|
||
- 节点回调模拟区只在开发环境构建中显示。
|
||
- 开发令牌只保存在浏览器会话里,不会写进代码。
|