refactor(notice): 移除临时权限函数并优化表格操作按钮

- 移除了临时假权限函数_hasPermission
- 简化了新增按钮的权限控制逻辑
- 统一了编辑和删除按钮的显示方式
- 更新了删除确认对话框的提示文案
- 调整了发布范围选择的数据结构
master
wangyan 2026-03-13 14:13:19 +08:00
parent 84bbdd8595
commit 7568638bc2
1 changed files with 34 additions and 50 deletions

View File

@ -18,17 +18,6 @@ function List(props) {
form, form,
}); });
// 临时假权限函数,用于开发测试
const _hasPermission = (permissionCode) => {
// 在开发环境中返回true生产环境可以根据实际权限系统调整
const fakePermissions = [
"notice-add",
"notice-edit",
"notice-remove",
];
return fakePermissions.includes(permissionCode);
};
return ( return (
<Page isShowAllAction={false}> <Page isShowAllAction={false}>
<Search <Search
@ -42,14 +31,13 @@ function List(props) {
name: "publishScope", name: "publishScope",
label: "发布范围", label: "发布范围",
render: FORM_ITEM_RENDER_ENUM.SELECT, render: FORM_ITEM_RENDER_ENUM.SELECT,
items: [{ bianma: "0", name: "全部" }, { bianma: "1", name: "股份" }, { bianma: "2", name: "分子公司" }, { bianma: "3", name: "相关方" }], items: [{ bianma: "1,2,3", name: "全部" }, { bianma: "1", name: "股份" }, { bianma: "2", name: "分子公司" }, { bianma: "3", name: "相关方" }],
}, },
]} ]}
/> />
<Table <Table
toolBarRender={() => ( toolBarRender={() => (
<Space> <Space>
{_hasPermission("notice-add") && (
<Button <Button
type="primary" type="primary"
icon={<AddIcon />} icon={<AddIcon />}
@ -57,7 +45,6 @@ function List(props) {
> >
新增 新增
</Button> </Button>
)}
</Space> </Space>
)} )}
columns={[ columns={[
@ -104,21 +91,19 @@ function List(props) {
> >
查看 查看
</Button> </Button>
{_hasPermission("notice-edit") && (
<Button <Button
type="link" type="link"
onClick={() => props.history.push(`./Add?id=${record.id}`)} onClick={() => props.history.push(`./Add?id=${record.id}`)}
> >
编辑 编辑
</Button> </Button>
)}
{_hasPermission("notice-remove") && (
<Button <Button
type="link" type="link"
danger danger
onClick={() => { onClick={() => {
Modal.confirm({ Modal.confirm({
title: "确定删除吗", title: "是否确认删除当前公告",
onOk: async () => { onOk: async () => {
await props["noticeDelete"]({ id: record.id }).then((res) => { await props["noticeDelete"]({ id: record.id }).then((res) => {
if (res.success) { if (res.success) {
@ -132,7 +117,6 @@ function List(props) {
> >
删除 删除
</Button> </Button>
)}
</Space> </Space>
), ),
}, },