feat: 参数配置AMF导入Index字段存在更新,不存在默认新增

This commit is contained in:
TsMask
2025-07-21 17:12:19 +08:00
parent d37fd4deae
commit f8bc9fc622
4 changed files with 10 additions and 7 deletions

View File

@@ -22,23 +22,25 @@ export default function useArrayImport({
imeiWhitelist: {
filename: 'import_amf_imeiWhitelist_template',
fileetx: '.xlsx',
itemKey: 'imeiPrefixValue',
itemKey: 'index',
item: (row: Record<string, any>) => {
const index = row['Index'] || 0;
return {
imeiPrefixValue: `${row['IMEI Prefix']}`,
index: 0,
index: parseInt(index),
};
},
},
whitelist: {
filename: 'import_amf_whitelist_template',
fileetx: '.xlsx',
itemKey: 'imsiValue',
itemKey: 'index',
item: (row: Record<string, any>) => {
const index = row['Index'] || 0;
return {
imsiValue: `${row['IMSI Value']}`,
imeiValue: `${row['IMEI Value/Prefix']}`,
index: 0,
index: parseInt(index),
};
},
},
@@ -47,11 +49,12 @@ export default function useArrayImport({
white_list: {
filename: 'import_mme_imeiWhitelist_template',
fileetx: '.xlsx',
itemKey: 'imei',
itemKey: 'index',
item: (row: Record<string, any>) => {
const index = row['Index'] || 0;
return {
imei: `${row['IMEI']}`,
index: 0,
index: parseInt(index),
};
},
},
@@ -125,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];
const rowKey = rowItem[importState.itemKey] || -1;
let result: any = null;
// 检查index是否定义
const has = arrayState.columnsData.find(