feat: 1. 完善文档列表的显示效果,数据对接后端接口返回。
2. 对评查点分组和文档类型的编辑删除新增操作进行限制。
This commit is contained in:
@@ -50,7 +50,8 @@ export default function RuleGroupsIndex() {
|
||||
const [filteredChildrenMap, setFilteredChildrenMap] = useState<Record<string, RuleGroup[]>>({});
|
||||
const [initialLoading, setInitialLoading] = useState<boolean>(true);
|
||||
const userRole = rootData?.userRole || 'common';
|
||||
|
||||
const hasEditPermission = userRole.toLowerCase().includes('provin');
|
||||
|
||||
// 初始加载时自动加载所有子分组
|
||||
useEffect(() => {
|
||||
const loadAllChildGroups = async () => {
|
||||
@@ -499,9 +500,10 @@ export default function RuleGroupsIndex() {
|
||||
key: "ruleCount",
|
||||
width: "12%",
|
||||
render: (_: unknown, record: RuleGroup & { isParent?: boolean, parentId?: string }) => (
|
||||
<button onClick={() => navigate(`/rules/list?${!record.isParent ? `ruleType=${record.parentId}&groupId=${record.id}` : `ruleType=${record.id}`}`)} className="badge bg-primary text-white">
|
||||
<span className="text-xs hover:underline">{calculateTotalRuleCount(record)}</span>
|
||||
</button>
|
||||
<div className="badge bg-primary text-white">
|
||||
{/* <button onClick={() => navigate(`/rules/list?${!record.isParent ? `ruleType=${record.parentId}&groupId=${record.id}` : `ruleType=${record.id}`}`)} className="badge bg-primary text-white"> */}
|
||||
<span className="text-xs">{calculateTotalRuleCount(record)}</span>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
{
|
||||
@@ -533,10 +535,10 @@ export default function RuleGroupsIndex() {
|
||||
onClick={() => navigate(`/rule-groups/new?id=${record.id}`)}
|
||||
className="operation-btn"
|
||||
>
|
||||
<i className="ri-edit-line"></i> {userRole === 'common' ? '查看' : '编辑'}
|
||||
<i className="ri-edit-line"></i> {hasEditPermission ? '编辑' : '查看'}
|
||||
</button>
|
||||
{userRole !== 'common' && (
|
||||
<button
|
||||
{hasEditPermission && (
|
||||
<button
|
||||
type="button"
|
||||
className="operation-btn !text-[--color-error]"
|
||||
onClick={() => handleDeleteGroup(record.id)}
|
||||
@@ -577,7 +579,7 @@ export default function RuleGroupsIndex() {
|
||||
>
|
||||
收起全部
|
||||
</Button>
|
||||
{userRole !== 'common' && (
|
||||
{hasEditPermission && (
|
||||
<Button
|
||||
type="primary"
|
||||
icon="ri-add-line"
|
||||
|
||||
Reference in New Issue
Block a user