fix: 全局权限优化 — 7 项问题修复

1. 菜单权限修复:补充 10 个菜单的 permission 字段 + 修复 menu_service
   回退逻辑(admin 直接跳过过滤,非 admin 无关联则不显示)+ 收紧前端过滤
2. 管理员重置密码:新增 POST /users/{id}/reset-password 端点 + 前端按钮
3. 告警处理人姓名:AlertResponse 添加 acknowledged_by_name 字段
4. Tab 权限过滤:PatientDetail 6 个 Tab 按权限过滤 + 状态字段 Tooltip
5. 消息中心 UI:添加 Popconfirm/AuthButton,移除 inline isDark
This commit is contained in:
iven
2026-05-15 19:00:48 +08:00
parent 9319203e09
commit 8763e10d6e
17 changed files with 451 additions and 69 deletions

View File

@@ -1,9 +1,9 @@
import { useEffect, useState, useCallback } from 'react';
import { Table, Button, Modal, Form, Input, Select, message, Tag } from 'antd';
import { Table, Button, Modal, Form, Input, Select, message, Tag, Card } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import type { ColumnsType } from 'antd/es/table';
import { listTemplates, createTemplate, type MessageTemplateInfo } from '../../api/messageTemplates';
import { useThemeMode } from '../../hooks/useThemeMode';
import { AuthButton } from '../../components/AuthButton';
const channelMap: Record<string, { label: string; color: string }> = {
in_app: { label: '站内', color: '#2563eb' },
@@ -19,7 +19,6 @@ export default function MessageTemplates() {
const [loading, setLoading] = useState(false);
const [modalOpen, setModalOpen] = useState(false);
const [form] = Form.useForm();
const isDark = useThemeMode();
const fetchData = useCallback(async (p = page) => {
setLoading(true);
@@ -64,9 +63,9 @@ export default function MessageTemplates() {
key: 'code',
render: (v: string) => (
<Tag style={{
background: isDark ? '#0f172a' : '#f8fafc',
background: 'var(--ant-color-fill-quaternary)',
border: 'none',
color: isDark ? '#94a3b8' : '#475569',
color: 'var(--ant-color-text-secondary)',
fontFamily: 'monospace',
fontSize: 12,
}}>
@@ -111,7 +110,7 @@ export default function MessageTemplates() {
key: 'created_at',
width: 180,
render: (v: string) => (
<span style={{ color: isDark ? '#475569' : '#94a3b8', fontSize: 13 }}>{v}</span>
<span style={{ color: 'var(--ant-color-text-secondary)', fontSize: 13 }}>{v}</span>
),
},
];
@@ -124,20 +123,17 @@ export default function MessageTemplates() {
alignItems: 'center',
marginBottom: 16,
}}>
<span style={{ fontSize: 13, color: isDark ? '#475569' : '#94a3b8' }}>
<span style={{ fontSize: 13, color: 'var(--ant-color-text-secondary)' }}>
{total}
</span>
<Button type="primary" icon={<PlusOutlined />} onClick={() => setModalOpen(true)}>
</Button>
<AuthButton code="message.manage">
<Button type="primary" icon={<PlusOutlined />} onClick={() => setModalOpen(true)}>
</Button>
</AuthButton>
</div>
<div style={{
background: isDark ? '#111827' : '#FFFFFF',
borderRadius: 12,
border: `1px solid ${isDark ? '#0f172a' : '#f8fafc'}`,
overflow: 'hidden',
}}>
<Card styles={{ body: { padding: 0 } }}>
<Table
columns={columns}
dataSource={data}
@@ -151,7 +147,7 @@ export default function MessageTemplates() {
showTotal: (t) => `${t} 条记录`,
}}
/>
</div>
</Card>
<Modal
title="新建消息模板"