feat: AMF/MME对应的IMEI白名单模板去除index

This commit is contained in:
TsMask
2025-06-24 17:13:57 +08:00
parent 5704ff09c3
commit 1566392c19
5 changed files with 22 additions and 13 deletions

View File

@@ -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 {

View File

@@ -22,21 +22,23 @@ export default function useArrayImport({
imeiWhitelist: {
filename: 'import_amf_imeiWhitelist_template',
fileetx: '.xlsx',
itemKey: 'imeiPrefixValue',
item: (row: Record<string, any>) => {
return {
imeiPrefixValue: row['IMEI Prefix'],
index: row['Index'],
index: 0,
};
},
},
whitelist: {
filename: 'import_amf_whitelist_template',
fileetx: '.xlsx',
itemKey: 'imsiValue',
item: (row: Record<string, any>) => {
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<string, any>) => {
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);
}