style: 优化操作按钮样式

This commit is contained in:
xlsea
2025-05-09 20:26:55 +08:00
parent 7a27cdb3ab
commit b70ddb31e9
15 changed files with 455 additions and 292 deletions

View File

@ -1,5 +1,5 @@
<script setup lang="tsx">
import { NButton, NPopconfirm } from 'naive-ui';
import { NDivider } from 'naive-ui';
import { fetchBatchDeleteNotice, fetchGetNoticeList } from '@/service/api/system/notice';
import { useAppStore } from '@/store/modules/app';
import { useAuth } from '@/hooks/business/auth';
@ -8,8 +8,10 @@ import { useTable, useTableOperate } from '@/hooks/common/table';
import { useDict } from '@/hooks/business/dict';
import { $t } from '@/locales';
import DictTag from '@/components/custom/dict-tag.vue';
import ButtonIcon from '@/components/custom/button-icon.vue';
import NoticeOperateDrawer from './modules/notice-operate-drawer.vue';
import NoticeSearch from './modules/notice-search.vue';
defineOptions({
name: 'NoticeList'
});
@ -88,14 +90,25 @@ const {
align: 'center',
width: 130,
render: row => {
const divider = () => {
if (!hasAuth('system:notice:edit') || !hasAuth('system:notice:remove')) {
return null;
}
return <NDivider vertical />;
};
const editBtn = () => {
if (!hasAuth('system:notice:edit')) {
return null;
}
return (
<NButton type="primary" ghost size="small" onClick={() => edit(row.noticeId!)}>
{$t('common.edit')}
</NButton>
<ButtonIcon
text
type="primary"
icon="material-symbols:drive-file-rename-outline-outline"
tooltipContent={$t('common.edit')}
onClick={() => edit(row.noticeId!)}
/>
);
};
@ -104,22 +117,21 @@ const {
return null;
}
return (
<NPopconfirm onPositiveClick={() => handleDelete(row.noticeId!)}>
{{
default: () => $t('common.confirmDelete'),
trigger: () => (
<NButton type="error" ghost size="small">
{$t('common.delete')}
</NButton>
)
}}
</NPopconfirm>
<ButtonIcon
text
type="error"
icon="material-symbols:delete-outline"
tooltipContent={$t('common.delete')}
popconfirmContent={$t('common.confirmDelete')}
onPositiveClick={() => handleDelete(row.noticeId!)}
/>
);
};
return (
<div class="flex-center gap-8px">
{editBtn()}
{divider()}
{deleteBtn()}
</div>
);