fix: 按钮权限调整

This commit is contained in:
caiyuchao
2025-08-13 15:39:09 +08:00
parent c401195986
commit ef6da4f3c6
5 changed files with 24 additions and 18 deletions

View File

@@ -1,13 +1,16 @@
<script lang="ts" setup>
import { computed, onMounted, ref } from 'vue';
import { useAccess } from '@vben/access';
import { Page } from '@vben/common-ui';
import { Button, Card, message, Space } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { getAlertPage, updateAlert } from '#/api/alert/alert';
import { getUserPage } from '#/api/system/user';
import { getSimpleUserList } from '#/api/system/user';
const { hasAccessByCodes } = useAccess();
// 表单数据
const formData = ref({
@@ -48,6 +51,10 @@ const formSchema = computed(() => [
mode: 'multiple',
allowClear: true,
showSearch: true,
fieldNames: {
label: 'nickname',
value: 'id',
},
filterOption: (input: string, option: any) => {
return option?.label?.toLowerCase().includes(input.toLowerCase());
},
@@ -140,15 +147,7 @@ function handleReset() {
async function loadUserList() {
try {
// 参考部门管理界面的做法使用getUserPage接口
const { list } = await getUserPage({
pageNo: 1,
pageSize: 100, // 获取前100个用户
});
userOptions.value = list.map((user) => ({
label: user.nickname || user.username,
value: user.id,
}));
userOptions.value = await getSimpleUserList();
} catch {}
}
@@ -182,8 +181,14 @@ onMounted(async () => {
<Form />
<div class="mt-4 flex justify-end">
<Space>
<Button type="primary" @click="handleSubmit">保存</Button>
<Button @click="handleReset">重置</Button>
<Button
type="primary"
@click="handleSubmit"
v-if="hasAccessByCodes(['license:alert:update'])"
>
保存
</Button>
<Button @click="handleReset"> 重置 </Button>
</Space>
</div>
<template #title>

View File

@@ -139,7 +139,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
label: $t('ui.actionTitle.import', [$t('customer.customer')]),
type: 'primary',
icon: ACTION_ICON.UPLOAD,
auth: ['license:customer:export'],
auth: ['license:customer:import'],
onClick: handleImport,
},
]"

View File

@@ -172,7 +172,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
label: $t('license.applyAction', ['License']),
type: 'primary',
icon: ACTION_ICON.ADD,
auth: ['license:license:create'],
auth: ['license:license:apply'],
onClick: onCreate,
},
{
@@ -186,7 +186,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
label: $t('ui.actionTitle.import', ['License']),
type: 'primary',
icon: ACTION_ICON.UPLOAD,
auth: ['license:license:export'],
auth: ['license:license:import'],
onClick: handleImport,
},
]"
@@ -199,6 +199,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
{
label: $t('license.detail'),
type: 'link',
auth: ['license:license:query'],
onClick: onDetail.bind(null, row),
},
{
@@ -231,7 +232,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
label: $t('license.reapply'),
type: 'link',
ifShow: row.status === 3,
auth: ['license:license:query'],
auth: ['license:license:reapply'],
onClick: onReapply.bind(null, row),
},
{

View File

@@ -465,7 +465,7 @@ export function useGridColumns(
{
code: 'progress',
text: $t('project.progress'),
show: hasAccessByCodes(['license:project:update']),
show: hasAccessByCodes(['license:project:comment']),
},
{
code: 'delete',

View File

@@ -174,7 +174,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
label: $t('ui.actionTitle.import', [$t('project.project')]),
type: 'primary',
icon: ACTION_ICON.UPLOAD,
auth: ['license:project:export'],
auth: ['license:project:import'],
onClick: handleImport,
},
]"