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

This commit is contained in:
TsMask
2024-11-15 19:53:45 +08:00
parent 045a25f3ae
commit 1511792e3b
2 changed files with 13 additions and 3 deletions

View File

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

View File

@@ -7,6 +7,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();
@@ -139,6 +140,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({
@@ -280,9 +290,7 @@ onMounted(() => {
<a-button
type="dashed"
:disabled="state.selectedRowKeys.length > 1"
@click.prevent="
() => (state.openByMoreFile = !state.openByMoreFile)
"
@click.prevent="() => (state.openByMoreFile = !state.openByMoreFile)"
>
<template #icon><UploadOutlined /></template>
{{ t('views.ne.neSoftware.upload') }}