chore(system/storage): 完善存储管理权限指令

This commit is contained in:
2024-04-15 22:33:57 +08:00
parent 7a869bf9d1
commit 5164aa55cf
2 changed files with 15 additions and 8 deletions

View File

@@ -112,6 +112,13 @@ const { form, resetForm } = useForm<StorageReq>({
name: '', name: '',
code: '', code: '',
type: 2, type: 2,
accessKey: undefined,
secretKey: undefined,
endpoint: undefined,
bucketName: undefined,
domain: undefined,
description: undefined,
isDefault: false,
sort: 999, sort: 999,
status: 1 status: 1
}) })

View File

@@ -2,7 +2,6 @@
<div class="gi_page"> <div class="gi_page">
<a-card title="存储管理" class="general-card"> <a-card title="存储管理" class="general-card">
<GiTable <GiTable
ref="tableRef"
row-key="id" row-key="id"
:data="dataList" :data="dataList"
:columns="columns" :columns="columns"
@@ -27,7 +26,7 @@
<a-button @click="reset">重置</a-button> <a-button @click="reset">重置</a-button>
</template> </template>
<template #custom-right> <template #custom-right>
<a-button type="primary" @click="onAdd"> <a-button v-has-perm="['system:storage:add']" type="primary" @click="onAdd">
<template #icon><icon-plus /></template> <template #icon><icon-plus /></template>
<span>新增</span> <span>新增</span>
</a-button> </a-button>
@@ -51,8 +50,9 @@
<template #split> <template #split>
<a-divider direction="vertical" :margin="0" /> <a-divider direction="vertical" :margin="0" />
</template> </template>
<a-link @click="onUpdate(record)">修改</a-link> <a-link v-has-perm="['system:storage:update']" @click="onUpdate(record)">修改</a-link>
<a-link <a-link
v-has-perm="['system:storage:delete']"
status="danger" status="danger"
:title="record.isDefault ? '默认存储库不能删除' : undefined" :title="record.isDefault ? '默认存储库不能删除' : undefined"
:disabled="record.disabled" :disabled="record.disabled"
@@ -65,14 +65,14 @@
</GiTable> </GiTable>
</a-card> </a-card>
<AddStorageModal ref="AddStorageModalRef" @save-success="search" /> <StorageAddModal ref="StorageAddModalRef" @save-success="search" />
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { listStorage, deleteStorage, type StorageResp } from '@/apis' import { listStorage, deleteStorage, type StorageResp } from '@/apis'
import StorageAddModal from './StorageAddModal.vue'
import type { TableInstance } from '@arco-design/web-vue' import type { TableInstance } from '@arco-design/web-vue'
import AddStorageModal from './AddStorageModal.vue'
import { useTable } from '@/hooks' import { useTable } from '@/hooks'
import { useDict } from '@/hooks/app' import { useDict } from '@/hooks/app'
import { isMobile } from '@/utils' import { isMobile } from '@/utils'
@@ -131,15 +131,15 @@ const onDelete = (item: StorageResp) => {
return handleDelete(() => deleteStorage(item.id), { content: `是否确定删除存储 [${item.name}]`, showModal: true }) return handleDelete(() => deleteStorage(item.id), { content: `是否确定删除存储 [${item.name}]`, showModal: true })
} }
const AddStorageModalRef = ref<InstanceType<typeof AddStorageModal>>() const StorageAddModalRef = ref<InstanceType<typeof StorageAddModal>>()
// 新增 // 新增
const onAdd = () => { const onAdd = () => {
AddStorageModalRef.value?.onAdd() StorageAddModalRef.value?.onAdd()
} }
// 修改 // 修改
const onUpdate = (item: StorageResp) => { const onUpdate = (item: StorageResp) => {
AddStorageModalRef.value?.onUpdate(item.id) StorageAddModalRef.value?.onUpdate(item.id)
} }
</script> </script>