feat(floorplan): 新增机房平面图功能模块
refactor(models): 为Room和Rack模型添加布局相关字段 feat(routes): 实现机房平面图相关API接口 feat(components): 添加平面图编辑器、画布渲染及交互组件 feat(hooks): 实现平面图数据管理和状态管理 feat(pages): 新增机房平面图页面入口 style(components): 优化平面图组件样式和交互体验
This commit is contained in:
+13
-1
@@ -19,7 +19,7 @@ const Rack = sequelize.define(
|
||||
height: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 45, // 标准机柜高度(U数)
|
||||
defaultValue: 45,
|
||||
},
|
||||
maxPower: {
|
||||
type: DataTypes.FLOAT,
|
||||
@@ -41,6 +41,18 @@ const Rack = sequelize.define(
|
||||
key: 'roomId',
|
||||
},
|
||||
},
|
||||
rowPos: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: null,
|
||||
},
|
||||
colPos: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: null,
|
||||
},
|
||||
facing: {
|
||||
type: DataTypes.STRING,
|
||||
defaultValue: 'front',
|
||||
},
|
||||
},
|
||||
{
|
||||
tableName: 'racks',
|
||||
|
||||
@@ -65,6 +65,18 @@ const Room = sequelize.define(
|
||||
description: {
|
||||
type: DataTypes.TEXT,
|
||||
},
|
||||
gridRows: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 10,
|
||||
},
|
||||
gridCols: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 10,
|
||||
},
|
||||
layoutConfig: {
|
||||
type: DataTypes.JSON,
|
||||
defaultValue: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
tableName: 'rooms',
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
const Room = require('./Room');
|
||||
const Rack = require('./Rack');
|
||||
const Device = require('./Device');
|
||||
const DeviceField = require('./DeviceField');
|
||||
const DevicePort = require('./DevicePort');
|
||||
const NetworkCard = require('./NetworkCard');
|
||||
const Cable = require('./Cable');
|
||||
const Ticket = require('./Ticket');
|
||||
const InventoryRecord = require('./InventoryRecord');
|
||||
const Warehouse = require('./Warehouse');
|
||||
|
||||
// 建立Rack与Device的关联关系(Device模型中已有反向关联定义)
|
||||
Rack.hasMany(Device, { foreignKey: 'rackId', as: 'Devices' });
|
||||
|
||||
module.exports = {
|
||||
Room,
|
||||
Rack,
|
||||
Device,
|
||||
DeviceField,
|
||||
DevicePort,
|
||||
NetworkCard,
|
||||
Cable,
|
||||
Ticket,
|
||||
InventoryRecord,
|
||||
Warehouse,
|
||||
};
|
||||
Reference in New Issue
Block a user