feat: 根据网元显示特有菜单

This commit is contained in:
TsMask
2025-05-07 15:45:54 +08:00
parent 2c2ca82442
commit d3efefe7c5
58 changed files with 1110 additions and 1377 deletions

View File

@@ -8,9 +8,9 @@ import {
RESULT_CODE_SUCCESS,
} from '@/constants/result-constants';
import TerminalSSHView from '@/components/TerminalSSHView/index.vue';
import useNeInfoStore from '@/store/modules/neinfo';
import useNeListStore from '@/store/modules/ne_list';
import { iperfI, iperfV } from '@/api/tool/iperf';
const neInfoStore = useNeInfoStore();
const neListStore = useNeListStore();
const { t } = useI18n();
/**网元参数 */
@@ -66,7 +66,11 @@ async function fnIPerf() {
});
return;
}
if (state.dataType === 'options' && state.data.mode === 'client' && state.data.host === '') {
if (
state.dataType === 'options' &&
state.data.mode === 'client' &&
state.data.host === ''
) {
message.warning({
content: 'Please fill in the Host',
duration: 2,
@@ -229,29 +233,16 @@ function fnMessage(res: Record<string, any>) {
/**钩子函数,界面打开初始化*/
onMounted(() => {
// 获取网元网元列表
neInfoStore.fnNelist().then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
if (res.data.length > 0) {
// 过滤不可用的网元
for (const item of neInfoStore.getNeCascaderOptions) {
neCascaderOptions.value.push(item);
}
if (neCascaderOptions.value.length === 0) {
message.warning({
content: t('common.noData'),
duration: 2,
});
return;
}
}
} else {
message.warning({
content: t('common.noData'),
duration: 2,
});
}
});
for (const item of neListStore.getNeCascaderOptions) {
neCascaderOptions.value.push(item); // 过滤不可用的网元
}
if (neCascaderOptions.value.length === 0) {
message.warning({
content: t('common.noData'),
duration: 2,
});
return;
}
});
/**钩子函数,界面关闭*/

View File

@@ -8,9 +8,9 @@ import {
RESULT_CODE_SUCCESS,
} from '@/constants/result-constants';
import TerminalSSHView from '@/components/TerminalSSHView/index.vue';
import useNeInfoStore from '@/store/modules/neinfo';
import useNeListStore from '@/store/modules/ne_list';
import { pingV } from '@/api/tool/ping';
const neInfoStore = useNeInfoStore();
const neListStore = useNeListStore();
const { t } = useI18n();
/**网元参数 */
@@ -187,29 +187,16 @@ function fnMessage(res: Record<string, any>) {
/**钩子函数,界面打开初始化*/
onMounted(() => {
// 获取网元网元列表
neInfoStore.fnNelist().then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
if (res.data.length > 0) {
// 过滤不可用的网元
for (const item of neInfoStore.getNeCascaderOptions) {
neCascaderOptions.value.push(item);
}
if (neCascaderOptions.value.length === 0) {
message.warning({
content: t('common.noData'),
duration: 2,
});
return;
}
}
} else {
message.warning({
content: t('common.noData'),
duration: 2,
});
}
});
for (const item of neListStore.getNeCascaderOptions) {
neCascaderOptions.value.push(item); // 过滤不可用的网元
}
if (neCascaderOptions.value.length === 0) {
message.warning({
content: t('common.noData'),
duration: 2,
});
return;
}
});
/**钩子函数,界面关闭*/

View File

@@ -5,14 +5,16 @@ import { ColumnsType } from 'ant-design-vue/es/table';
import { Modal, message } from 'ant-design-vue/es';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { delNeHost, listNeHost } from '@/api/ne/neHost';
import useNeListStore from '@/store/modules/ne_list';
import useDictStore from '@/store/modules/dict';
import useI18n from '@/hooks/useI18n';
const neListStore = useNeListStore();
const { getDict } = useDictStore();
const { t } = useI18n();
const EditModal = defineAsyncComponent(
() => import('@/views/ne/neHost/components/EditModal.vue')
);
const emit = defineEmits(['modal','link']);
const emit = defineEmits(['modal', 'link']);
/**字典数据 */
let dict: {
@@ -35,7 +37,7 @@ let queryParams = reactive({
/**分组 */
groupId: undefined,
/**名称 */
title: '',
title: 'OMC',
/**当前页数 */
pageNum: 1,
/**每页条数 */
@@ -144,7 +146,7 @@ function fnGetList(pageNum?: number) {
queryParams.pageNum = pageNum;
}
listNeHost(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
if (res.code === RESULT_CODE_SUCCESS) {
const { total, rows } = res.data;
tablePagination.total = total;
tableState.data = rows;
@@ -185,7 +187,7 @@ let modalState: ModalStateType = reactive({
function fnModalVisibleByEdit(roleId?: undefined) {
modalState.id = roleId;
modalState.openByEdit = true;
emit('modal');
emit('modal');
}
/**
@@ -286,7 +288,17 @@ onMounted(() => {
</template>
<!-- 插槽-卡片右侧 -->
<template #extra> </template>
<template #extra>
<a-auto-complete
v-model:value="queryParams.title"
:options="neListStore.getNeSelectOtions"
allow-clear
size="small"
:placeholder="t('common.inputPlease')"
@change="fnGetList(1)"
style="width: 180px"
/>
</template>
<!-- 表格列表 -->
<a-table
@@ -325,10 +337,7 @@ onMounted(() => {
</a-tooltip>
<a-tooltip v-if="record.groupId !== '1'">
<template #title>{{ t('common.deleteText') }}</template>
<a-button
type="link"
@click.prevent="fnRecordDelete(record.id)"
>
<a-button type="link" @click.prevent="fnRecordDelete(record.id)">
<template #icon><DeleteOutlined /></template>
</a-button>
</a-tooltip>