refactor(notice): 移除临时权限函数并优化表格操作按钮
- 移除了临时假权限函数_hasPermission - 简化了新增按钮的权限控制逻辑 - 统一了编辑和删除按钮的显示方式 - 更新了删除确认对话框的提示文案 - 调整了发布范围选择的数据结构master
parent
84bbdd8595
commit
7568638bc2
|
|
@ -18,17 +18,6 @@ function List(props) {
|
|||
form,
|
||||
});
|
||||
|
||||
// 临时假权限函数,用于开发测试
|
||||
const _hasPermission = (permissionCode) => {
|
||||
// 在开发环境中返回true,生产环境可以根据实际权限系统调整
|
||||
const fakePermissions = [
|
||||
"notice-add",
|
||||
"notice-edit",
|
||||
"notice-remove",
|
||||
];
|
||||
return fakePermissions.includes(permissionCode);
|
||||
};
|
||||
|
||||
return (
|
||||
<Page isShowAllAction={false}>
|
||||
<Search
|
||||
|
|
@ -42,22 +31,20 @@ function List(props) {
|
|||
name: "publishScope",
|
||||
label: "发布范围",
|
||||
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
|
||||
toolBarRender={() => (
|
||||
<Space>
|
||||
{_hasPermission("notice-add") && (
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<AddIcon />}
|
||||
onClick={() => props.history.push(`./Add`)}
|
||||
>
|
||||
新增
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<AddIcon />}
|
||||
onClick={() => props.history.push(`./Add`)}
|
||||
>
|
||||
新增
|
||||
</Button>
|
||||
</Space>
|
||||
)}
|
||||
columns={[
|
||||
|
|
@ -104,35 +91,32 @@ function List(props) {
|
|||
>
|
||||
查看
|
||||
</Button>
|
||||
{_hasPermission("notice-edit") && (
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => props.history.push(`./Add?id=${record.id}`)}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
)}
|
||||
{_hasPermission("notice-remove") && (
|
||||
<Button
|
||||
type="link"
|
||||
danger
|
||||
onClick={() => {
|
||||
Modal.confirm({
|
||||
title: "确定删除吗?",
|
||||
onOk: async () => {
|
||||
await props["noticeDelete"]({ id: record.id }).then((res) => {
|
||||
if (res.success) {
|
||||
message.success("删除成功");
|
||||
getData();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => props.history.push(`./Add?id=${record.id}`)}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Button
|
||||
type="link"
|
||||
danger
|
||||
onClick={() => {
|
||||
Modal.confirm({
|
||||
title: "是否确认删除当前公告?",
|
||||
onOk: async () => {
|
||||
await props["noticeDelete"]({ id: record.id }).then((res) => {
|
||||
if (res.success) {
|
||||
message.success("删除成功");
|
||||
getData();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue