feat: 优化3D可视化性能并更新文档
- 实现3D可视化性能优化(降低DPR、阴影贴图、简化光源) - 实现LOD多级细节系统,根据相机距离自动切换 - 添加设备弹出动画开关,默认关闭 - 修复设备缩放时位置偏移问题 - 更新README添加项目截图占位符 - 精简DEPLOYMENT.md文档,添加Gitee仓库支持 - 更新CHANGELOG.md记录v1.1.0版本
This commit is contained in:
@@ -90,6 +90,52 @@ router.get('/device/:deviceId', async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// 获取指定机柜内所有设备的接线
|
||||
router.get('/rack/:rackId', async (req, res) => {
|
||||
try {
|
||||
const { rackId } = req.params;
|
||||
|
||||
// 1. 找出该机柜下的所有设备ID
|
||||
const devices = await Device.findAll({
|
||||
where: { rackId: rackId },
|
||||
attributes: ['deviceId']
|
||||
});
|
||||
|
||||
const deviceIds = devices.map(d => d.deviceId);
|
||||
|
||||
if (deviceIds.length === 0) {
|
||||
return res.json([]);
|
||||
}
|
||||
|
||||
// 2. 查找这些设备参与的所有接线
|
||||
const cables = await Cable.findAll({
|
||||
where: {
|
||||
[Op.or]: [
|
||||
{ sourceDeviceId: { [Op.in]: deviceIds } },
|
||||
{ targetDeviceId: { [Op.in]: deviceIds } }
|
||||
]
|
||||
},
|
||||
include: [
|
||||
{
|
||||
model: Device,
|
||||
as: 'sourceDevice',
|
||||
attributes: ['deviceId', 'name', 'type', 'rackId']
|
||||
},
|
||||
{
|
||||
model: Device,
|
||||
as: 'targetDevice',
|
||||
attributes: ['deviceId', 'name', 'type', 'rackId']
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
res.json(cables);
|
||||
} catch (error) {
|
||||
console.error('获取机柜接线失败:', error);
|
||||
res.status(500).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/', async (req, res) => {
|
||||
try {
|
||||
const { cableId, sourceDeviceId, sourcePort, targetDeviceId, targetPort, cableType, cableLength, status, description } = req.body;
|
||||
|
||||
Reference in New Issue
Block a user