feat: replace tenants with organization management

This commit is contained in:
2026-07-10 21:27:26 +08:00
parent 8ed1682b90
commit 8f0991a51f
49 changed files with 1292 additions and 698 deletions

View File

@@ -12,7 +12,7 @@ import {
Spin,
Empty,
Tooltip,
} from 'antd';
} from 'antd';
import { CalendarOutlined, FileTextOutlined } from '@ant-design/icons';
import dayjs, { Dayjs } from 'dayjs';
import api from '../../api';
@@ -24,7 +24,7 @@ interface ScheduleData {
month: number;
days: number;
classrooms: any[];
tenants: any[];
organizations: any[];
matrix: Record<number, Record<number, any>>;
summary: Record<
number,
@@ -95,10 +95,7 @@ const ClassroomSchedulePage: React.FC = () => {
const handleDownloadContract = async (id: number, filename?: string) => {
try {
await downloadBlob(
`/classroom-rentals/${id}/contract`,
filename || `contract-${id}.pdf`,
);
await downloadBlob(`/classroom-rentals/${id}/contract`, filename || `contract-${id}.pdf`);
} catch {
// downloadBlob already shows an error via throw
}
@@ -175,7 +172,7 @@ const ClassroomSchedulePage: React.FC = () => {
<Card size="small" style={{ marginBottom: 16 }} title="图例">
<Space wrap>
<Tag color="#52c41a"></Tag>
{data.tenants.map((t) => (
{data.organizations.map((t) => (
<Tag
key={t.id}
color={t.color}
@@ -184,7 +181,9 @@ const ClassroomSchedulePage: React.FC = () => {
{t.name} ()
</Tag>
))}
<Tag color="#d9d9d9" style={{ color: '#999' }}></Tag>
<Tag color="#d9d9d9" style={{ color: '#999' }}>
</Tag>
</Space>
</Card>
)}
@@ -310,7 +309,7 @@ const ClassroomSchedulePage: React.FC = () => {
title={
isInternal
? `${cell.className} · ${cell.subject}\n${cell.teacherName} · ${cell.startTime}-${cell.endTime}`
: `${cell.tenantName}${cell.hasContract ? ' · 有合同' : ''}`
: `${cell.organizationName}${cell.hasContract ? ' · 有合同' : ''}`
}
>
<span style={{ color: '#fff', fontSize: 10, fontWeight: 600 }}>
@@ -347,21 +346,22 @@ const ClassroomSchedulePage: React.FC = () => {
{detailModal.classroom?.roomType}
</div>
<div>
<strong></strong>
<strong></strong>
<Tag
color={detailModal.tenant?.color}
color={detailModal.lesseeOrganization?.color}
style={{
background: detailModal.tenant?.color,
background: detailModal.lesseeOrganization?.color,
color: '#fff',
borderColor: detailModal.tenant?.color,
borderColor: detailModal.lesseeOrganization?.color,
}}
>
{detailModal.tenant?.name}
{detailModal.lesseeOrganization?.name}
</Tag>
</div>
<div>
<strong></strong>
{detailModal.tenant?.contact || '-'} {detailModal.tenant?.phone || ''}
{detailModal.lesseeOrganization?.contactName || '-'}{' '}
{detailModal.lesseeOrganization?.phone || ''}
</div>
<div>
<strong></strong>