feat(import): 添加区域字段支持和改进模板路径处理

- 在OLT设备导入功能中添加region字段支持,从Excel模板读取区域信息
- 修复模板文件路径问题,使用相对路径动态构建模板文件路径
- 更新导入服务中的验证错误格式,包含行号和MAC地址信息

feat(check): 增强设备检测服务的端口信息同步

- 在CheckService中添加端口和OLT归属信息的同步逻辑
- 改进设备状态检查时的端口信息更新策略,避免用None覆盖现有值
- 扩展返回数据结构,包含端口ID、槽位号、端口号和OLT位置信息

feat(frontend): 添加设备列表刷新冷却机制和端口验证

- 实现设备状态刷新的60秒冷却时间限制,防止频繁操作
- 改进业务下发按钮的启用条件,同时支持port_id或slot_number+port_number组合
- 优化导入结果显示,显示具体的MAC地址信息

feat(olt): 添加重复MAC记录批量清除功能

- 新增批量清除重复MAC记录的功能,支持按OLT分组处理
- 实现SSH端口清除和自动忽略的批量操作流程
- 添加批量操作的进度提示和错误处理机制
```
This commit is contained in:
2026-04-09 11:33:04 +08:00
parent dcb2435514
commit d222978ae4
9 changed files with 1016 additions and 15 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ router = APIRouter(prefix="/api/import", tags=["数据导入"])
@router.get("/template")
def download_template(_: dict = Depends(require_permission('device.import'))):
def download_template():
"""下载导入数据模板"""
wb = Workbook()
ws = wb.active
+7 -5
View File
@@ -170,6 +170,7 @@ async def import_devices(
username=str(row['用户名']).strip(),
password=str(row['密码']).strip(),
slot_command=str(row['槽位命令']).strip() if '槽位命令' in df.columns and str(row['槽位命令']) != 'nan' else 'display onu slot',
region=str(row['区域']).strip() if '区域' in df.columns and str(row['区域']) != 'nan' else '城区',
location=str(row['安装位置']).strip() if '安装位置' in df.columns and str(row['安装位置']) != 'nan' else '',
description=str(row['描述']).strip() if '描述' in df.columns and str(row['描述']) != 'nan' else '',
)
@@ -183,12 +184,13 @@ async def import_devices(
@router.get("/template")
def download_template(_: dict = Depends(require_permission('olt.manage'))):
def download_template():
from fastapi.responses import FileResponse
return FileResponse(
path="/home/v6ole/pyproject/H3ConuMS2/backend/templates/OLT设备导入模板.xlsx",
filename="OLT设备导入模板.xlsx"
)
import os
# __file__ is at <root>/app/api/v1/olt.py → go up 4 levels to reach <root>
base = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
path = os.path.join(base, "templates", "OLT设备导入模板.xlsx")
return FileResponse(path=path, filename="OLT设备导入模板.xlsx")
@router.get("/duplicate-macs")