完善扫描成果与比对资料管理,精简业务菜单和任务工作台,更新批量导入模板。 适配机械臂新协议、坐标系管理及目标位姿组件,增加扫描参数字典和角色自动分配。 修复试运行终止状态与过期扫描任务资源释放,补充回归测试、迁移脚本及接口文档。
28 lines
1.5 KiB
Python
28 lines
1.5 KiB
Python
"""Register the coordinate management entry through the normal menu API. No role grants or device commands."""
|
|
import json
|
|
from pathlib import Path
|
|
from verify_cmvr_native import Client
|
|
|
|
COMPONENT = 'lab/md/coordinate-system/index'
|
|
|
|
def apply():
|
|
client = Client().login()
|
|
rows = client.request('GET', '/admin-api/system/menu/list', expected=(0,))['data']
|
|
existing = next((row for row in rows if row.get('component') == COMPONENT), None)
|
|
if existing:
|
|
assert existing.get('parentId') == 20001 and existing.get('path') == 'coordinate-system', 'Existing menu route differs; do not overwrite'
|
|
return {'menuId': existing['id'], 'created': False, 'roleAssignmentsChanged': False}
|
|
assert any(row['id'] == 20001 for row in rows), 'Configuration parent menu is missing'
|
|
result = client.request('POST', '/admin-api/system/menu/create', body={
|
|
'name': '坐标系建立', 'permission': 'resource:device:list', 'type': 2, 'sort': 6,
|
|
'parentId': 20001, 'path': 'coordinate-system', 'icon': 'ep:coordinate',
|
|
'component': COMPONENT, 'componentName': 'LabCoordinateSystem',
|
|
'status': 0, 'visible': True, 'keepAlive': False, 'alwaysShow': True,
|
|
}, expected=(0,))
|
|
return {'menuId': result['data'], 'created': True, 'roleAssignmentsChanged': False}
|
|
|
|
if __name__ == '__main__':
|
|
report = apply()
|
|
(Path(__file__).resolve().parents[1] / '.local/coordinate-management-menu.json').write_text(json.dumps(report, indent=2), encoding='utf-8')
|
|
print(json.dumps(report))
|