feat(线缆管理): 新增向导式接线创建功能

- 新增四步向导流程,简化接线创建过程
- 添加线缆标签、颜色、安装信息等新字段
- 实现端口可视化面板和冲突检测功能
- 新增耗材日志设备关联字段
- 添加耗材导入后台任务管理
- 更新线缆管理文档和使用指南
This commit is contained in:
zhang1106
2026-03-31 14:34:34 +08:00
parent 5d972799f2
commit 06e3b56469
16 changed files with 3914 additions and 105 deletions
+42
View File
@@ -0,0 +1,42 @@
const { sequelize } = require('../db');
const Cable = require('../models/Cable');
async function migrateCableFields() {
try {
console.log('开始迁移 Cable 模型字段...');
// 检查字段是否已存在
const [results] = await sequelize.query('PRAGMA table_info(cables)');
const existingColumns = results.map(row => row.name);
const newColumns = [
{ name: 'cableLabel', type: 'VARCHAR(255)' },
{ name: 'cableColor', type: 'VARCHAR(50)' },
{ name: 'installedBy', type: 'VARCHAR(100)' },
{ name: 'installedAt', type: 'DATETIME' },
{ name: 'lastTestedAt', type: 'DATETIME' },
];
for (const column of newColumns) {
if (!existingColumns.includes(column.name)) {
console.log(`添加字段: ${column.name}`);
await sequelize.query(`ALTER TABLE cables ADD COLUMN ${column.name} ${column.type}`);
} else {
console.log(`字段已存在: ${column.name}`);
}
}
console.log('迁移完成!');
console.log('\n新增字段:');
console.log(' - cableLabel: 线缆标签/编号');
console.log(' - cableColor: 线缆颜色(便于识别)');
console.log(' - installedBy: 安装人');
console.log(' - installedAt: 安装时间');
console.log(' - lastTestedAt: 上次测试时间');
} catch (error) {
console.error('迁移失败:', error);
process.exit(1);
}
}
migrateCableFields();