fix: 修复后端12个+前端5个高优先级问题

后端:
- devices.js: 修复 newRackId 重复声明、批量移动加事务、ID生成改MAX聚合
- tickets.js: 添加工单状态机校验、req.body白名单过滤
- roles.js: init-roles 添加 authMiddleware
- backup.js: 备份列表只读4KB头部,压缩文件超1MB跳过
- consumables.js: SN查询改用数据库LIKE替代全表扫描
- consumableRecords.js: 出入库加 SELECT FOR UPDATE 行级锁
- inventory.js: not_found 状态判断从 abnormal if 内移到 else if
- idleDevices.js: 删除重复的 batch-restore 路由定义(182行)
- cables.js: 接线冲突检测增加反向端口检查

前端:
- AuthContext.jsx: 初始化时调用 fetchProfile 验证token、Error提取message
- api/index.js: backupAPI.download 返回Promise、checkAdmin改POST
- Login.jsx: checkIsFirstUser 静默处理错误
- DeviceManagement.jsx: 导出 currentPage scope 使用 currentPageDevices
This commit is contained in:
zhang96110
2026-04-01 07:27:19 +00:00
parent 1d7a83bbe8
commit de7da77c11
13 changed files with 122 additions and 223 deletions
+2 -2
View File
@@ -91,7 +91,7 @@ api.interceptors.response.use(
);
export const authAPI = {
checkAdmin: () => api.get('/auth/check-admin'),
checkAdmin: () => api.post('/auth/check-admin'),
register: data => api.post('/auth/register', data),
login: data => api.post('/auth/login', data),
unlock: data => api.post('/auth/unlock', data),
@@ -185,7 +185,7 @@ export const backupAPI = {
create: (data = {}) => api.post('/backup', data),
validate: filename => api.get(`/backup/validate/${filename}`),
restore: (filename, options = {}) => api.post('/backup/restore', { filename, options }),
download: filename => `/api/backup/download/${filename}`,
download: filename => api.get(`/backup/download/${filename}`, { responseType: 'blob' }),
delete: filename => api.delete(`/backup/${filename}`),
upload: file => {
const formData = new FormData();