refactor: 统一代码风格并迁移至 ESLint 新配置
style(backend): 格式化模型文件代码 style(frontend): 调整组件代码格式 chore: 删除旧 ESLint 配置并添加新配置 refactor(backend): 重构模型定义语法 style: 统一箭头函数和对象属性简写
This commit is contained in:
+82
-32
@@ -23,7 +23,7 @@ async function syncDatabase() {
|
||||
|
||||
await sequelize.sync({
|
||||
force: false,
|
||||
alter: false
|
||||
alter: false,
|
||||
});
|
||||
console.log('数据库表结构同步完成');
|
||||
}
|
||||
@@ -61,7 +61,7 @@ async function syncConsumableModels() {
|
||||
ConsumableLog.sync(),
|
||||
ConsumableCategory.sync(),
|
||||
ConsumableRecord.sync(),
|
||||
ConsumableLogArchive.sync()
|
||||
ConsumableLogArchive.sync(),
|
||||
]);
|
||||
console.log('耗材模型同步完成');
|
||||
}
|
||||
@@ -71,11 +71,7 @@ async function syncInventoryModels() {
|
||||
const InventoryTask = require('./models/InventoryTask');
|
||||
const InventoryRecord = require('./models/InventoryRecord');
|
||||
|
||||
await Promise.all([
|
||||
InventoryPlan.sync(),
|
||||
InventoryTask.sync(),
|
||||
InventoryRecord.sync()
|
||||
]);
|
||||
await Promise.all([InventoryPlan.sync(), InventoryTask.sync(), InventoryRecord.sync()]);
|
||||
console.log('盘点模型同步完成');
|
||||
}
|
||||
|
||||
@@ -114,16 +110,66 @@ async function initFaultCategories() {
|
||||
const FaultCategory = require('./models/FaultCategory');
|
||||
|
||||
const defaultCategories = [
|
||||
{ name: '系统故障', description: '操作系统、应用程序等系统软件的故障问题', priority: 1, defaultPriority: 'high' },
|
||||
{ name: '硬件故障', description: '物理设备、服务器、存储等硬件设备的故障问题', priority: 2, defaultPriority: 'high' },
|
||||
{ name: '网络故障', description: '网络连接、交换机、路由器等网络相关故障', priority: 3, defaultPriority: 'high' },
|
||||
{ name: '软件故障', description: '应用程序错误、软件兼容性等问题', priority: 4, defaultPriority: 'medium' },
|
||||
{ name: '安全事件', description: '安全漏洞、入侵检测、权限异常等安全问题', priority: 5, defaultPriority: 'urgent' },
|
||||
{ name: '性能问题', description: '系统响应慢、资源利用率高等性能问题', priority: 6, defaultPriority: 'medium' },
|
||||
{ name: '配置变更', description: '系统配置、软件配置等变更需求', priority: 7, defaultPriority: 'low' },
|
||||
{ name: '例行维护', description: '定期维护、巡检、更新等计划性工作', priority: 8, defaultPriority: 'low' },
|
||||
{ name: '数据问题', description: '数据错误、数据丢失、数据同步等数据相关问题', priority: 9, defaultPriority: 'high' },
|
||||
{ name: '其他问题', description: '无法归类的其他问题', priority: 99, defaultPriority: 'medium' }
|
||||
{
|
||||
name: '系统故障',
|
||||
description: '操作系统、应用程序等系统软件的故障问题',
|
||||
priority: 1,
|
||||
defaultPriority: 'high',
|
||||
},
|
||||
{
|
||||
name: '硬件故障',
|
||||
description: '物理设备、服务器、存储等硬件设备的故障问题',
|
||||
priority: 2,
|
||||
defaultPriority: 'high',
|
||||
},
|
||||
{
|
||||
name: '网络故障',
|
||||
description: '网络连接、交换机、路由器等网络相关故障',
|
||||
priority: 3,
|
||||
defaultPriority: 'high',
|
||||
},
|
||||
{
|
||||
name: '软件故障',
|
||||
description: '应用程序错误、软件兼容性等问题',
|
||||
priority: 4,
|
||||
defaultPriority: 'medium',
|
||||
},
|
||||
{
|
||||
name: '安全事件',
|
||||
description: '安全漏洞、入侵检测、权限异常等安全问题',
|
||||
priority: 5,
|
||||
defaultPriority: 'urgent',
|
||||
},
|
||||
{
|
||||
name: '性能问题',
|
||||
description: '系统响应慢、资源利用率高等性能问题',
|
||||
priority: 6,
|
||||
defaultPriority: 'medium',
|
||||
},
|
||||
{
|
||||
name: '配置变更',
|
||||
description: '系统配置、软件配置等变更需求',
|
||||
priority: 7,
|
||||
defaultPriority: 'low',
|
||||
},
|
||||
{
|
||||
name: '例行维护',
|
||||
description: '定期维护、巡检、更新等计划性工作',
|
||||
priority: 8,
|
||||
defaultPriority: 'low',
|
||||
},
|
||||
{
|
||||
name: '数据问题',
|
||||
description: '数据错误、数据丢失、数据同步等数据相关问题',
|
||||
priority: 9,
|
||||
defaultPriority: 'high',
|
||||
},
|
||||
{
|
||||
name: '其他问题',
|
||||
description: '无法归类的其他问题',
|
||||
priority: 99,
|
||||
defaultPriority: 'medium',
|
||||
},
|
||||
];
|
||||
|
||||
for (const cat of defaultCategories) {
|
||||
@@ -136,7 +182,7 @@ async function initFaultCategories() {
|
||||
expectedDuration: 120,
|
||||
solutions: [],
|
||||
isSystem: true,
|
||||
isActive: true
|
||||
isActive: true,
|
||||
});
|
||||
console.log(`创建故障分类: ${cat.name}`);
|
||||
}
|
||||
@@ -234,18 +280,22 @@ app.use('/api/dangerous-operations', dangerousOperationsRoutes);
|
||||
|
||||
app.use('/uploads', express.static('uploads'));
|
||||
|
||||
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(specs, {
|
||||
customCss: customCSS,
|
||||
customSiteTitle: 'IDC设备管理系统 API文档',
|
||||
swaggerOptions: {
|
||||
persistAuthorization: true,
|
||||
displayRequestDuration: true,
|
||||
docExpansion: 'none',
|
||||
deepLinking: true,
|
||||
defaultModelsExpandDepth: -1,
|
||||
defaultModelExpandDepth: 2
|
||||
}
|
||||
}));
|
||||
app.use(
|
||||
'/api-docs',
|
||||
swaggerUi.serve,
|
||||
swaggerUi.setup(specs, {
|
||||
customCss: customCSS,
|
||||
customSiteTitle: 'IDC设备管理系统 API文档',
|
||||
swaggerOptions: {
|
||||
persistAuthorization: true,
|
||||
displayRequestDuration: true,
|
||||
docExpansion: 'none',
|
||||
deepLinking: true,
|
||||
defaultModelsExpandDepth: -1,
|
||||
defaultModelExpandDepth: 2,
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
app.get('/api-docs', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, 'swagger_index.html'));
|
||||
@@ -279,10 +329,10 @@ app.get('/api', (req, res) => {
|
||||
roles: '/api/roles',
|
||||
systemSettings: '/api/system-settings',
|
||||
background: '/api/background',
|
||||
inventory: '/api/inventory'
|
||||
inventory: '/api/inventory',
|
||||
},
|
||||
health: '/health',
|
||||
documentation: '/docs/api/README.md'
|
||||
documentation: '/docs/api/README.md',
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user