fix: 快速开站网元排序进行逐个安装

This commit is contained in:
TsMask
2024-11-15 19:44:03 +08:00
parent 5d7334a4de
commit 0544495d70
2 changed files with 12 additions and 0 deletions

View File

@@ -16,7 +16,9 @@ export const NE_TYPE_LIST = [
'N3IWF',
'MOCNGW',
'SMSC',
'SMSF',
'CBC',
'CHF',
];
/**

View File

@@ -6,6 +6,7 @@ import useI18n from '@/hooks/useI18n';
import useDictStore from '@/store/modules/dict';
import { listNeVersion, operateNeVersion } from '@/api/ne/neVersion';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { NE_TYPE_LIST } from '@/constants/ne-constants';
const { t } = useI18n();
const { getDict } = useDictStore();
@@ -138,6 +139,15 @@ async function fnRecordInstall() {
const selectRows = state.data.filter(item =>
state.selectedRowKeys.includes(item.id)
);
//通过sort进行冒泡排序
selectRows.sort((a: any, b: any) => {
const typeA = NE_TYPE_LIST.indexOf(a.neType);
const typeB = NE_TYPE_LIST.indexOf(b.neType);
if (typeA === -1) return 1; // 如果不在特定顺序中,排到后面
if (typeB === -1) return -1; // 如果不在特定顺序中,排到后面
return typeA - typeB;
});
for (const row of selectRows) {
if (row.newVersion === '-' || row.newVersion === '') {
state.operateDataUpgrade.push({