fix: align permission-gated UI actions
This commit is contained in:
@@ -464,7 +464,11 @@ const RoomVisualPage: React.FC = () => {
|
||||
)}
|
||||
</div>
|
||||
{detailRoom.occupants.map((o: any) => (
|
||||
<Card key={o.occupancyId} size="small" style={{ marginBottom: 8, borderRadius: 8 }}>
|
||||
<Card
|
||||
key={o.occupancyId}
|
||||
size="small"
|
||||
style={{ marginBottom: 8, borderRadius: 8 }}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
@@ -502,24 +506,25 @@ const RoomVisualPage: React.FC = () => {
|
||||
<span style={{ color: '#86868b', fontSize: 12 }}>
|
||||
{presentOccupancyIds.includes(o.occupancyId) ? '在寝' : '缺勤'}
|
||||
</span>
|
||||
<Switch
|
||||
checked={presentOccupancyIds.includes(o.occupancyId)}
|
||||
disabled={!hasPermission('room:inspect')}
|
||||
checkedChildren="在寝"
|
||||
unCheckedChildren="缺勤"
|
||||
onChange={(checked) =>
|
||||
setPresentOccupancyIds((current) =>
|
||||
togglePresentOccupancy(current, o.occupancyId, checked),
|
||||
)
|
||||
}
|
||||
/>
|
||||
{hasPermission('room:inspect') ? (
|
||||
<Switch
|
||||
checked={presentOccupancyIds.includes(o.occupancyId)}
|
||||
checkedChildren="在寝"
|
||||
unCheckedChildren="缺勤"
|
||||
onChange={(checked) =>
|
||||
setPresentOccupancyIds((current) =>
|
||||
togglePresentOccupancy(current, o.occupancyId, checked),
|
||||
)
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
</Space>
|
||||
)}
|
||||
</div>
|
||||
<div style={{ color: '#86868b', fontSize: 12, marginTop: 4 }}>
|
||||
<CalendarOutlined style={{ marginRight: 4 }} />
|
||||
床位:{o.bedNumber || '未分配'} |{' '}
|
||||
入住:{o.checkInDate} | 计费起:{o.billingStartDate}
|
||||
床位:{o.bedNumber || '未分配'} | 入住:{o.checkInDate} | 计费起:
|
||||
{o.billingStartDate}
|
||||
{o.supervisor && (
|
||||
<span style={{ marginLeft: 8 }}>负责人:{o.supervisor}</span>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user