feat: 添加请求参数验证中间件和设计令牌Hook

feat(validation): 为机房、机柜和设备路由添加Joi验证中间件

feat(hooks): 创建useDesignTokens Hook集中管理主题配置

feat(models): 为耗材模型添加乐观锁version字段和updatedAt索引

feat(3d): 增强3D场景和设备模型视觉效果与交互

refactor: 移除数据备份相关功能并优化代码结构

fix: 修复前端安全日志和密码加密工具

chore: 更新依赖并添加axios和joi库

docs: 更新注释和文档说明

style: 改进代码格式和命名一致性
This commit is contained in:
zhang1106
2026-01-29 16:53:29 +08:00
parent 6d61d6e54c
commit 9e6a3da888
23 changed files with 1518 additions and 1858 deletions
+16 -3
View File
@@ -4,6 +4,17 @@ import { PlusOutlined, EditOutlined, DeleteOutlined, SearchOutlined, EyeOutlined
import axios from 'axios';
import dayjs from 'dayjs';
// 安全地从 localStorage 获取用户信息
const getUserFromStorage = () => {
try {
const userStr = localStorage.getItem('user');
return userStr ? JSON.parse(userStr) : {};
} catch (e) {
console.error('解析用户信息失败:', e);
return {};
}
};
const { Option } = Select;
const { RangePicker } = DatePicker;
const { TextArea } = Input;
@@ -412,7 +423,7 @@ function TicketManagement() {
await axios.put(`/api/tickets/${editingTicket.ticketId}`, ticketData);
message.success('工单更新成功');
} else {
const user = JSON.parse(localStorage.getItem('user') || '{}');
const user = getUserFromStorage();
ticketData.reporterId = user.userId || localStorage.getItem('userId') || 'USER001';
ticketData.reporterName = user.username || '系统用户';
await axios.post('/api/tickets', ticketData);
@@ -457,10 +468,11 @@ function TicketManagement() {
const handleProcessSubmit = useCallback(async (values) => {
try {
const user = getUserFromStorage();
await axios.put(`/api/tickets/${selectedTicket.ticketId}/process`, {
...values,
operatorId: localStorage.getItem('userId'),
operatorName: JSON.parse(localStorage.getItem('user') || '{}').username
operatorName: user.username
});
message.success('工单处理完成');
setProcessingModalVisible(false);
@@ -473,10 +485,11 @@ function TicketManagement() {
const handleStatusChange = useCallback(async (ticketId, newStatus) => {
try {
const user = getUserFromStorage();
await axios.put(`/api/tickets/${ticketId}/status`, {
status: newStatus,
operatorId: localStorage.getItem('userId'),
operatorName: JSON.parse(localStorage.getItem('user') || '{}').username
operatorName: user.username
});
message.success('状态更新成功');
fetchTickets();