diff --git a/src/views/ne/neConfig/hooks/useArrayImport.ts b/src/views/ne/neConfig/hooks/useArrayImport.ts index 419a0dc4..cd1dfa98 100644 --- a/src/views/ne/neConfig/hooks/useArrayImport.ts +++ b/src/views/ne/neConfig/hooks/useArrayImport.ts @@ -24,7 +24,7 @@ export default function useArrayImport({ fileetx: '.xlsx', itemKey: 'index', item: (row: Record) => { - const index = row['Index'] || 0; + const index = row['Index'] ?? -1; return { imeiPrefixValue: `${row['IMEI Prefix']}`, index: parseInt(index), @@ -36,7 +36,7 @@ export default function useArrayImport({ fileetx: '.xlsx', itemKey: 'index', item: (row: Record) => { - const index = row['Index'] || 0; + const index = row['Index'] ?? -1; return { imsiValue: `${row['IMSI Value']}`, imeiValue: `${row['IMEI Value/Prefix']}`, @@ -51,7 +51,7 @@ export default function useArrayImport({ fileetx: '.xlsx', itemKey: 'index', item: (row: Record) => { - const index = row['Index'] || 0; + const index = row['Index'] ?? -1; return { imei: `${row['IMEI']}`, index: parseInt(index), @@ -128,7 +128,7 @@ export default function useArrayImport({ importState.loading = true; for (const row of rows) { const rowItem = importState.item(row); - const rowKey = rowItem[importState.itemKey] || -1; + const rowKey = rowItem[importState.itemKey]; let result: any = null; // 检查index是否定义 const has = arrayState.columnsData.find(