Compare commits

...

3 Commits

Author SHA1 Message Date
青菜白玉汤
d5fa33d7fe Merge d6973a4c9d into a8f923eb38 2024-08-10 23:49:53 +08:00
Ohh
a8f923eb38 docs(projects): update README (#594) 2024-08-10 17:30:06 +08:00
Azir
d6973a4c9d feat(components): support displaying and hiding permission buttons in table-header-operation 2024-08-07 15:58:21 +08:00
3 changed files with 30 additions and 3 deletions

View File

@@ -111,6 +111,7 @@ pnpm build
## Ecosystem
- [react-soybean-admin](https://github.com/mufeng889/react-soybean-admin): SoybeanAdmin based version of React.
- [electron-mock-admin](https://github.com/lixin59/electron-mock-api): A Mock Api management system that helps front-end developers quickly implement interface mocks.
- [T-Shell](https://github.com/TheBlindM/T-Shell): A terminal emulator and SSH client with configurable command prompts.
- [pea](https://github.com/haitang1894/pea) : Adopting SpringBoot3.2 + JDK21, MyBatis-Plus, SpringSecurity security framework, etc., suitable for the simple permission system developed by [soybean-admin](https://gitee.com/honghuangdc/soybean-admin).

View File

@@ -109,6 +109,7 @@ pnpm build
## 周边生态
- [react-soybean-admin](https://github.com/mufeng889/react-soybean-admin): 基于SoybeanAdmin的React版本.
- [electron-mock-admin](https://github.com/lixin59/electron-mock-api): 一个 Mock Api 管理系统,帮助前端开发伙伴快速实现接口的 mock。
- [T-Shell](https://github.com/TheBlindM/T-Shell): 是一个可配置命令提示的终端模拟器和 SSH 客户端。
- [pea](https://github.com/haitang1894/pea) : 采用SpringBoot3.2 + JDK21、MyBatis-Plus、SpringSecurity安全框架等适配 [soybean-admin](https://gitee.com/honghuangdc/soybean-admin) 开发的简单权限系统。

View File

@@ -1,4 +1,6 @@
<script setup lang="ts">
import { ref, watchEffect } from 'vue';
import { useAuth } from '@/hooks/business/auth';
import { $t } from '@/locales';
defineOptions({
@@ -9,9 +11,21 @@ interface Props {
itemAlign?: NaiveUI.Align;
disabledDelete?: boolean;
loading?: boolean;
showAdd?: boolean;
addCode?: string; // Button Add Permission Code
showDelete?: boolean;
deleteCode?: string; // Button Delete Permission Code
}
defineProps<Props>();
const props = withDefaults(defineProps<Props>(), {
itemAlign: 'center',
disabledDelete: false,
loading: false,
showAdd: true,
addCode: '',
showDelete: true,
deleteCode: ''
});
interface Emits {
(e: 'add'): void;
@@ -19,6 +33,17 @@ interface Emits {
(e: 'refresh'): void;
}
const { hasAuth } = useAuth();
const showAddButton = ref(false);
const showDeleteButton = ref(false);
// Monitor changes in permission codes and update the display status of buttons
watchEffect(() => {
showAddButton.value = props.showAdd && (!props.addCode || hasAuth(props.addCode));
showDeleteButton.value = props.showDelete && (!props.deleteCode || hasAuth(props.deleteCode));
});
const emit = defineEmits<Emits>();
const columns = defineModel<NaiveUI.TableColumnCheck[]>('columns', {
@@ -42,13 +67,13 @@ function refresh() {
<NSpace :align="itemAlign" wrap justify="end" class="lt-sm:w-200px">
<slot name="prefix"></slot>
<slot name="default">
<NButton size="small" ghost type="primary" @click="add">
<NButton v-if="showAddButton" size="small" ghost type="primary" @click="add">
<template #icon>
<icon-ic-round-plus class="text-icon" />
</template>
{{ $t('common.add') }}
</NButton>
<NPopconfirm @positive-click="batchDelete">
<NPopconfirm v-if="showDeleteButton" @positive-click="batchDelete">
<template #trigger>
<NButton size="small" ghost type="error" :disabled="disabledDelete">
<template #icon>