diff --git a/public/neDataImput/import_amf_imeiWhitelist_template.xlsx b/public/neDataImput/import_amf_imeiWhitelist_template.xlsx index 3cf6169b..8716464a 100644 Binary files a/public/neDataImput/import_amf_imeiWhitelist_template.xlsx and b/public/neDataImput/import_amf_imeiWhitelist_template.xlsx differ diff --git a/public/neDataImput/import_amf_whitelist_template.xlsx b/public/neDataImput/import_amf_whitelist_template.xlsx index 509ba8f7..26b66e5a 100644 Binary files a/public/neDataImput/import_amf_whitelist_template.xlsx and b/public/neDataImput/import_amf_whitelist_template.xlsx differ diff --git a/public/neDataImput/import_mme_imeiWhitelist_template.xlsx b/public/neDataImput/import_mme_imeiWhitelist_template.xlsx index d12b25ac..44957994 100644 Binary files a/public/neDataImput/import_mme_imeiWhitelist_template.xlsx and b/public/neDataImput/import_mme_imeiWhitelist_template.xlsx differ diff --git a/src/views/ne/neConfig/hooks/useArrayBatchDel.ts b/src/views/ne/neConfig/hooks/useArrayBatchDel.ts index 148dd7c9..78857c28 100644 --- a/src/views/ne/neConfig/hooks/useArrayBatchDel.ts +++ b/src/views/ne/neConfig/hooks/useArrayBatchDel.ts @@ -39,7 +39,7 @@ export default function useArrayBatch({ batchState.loading = false; batchState.startIndex = 1; batchState.num = 1; - fnActiveConfigNode('#') + fnActiveConfigNode('#'); } async function modalBatchOk() { @@ -73,6 +73,7 @@ export default function useArrayBatch({ duration: 3, }); } + modalBatchClose(); } return { diff --git a/src/views/ne/neConfig/hooks/useArrayImport.ts b/src/views/ne/neConfig/hooks/useArrayImport.ts index 53114a6e..2dd28b68 100644 --- a/src/views/ne/neConfig/hooks/useArrayImport.ts +++ b/src/views/ne/neConfig/hooks/useArrayImport.ts @@ -22,21 +22,23 @@ export default function useArrayImport({ imeiWhitelist: { filename: 'import_amf_imeiWhitelist_template', fileetx: '.xlsx', + itemKey: 'imeiPrefixValue', item: (row: Record) => { return { imeiPrefixValue: row['IMEI Prefix'], - index: row['Index'], + index: 0, }; }, }, whitelist: { filename: 'import_amf_whitelist_template', fileetx: '.xlsx', + itemKey: 'imsiValue', item: (row: Record) => { return { imsiValue: row['IMSI Value'], imeiValue: row['IMEI Value/Prefix'], - index: row['Index'], + index: 0, }; }, }, @@ -45,10 +47,11 @@ export default function useArrayImport({ white_list: { filename: 'import_mme_imeiWhitelist_template', fileetx: '.xlsx', + itemKey: 'imei', item: (row: Record) => { return { imei: row['IMEI'], - index: row['Index'], + index: 0, }; }, }, @@ -60,7 +63,8 @@ export default function useArrayImport({ open: false, msgArr: [] as string[], loading: false, //开始导入 - item: null as any, + itemKey: '', // 解析item的key + item: null as any, // 解析item方法 paramName: '', filename: '', fileetx: '', @@ -69,6 +73,7 @@ export default function useArrayImport({ /**对话框表格信息导入弹出窗口 */ function modalImportOpen(neType: string, paramName: string) { const tmpM = m[neType][paramName]; + importState.itemKey = tmpM.itemKey; importState.item = tmpM.item; importState.paramName = paramName; importState.filename = tmpM.filename; @@ -98,7 +103,7 @@ export default function useArrayImport({ // 获取最大index let index = 0; if (arrayState.columnsData.length <= 0) { - index = 1; + index = 0; } else { const last = arrayState.columnsData[arrayState.columnsData.length - 1]; index = last.index.value + 1; @@ -120,12 +125,15 @@ export default function useArrayImport({ importState.loading = true; for (const row of rows) { const rowItem = importState.item(row); + const rowKey = rowItem[importState.itemKey]; let result: any = null; // 检查index是否定义 - const hasIndex = arrayState.columnsData.find( - (item: any) => item.index.value === rowItem.index + const has = arrayState.columnsData.find( + (item: any) => item[importState.itemKey].value === rowKey ); - if (hasIndex) { + if (has) { + // 已定义则更新 + rowItem.index = has.index.value; result = await editNeConfigData({ neType: neType, neId: neId, @@ -133,9 +141,9 @@ export default function useArrayImport({ paramData: rowItem, loc: `${rowItem.index}`, }); - let msg = `update ${rowItem.index} fail`; + let msg = `index:${rowItem.index} update fail`; if (result.code === RESULT_CODE_SUCCESS) { - msg = `update ${rowItem.index} success`; + msg = `index:${rowItem.index} update success`; } importState.msgArr.push(msg); } else { @@ -147,10 +155,10 @@ export default function useArrayImport({ paramData: Object.assign(rowItem, { index }), loc: `${index}`, }); - let msg = `add ${index} fail`; + let msg = `index:${index} add fail`; if (result.code === RESULT_CODE_SUCCESS) { + msg = `index:${index} add success`; index += 1; - msg = `add ${index} success`; } importState.msgArr.push(msg); }