后端修改权限和折叠功能
CI / verify (pull_request) Has been cancelled

This commit is contained in:
2026-07-23 14:38:52 +08:00
parent 6479365d6a
commit 75765bf9d4
11 changed files with 375 additions and 54 deletions
+28 -9
View File
@@ -5,6 +5,7 @@ import {
Card,
Checkbox,
Col,
Divider,
Form,
Row,
Select,
@@ -33,6 +34,8 @@ type AccountPermRes = {
const ROLE_LABELS = Object.fromEntries(HQ_ADMIN_ROLES.map((r) => [r.value, r.label]));
const CATALOG_GROUPS = [...new Set(HQ_PERMISSION_CATALOG.map((p) => p.group ?? '其他'))];
function PermissionChecklist({
value,
onChange,
@@ -49,13 +52,24 @@ function PermissionChecklist({
disabled={disabled}
onChange={(checked) => onChange(checked as string[])}
>
<Row gutter={[8, 8]}>
{HQ_PERMISSION_CATALOG.map((item) => (
<Col key={item.key} span={8}>
<Checkbox value={item.key}>{item.label}</Checkbox>
</Col>
))}
</Row>
{CATALOG_GROUPS.map((group) => {
const items = HQ_PERMISSION_CATALOG.filter((p) => (p.group ?? '其他') === group);
return (
<div key={group} style={{ marginBottom: 16 }}>
<Typography.Text strong style={{ display: 'block', marginBottom: 8 }}>
{group}
</Typography.Text>
<Row gutter={[8, 8]}>
{items.map((item) => (
<Col key={item.key} span={8}>
<Checkbox value={item.key}>{item.label}</Checkbox>
</Col>
))}
</Row>
<Divider style={{ margin: '12px 0 0' }} />
</div>
);
})}
</Checkbox.Group>
);
}
@@ -159,6 +173,7 @@ export default function HqPermissionsPage() {
<Typography.Title level={4}></Typography.Title>
<Typography.Paragraph type="secondary">
=
//
</Typography.Paragraph>
<Tabs
@@ -231,7 +246,7 @@ export default function HqPermissionsPage() {
const item = HQ_PERMISSION_CATALOG.find((p) => p.key === key);
return (
<Tag key={key} color="blue">
{item?.label || key}
{item?.group ? `${item.group}·${item.label}` : item?.label || key}
</Tag>
);
})}
@@ -244,7 +259,11 @@ export default function HqPermissionsPage() {
<span></span>
{previewEffectiveKeys.map((key) => {
const item = HQ_PERMISSION_CATALOG.find((p) => p.key === (key as HqPermissionKey));
return <Tag key={key}>{item?.label || key}</Tag>;
return (
<Tag key={key}>
{item?.group ? `${item.group}·${item.label}` : item?.label || key}
</Tag>
);
})}
</Space>
<div style={{ marginTop: 16 }}>