feat(工单系统): 实现完整的工单管理功能
添加工单系统核心功能,包括: - 工单模型及相关API接口 - 故障分类管理 - 工单操作记录 - 前端工单管理页面 - 统计报表功能 - 测试框架支持 后端新增工单相关路由和模型,前端添加工单管理界面和统计报表
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const { sequelize } = require('../db');
|
||||
|
||||
const FaultCategory = sequelize.define('FaultCategory', {
|
||||
categoryId: {
|
||||
type: DataTypes.STRING,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
unique: true
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
comment: '分类名称'
|
||||
},
|
||||
description: {
|
||||
type: DataTypes.TEXT,
|
||||
comment: '分类说明 - 说明此类故障代表什么问题'
|
||||
},
|
||||
priority: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 0,
|
||||
comment: '排序优先级'
|
||||
},
|
||||
defaultPriority: {
|
||||
type: DataTypes.STRING,
|
||||
defaultValue: 'medium',
|
||||
comment: '默认优先级: critical/high/medium/low'
|
||||
},
|
||||
expectedDuration: {
|
||||
type: DataTypes.INTEGER,
|
||||
comment: '预计处理时长(小时)'
|
||||
},
|
||||
solutions: {
|
||||
type: DataTypes.JSON,
|
||||
defaultValue: [],
|
||||
comment: '常见解决方案'
|
||||
},
|
||||
isSystem: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
defaultValue: false,
|
||||
comment: '是否系统内置分类'
|
||||
},
|
||||
isActive: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
defaultValue: true,
|
||||
comment: '是否启用'
|
||||
},
|
||||
metadata: {
|
||||
type: DataTypes.JSON,
|
||||
defaultValue: {},
|
||||
comment: '扩展字段'
|
||||
}
|
||||
}, {
|
||||
tableName: 'fault_categories',
|
||||
timestamps: true,
|
||||
indexes: [
|
||||
{ fields: ['name'] },
|
||||
{ fields: ['isActive'] },
|
||||
{ fields: ['priority'] }
|
||||
]
|
||||
});
|
||||
|
||||
module.exports = FaultCategory;
|
||||
Reference in New Issue
Block a user