feat:Configuration、Performance、MML权限按钮添加

This commit is contained in:
zhongzm
2025-09-04 14:25:26 +08:00
parent f155a0dc8e
commit 4293c611be
7 changed files with 40 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { reactive, onMounted, toRaw, defineAsyncComponent, ref } from 'vue';
import { reactive, onMounted, toRaw, defineAsyncComponent, ref, computed } from 'vue';
import { PageContainer } from 'antdv-pro-layout';
import { message, Modal } from 'ant-design-vue/es';
import { SizeType } from 'ant-design-vue/es/config-provider';
@@ -12,6 +12,7 @@ import { listNeInfo, delNeInfo, stateNeInfo } from '@/api/ne/neInfo';
import { NE_TYPE_LIST } from '@/constants/ne-constants';
import useDictStore from '@/store/modules/dict';
import useNeOptions from './hooks/useNeOptions';
import { hasPermissions } from '@/plugins/auth-user';
const { getDict } = useDictStore();
const { t } = useI18n();
const { fnNeStart, fnNeRestart, fnNeStop, fnNeReload, fnNeLogFile } =
@@ -28,7 +29,15 @@ const BackConfModal = defineAsyncComponent(
() => import('./components/BackConfModal.vue')
);
const backConf = ref(); // 引用句柄,取导出函数
// 计算是否至少拥有一个批量操作权限
const hasAnyBatchPermission = computed(() => {
return hasPermissions(['ne:neInfo:logs']) ||
hasPermissions(['ne:neInfo:start']) ||
hasPermissions(['ne:neInfo:stop'])||
hasPermissions(['ne:neInfo:delete'])||
hasPermissions(['ne:neInfo:export'])||
hasPermissions(['ne:neInfo:import']);
});
/**字典数据 */
let dict: {
/**网元信息状态 */
@@ -498,7 +507,7 @@ onMounted(() => {
<!-- 插槽-卡片左侧侧 -->
<template #title>
<a-space :size="8" align="center">
<a-button type="primary" @click.prevent="fnModalVisibleByEdit()">
<a-button type="primary" @click.prevent="fnModalVisibleByEdit()" v-perms:has="['ne:neInfo:add']">
<template #icon><PlusOutlined /></template>
{{ t('common.addText') }}
</a-button>
@@ -508,6 +517,7 @@ onMounted(() => {
:disabled="tableState.selectedRowKeys.length <= 0"
:loading="modalState.confirmLoading"
@click.prevent="fnRecordDelete('0')"
v-perms:has="['ne:neInfo:delete']"
>
<template #icon><DeleteOutlined /></template>
{{ t('common.deleteText') }}
@@ -588,6 +598,7 @@ onMounted(() => {
<a-button
type="link"
@click.prevent="fnModalVisibleByEdit(record)"
v-perms:has="['ne:neInfo:edit']"
>
<template #icon><FormOutlined /></template>
</a-button>
@@ -599,27 +610,28 @@ onMounted(() => {
<a-button
type="link"
@click.prevent="fnRecordMore('restart', record)"
v-perms:has="['ne:neInfo:restart']"
>
<template #icon><UndoOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip placement="left">
<template #title>{{ t('common.moreText') }}</template>
<a-dropdown placement="bottomRight" trigger="click">
<a-dropdown placement="bottomRight" trigger="click" v-if="hasAnyBatchPermission">
<a-button type="link">
<template #icon><EllipsisOutlined /> </template>
</a-button>
<template #overlay>
<a-menu @click="({ key }:any) => fnRecordMore(key, record)">
<a-menu-item key="log">
<a-menu-item key="log" v-if="hasPermissions(['ne:neInfo:logs'])">
<FileTextOutlined />
{{ t('views.ne.common.log') }}
</a-menu-item>
<a-menu-item key="start">
<a-menu-item key="start" v-if="hasPermissions(['ne:neInfo:start'])">
<ThunderboltOutlined />
{{ t('views.ne.common.start') }}
</a-menu-item>
<a-menu-item key="stop">
<a-menu-item key="stop" v-if="hasPermissions(['ne:neInfo:stop'])">
<CloseSquareOutlined />
{{ t('views.ne.common.stop') }}
</a-menu-item>
@@ -632,7 +644,7 @@ onMounted(() => {
<SyncOutlined />
{{ t('views.ne.common.reload') }}
</a-menu-item>
<a-menu-item key="delete">
<a-menu-item key="delete" v-if="hasPermissions(['ne:neInfo:delete'])">
<DeleteOutlined />
{{ t('common.deleteText') }}
</a-menu-item>
@@ -644,11 +656,11 @@ onMounted(() => {
{{ t('views.ne.common.oam') }}
</a-menu-item>
<!-- 配置备份 -->
<a-menu-item key="backConfExport">
<a-menu-item key="backConfExport" v-if="hasPermissions(['ne:neInfo:export'])">
<ExportOutlined />
{{ t('views.ne.neInfo.backConf.export') }}
</a-menu-item>
<a-menu-item key="backConfImport">
<a-menu-item key="backConfImport" v-if="hasPermissions(['ne:neInfo:import'])">
<ImportOutlined />
{{ t('views.ne.neInfo.backConf.import') }}
</a-menu-item>