fix: 权限按钮可见性与Modal/Popconfirm撤权一致性修复 #45

Merged
wangziqi merged 3 commits from worktree-audit-permission-ui into main 2026-07-23 06:40:19 +00:00
4 changed files with 21 additions and 23 deletions
Showing only changes of commit 446c6bcc91 - Show all commits

View File

@@ -313,10 +313,8 @@ interface MatchModalProps {
const JinshujuMatchModal: React.FC<MatchModalProps> = ({ open, onClose, onApplied }) => {
const { hasPermission, hasAllPermissions, permissionsReady } = usePermission();
const canReadSync = hasPermission('sync:read');
const canTriggerSync = hasPermission('sync:trigger');
const canEnterModal = permissionsReady && hasAllPermissions('sync:read', 'sync:trigger');
const canWriteRules = permissionsReady && canTriggerSync;
const [step, setStep] = useState<'connection' | 'rule' | 'match' | 'applying'>('connection');
const [loading, setLoading] = useState(false);
const [selectedRuleId, setSelectedRuleId] = useState<number | undefined>();

View File

@@ -27,8 +27,8 @@ interface ExamDetail extends ExamItem {
}
const PhoneCell: React.FC<{ row: ScoreRow }> = ({ row }) => {
const reveal = useViewSensitive(row.studentId, '考试管理', hasPermission('log:create'));
const { hasPermission } = usePermission();
const reveal = useViewSensitive(row.studentId, '考试管理', hasPermission('log:create'));
if (!row.phone) return <>-</>;
return (
<Space size={4}>

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState, useMemo, useCallback, useRef } from 'react';
import React, { useEffect, useState, useMemo, useCallback } from 'react';
import {
Table,
Button,
@@ -594,25 +594,25 @@ const OccupanciesPage: React.FC = () => {
>
退宿
</PermissionButton>
</>)}
{canDelete ? (
<Popconfirm
title={`确定归档选中的 ${selectedRowKeys.length} 条入住记录?在住记录会自动跳过`}
onConfirm={handleBatchDelete}
okText="归档"
cancelText="取消"
>
<Button
danger
size="small"
icon={<InboxOutlined />}
style={{ marginLeft: 12 }}
loading={batchLoading}
) : (
canDelete ? (
<Popconfirm
title={`确定归档选中的 ${selectedRowKeys.length} 条入住记录?在住记录会自动跳过`}
onConfirm={handleBatchDelete}
okText="归档"
cancelText="取消"
>
</Button>
</Popconfirm>
) : null}
<Button
danger
size="small"
icon={<InboxOutlined />}
style={{ marginLeft: 12 }}
loading={batchLoading}
>
</Button>
</Popconfirm>
) : null
)}
<Button size="small" onClick={() => setSelectedRowKeys([])} style={{ marginLeft: 8 }}>

View File

@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import {
Alert,
App,