feat: 添加空闲设备状态支持并优化耗材导入功能
refactor(设备管理): 重构状态筛选和高级搜索界面 perf(机柜管理): 优化U位计算方式为基于设备高度 fix(耗材管理): 修复导入时库存计算不准确的问题 style(耗材统计): 调整表格样式和实时刷新功能 docs: 更新设备状态映射包含空闲状态
This commit is contained in:
@@ -104,7 +104,8 @@ const defaultDeviceFields = [
|
||||
{ value: 'running', label: '运行中' },
|
||||
{ value: 'maintenance', label: '维护中' },
|
||||
{ value: 'offline', label: '离线' },
|
||||
{ value: 'fault', label: '故障' }
|
||||
{ value: 'fault', label: '故障' },
|
||||
{ value: 'idle', label: '空闲' }
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -176,6 +177,18 @@ async function initDeviceFields() {
|
||||
if (field.options && !existingField.options) {
|
||||
await existingField.update({ options: field.options });
|
||||
console.log(`更新字段 options: ${field.displayName}`);
|
||||
} else if (field.options && existingField.options) {
|
||||
// 如果系统字段已有 options,检查是否缺少默认选项,补充缺失的选项
|
||||
const existingValues = existingField.options.map(o => o.value);
|
||||
const defaultValues = field.options.map(o => o.value);
|
||||
const missingOptions = field.options.filter(o => !existingValues.includes(o.value));
|
||||
if (missingOptions.length > 0) {
|
||||
const updatedOptions = [...existingField.options, ...missingOptions];
|
||||
await existingField.update({ options: updatedOptions });
|
||||
console.log(`补充缺失的 options: ${field.displayName},新增: ${missingOptions.map(o => o.label).join(', ')}`);
|
||||
} else {
|
||||
console.log(`跳过已存在字段: ${field.displayName}`);
|
||||
}
|
||||
} else {
|
||||
console.log(`跳过已存在字段: ${field.displayName}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user