fix(system/file): 修复权限码错误

This commit is contained in:
2025-05-17 20:23:43 +08:00
parent 5511c87773
commit 2018cf0ead
5 changed files with 20 additions and 19 deletions

View File

@@ -2,12 +2,12 @@
<a-row justify="center" align="center" style="padding: 0 5%"> <a-row justify="center" align="center" style="padding: 0 5%">
<a-form ref="formRef" :model="form" auto-label-width class="w-full"> <a-form ref="formRef" :model="form" auto-label-width class="w-full">
<a-form-item <a-form-item
label="文件名称" label="名称"
field="originalName" field="originalName"
:rules="[{ required: true, message: '请输入文件名称' }]" :rules="[{ required: true, message: '请输入名称' }]"
style="margin-bottom: 0" style="margin-bottom: 0"
> >
<a-input v-model="form.originalName" placeholder="请输入文件名称" allow-clear /> <a-input v-model="form.originalName" placeholder="请输入名称" allow-clear />
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-row> </a-row>

View File

@@ -31,7 +31,7 @@
</section> </section>
</div> </div>
</a-grid-item> </a-grid-item>
<template #content> <template v-if="has.hasPermOr(['system:file:update', 'system:file:get', 'system:file:download', 'system:file:delete'])" #content>
<FileRightMenu :data="item" @click="handleRightMenuClick($event, item)"></FileRightMenu> <FileRightMenu :data="item" @click="handleRightMenuClick($event, item)"></FileRightMenu>
</template> </template>
</a-trigger> </a-trigger>
@@ -42,6 +42,7 @@
<script setup lang="ts"> <script setup lang="ts">
import FileRightMenu from './FileRightMenu.vue' import FileRightMenu from './FileRightMenu.vue'
import type { FileItem } from '@/apis/system' import type { FileItem } from '@/apis/system'
import has from '@/utils/has'
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
data: () => [], // 文件数据 data: () => [], // 文件数据

View File

@@ -32,7 +32,7 @@
{{ record.originalName }} {{ record.originalName }}
</a-typography-paragraph> </a-typography-paragraph>
</section> </section>
<template #content> <template v-if="has.hasPermOr(['system:file:update', 'system:file:get', 'system:file:download', 'system:file:delete'])" #content>
<FileRightMenu :data="record" @click="handleRightMenuClick($event, record)"></FileRightMenu> <FileRightMenu :data="record" @click="handleRightMenuClick($event, record)"></FileRightMenu>
</template> </template>
</a-trigger> </a-trigger>
@@ -51,12 +51,13 @@
</a-table-column> </a-table-column>
<a-table-column title="存储名称" data-index="storageName" :width="200" /> <a-table-column title="存储名称" data-index="storageName" :width="200" />
<a-table-column title="修改时间" data-index="updateTime" :width="200" /> <a-table-column title="修改时间" data-index="updateTime" :width="200" />
<a-table-column title="操作" :width="120" align="center"> <a-table-column v-if="has.hasPermOr(['system:file:update', 'system:file:get', 'system:file:download', 'system:file:delete'])" title="操作" :width="120" align="center">
<template #cell="{ record }"> <template #cell="{ record }">
<a-popover trigger="click" position="bottom" :content-style="{ 'padding': 0, 'margin-top': 0 }"> <a-popover trigger="click" position="bottom" :content-style="{ 'padding': 0, 'margin-top': 0 }">
<a-button type="text" @click.stop><icon-more :size="16" /></a-button> <a-button type="text" @click.stop><icon-more :size="16" /></a-button>
<template #content> <template #content>
<FileRightMenu <FileRightMenu
:data="record"
:file-info="record" :file-info="record"
:shadow="false" :shadow="false"
@click="handleRightMenuClick($event, record)" @click="handleRightMenuClick($event, record)"
@@ -75,6 +76,7 @@ import { Message, type TableInstance, type TableRowSelection } from '@arco-desig
import FileRightMenu from './FileRightMenu.vue' import FileRightMenu from './FileRightMenu.vue'
import { type FileItem, calcDirSize } from '@/apis/system' import { type FileItem, calcDirSize } from '@/apis/system'
import { formatFileSize } from '@/utils' import { formatFileSize } from '@/utils'
import has from '@/utils/has'
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
data: () => [], // 文件数据 data: () => [], // 文件数据

View File

@@ -2,7 +2,7 @@
<GiOption :class="{ shadow: props.shadow }"> <GiOption :class="{ shadow: props.shadow }">
<GiOptionItem v-permission="['system:file:update']" label="重命名" @click="onClickItem('rename')"> </GiOptionItem> <GiOptionItem v-permission="['system:file:update']" label="重命名" @click="onClickItem('rename')"> </GiOptionItem>
<GiOptionItem v-permission="['system:file:get']" label="详情" @click="onClickItem('detail')"> </GiOptionItem> <GiOptionItem v-permission="['system:file:get']" label="详情" @click="onClickItem('detail')"> </GiOptionItem>
<GiOptionItem v-permission="['system:file:download']" label="下载" @click="onClickItem('download')"></GiOptionItem> <GiOptionItem v-if="data?.type !== 0" v-permission="['system:file:download']" label="下载" @click="onClickItem('download')"></GiOptionItem>
<GiOptionItem v-permission="['system:file:delete']" label="删除" @click="onClickItem('delete')"> </GiOptionItem> <GiOptionItem v-permission="['system:file:delete']" label="删除" @click="onClickItem('delete')"> </GiOptionItem>
</GiOption> </GiOption>
</template> </template>

View File

@@ -12,18 +12,16 @@
<a-row justify="space-between" class="file-main__search"> <a-row justify="space-between" class="file-main__search">
<!-- 左侧区域 --> <!-- 左侧区域 -->
<a-space wrap> <a-space wrap>
<a-dropdown v-permission="['system:file:upload']"> <a-upload v-permission="['system:file:upload']" :show-file-list="false" :custom-request="handleUpload">
<a-upload :show-file-list="false" :custom-request="handleUpload"> <template #upload-button>
<template #upload-button> <a-button type="primary" shape="round">
<a-button type="primary" shape="round"> <template #icon>
<template #icon> <icon-upload />
<icon-upload /> </template>
</template> <template #default>上传</template>
<template #default>上传</template> </a-button>
</a-button> </template>
</template> </a-upload>
</a-upload>
</a-dropdown>
<a-input-group> <a-input-group>
<a-input v-model="queryForm.originalName" :placeholder="queryForm.type && queryForm.type !== '0' ? '请输入名称' : '在当前目录下搜索名称'" allow-clear style="width: 200px" /> <a-input v-model="queryForm.originalName" :placeholder="queryForm.type && queryForm.type !== '0' ? '请输入名称' : '在当前目录下搜索名称'" allow-clear style="width: 200px" />