feat:BA UE部分按钮权限分配

This commit is contained in:
zhongzm
2025-08-29 16:18:26 +08:00
parent 3aa6822a72
commit 3389fbad53
6 changed files with 59 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { reactive, ref, onMounted, toRaw } from 'vue';
import { reactive, ref, onMounted, toRaw, computed } from 'vue';
import { PageContainer } from 'antdv-pro-layout';
import { ProModal } from 'antdv-pro-modal';
import { message, Modal, Form, TableColumnsType } from 'ant-design-vue/es';
@@ -24,8 +24,16 @@ import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { saveAs } from 'file-saver';
import { uploadFileToNE } from '@/api/tool/file';
import { hasPermissions } from '@/plugins/auth-user';
const { t } = useI18n();
// 计算是否至少拥有一个批量操作权限
const hasAnyBatchPermission = computed(() => {
return hasPermissions(['neUser:pcf:add']) ||
hasPermissions(['neUser:pcf:edit']) ||
hasPermissions(['neUser:pcf:delete']);
});
/**网元参数 */
let neOtions = ref<Record<string, any>[]>([]);
@@ -727,7 +735,7 @@ onMounted(() => {
<a-col :lg="6" :md="12" :xs="24">
<a-form-item>
<a-space :size="8">
<a-button type="primary" @click.prevent="fnGetList()">
<a-button type="primary" @click.prevent="fnGetList()" >
<template #icon>
<SearchOutlined />
</template>
@@ -750,7 +758,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="['neUser:pcf:add']">
<template #icon>
<PlusOutlined />
</template>
@@ -763,27 +771,28 @@ onMounted(() => {
:disabled="tableState.selectedRowKeys.length <= 0"
:loading="modalState.confirmLoading"
@click.prevent="fnRecordDelete('0')"
v-perms:has="['neUser:pcf:delete']"
>
<template #icon><DeleteOutlined /></template>
{{ t('views.neUser.pcf.checkDel') }}
</a-button>
<a-dropdown trigger="click">
<a-dropdown trigger="click" v-if="hasAnyBatchPermission">
<a-button>
{{ t('views.neUser.pcf.batchOper') }}
<DownOutlined />
</a-button>
<template #overlay>
<a-menu @click="({ key }:any) => fnModalVisibleByBatch(key)">
<a-menu-item key="add">
<a-menu-item key="add" v-if="hasPermissions(['neUser:pcf:add'])">
<PlusOutlined />
{{ t('views.neUser.pcf.batchAddText') }}
</a-menu-item>
<a-menu-item key="update">
<a-menu-item key="update" v-if="hasPermissions(['neUser:pcf:edit'])">
<FormOutlined />
{{ t('views.neUser.pcf.batchUpdateText') }}
</a-menu-item>
<a-menu-item key="delete">
<a-menu-item key="delete" v-if="hasPermissions(['neUser:pcf:delete'])">
<DeleteOutlined />
{{ t('views.neUser.pcf.batchDelText') }}
</a-menu-item>
@@ -791,7 +800,7 @@ onMounted(() => {
</template>
</a-dropdown>
<a-button type="dashed" @click.prevent="fnModalUploadImportOpen">
<a-button type="dashed" @click.prevent="fnModalUploadImportOpen" v-perms:has="['neUser:pcf:import']">
<template #icon><ImportOutlined /></template>
{{ t('views.neUser.pcf.import') }}
</a-button>
@@ -802,7 +811,7 @@ onMounted(() => {
ok-type="default"
@confirm="fnExportList('txt')"
>
<a-button type="dashed">
<a-button type="dashed" v-perms:has="['neUser:pcf:export']">
<template #icon><ExportOutlined /></template>
{{ t('views.neUser.pcf.export') }}
</a-button>
@@ -891,6 +900,7 @@ onMounted(() => {
<a-button
type="link"
@click.prevent="fnModalVisibleByEdit(record)"
v-perms:has="['neUser:pcf:edit']"
>
<template #icon>
<FormOutlined />
@@ -902,6 +912,7 @@ onMounted(() => {
<a-button
type="link"
@click.prevent="fnRecordDelete(record.imsi)"
v-perms:has="['neUser:pcf:delete']"
>
<template #icon>
<DeleteOutlined />