feat:ue和ne模块权限按钮

This commit is contained in:
zhongzm
2025-09-12 18:52:50 +08:00
parent 02b12d76a7
commit 510e3e1006
10 changed files with 104 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { reactive, ref, onMounted, toRaw, defineAsyncComponent } from 'vue';
import { reactive, ref, onMounted, toRaw, defineAsyncComponent,computed } from 'vue';
import { PageContainer } from 'antdv-pro-layout';
import { Modal, TableColumnsType, message } from 'ant-design-vue/es';
import { SizeType } from 'ant-design-vue/es/config-provider';
@@ -11,6 +11,7 @@ import { listNeSoftware, delNeSoftware } from '@/api/ne/neSoftware';
import { parseDateToStr } from '@/utils/date-utils';
import { downloadFile } from '@/api/tool/file';
import { saveAs } from 'file-saver';
import { hasPermissions } from '@/plugins/auth-user';
const neListStore = useNeListStore();
const { t } = useI18n();
@@ -21,7 +22,10 @@ const EditModal = defineAsyncComponent(
const UploadMoreFile = defineAsyncComponent(
() => import('./components/UploadMoreFile.vue')
);
const hasAnyBatchPermission = computed(() => {
return hasPermissions(['ne:neSoftware:download']) ||
hasPermissions(['ne:neSoftware:delete']) ;
});
/**查询参数 */
let queryParams = reactive({
/**网元类型 */
@@ -400,7 +404,7 @@ onMounted(() => {
<!-- 插槽-卡片左侧侧 -->
<template #title>
<a-space :size="8" align="center">
<a-button type="primary" @click.prevent="fnModalVisibleByEdit(0)">
<a-button type="primary" @click.prevent="fnModalVisibleByEdit(0)" v-perms:has="['ne:neSoftware:upload']">
<template #icon><UploadOutlined /></template>
{{ t('views.ne.neSoftware.upload') }}
</a-button>
@@ -410,6 +414,7 @@ onMounted(() => {
@click.prevent="
() => (modalState.openByMoreFile = !modalState.openByMoreFile)
"
v-perms:has="['ne:neSoftware:upload']"
>
<template #icon><UploadOutlined /></template>
<template v-if="tableState.selectedRowOne.neType">
@@ -426,6 +431,7 @@ onMounted(() => {
:disabled="tableState.selectedRowKeys.length <= 0"
:loading="modalState.confirmLoading"
@click.prevent="fnRecordDelete('0')"
v-perms:has="['ne:neSoftware:delete']"
>
<template #icon><DeleteOutlined /></template>
{{ t('common.deleteText') }}
@@ -521,6 +527,7 @@ onMounted(() => {
<a-button
type="link"
@click.prevent="fnModalVisibleByEdit(record.id)"
v-perms:has="['ne:neSoftware:edit']"
>
<template #icon> <ProfileOutlined /></template>
</a-button>
@@ -528,17 +535,17 @@ onMounted(() => {
<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="download">
<a-menu-item key="download" v-if="hasPermissions(['ne:neSoftware:download'])">
<DownloadOutlined />
{{ t('common.downloadText') }}
</a-menu-item>
<a-menu-item key="delete">
<a-menu-item key="delete" v-if="hasPermissions(['ne:neSoftware:delete'])">
<DeleteOutlined />
{{ t('common.deleteText') }}
</a-menu-item>