feat: new classrooms default to 'reserved' status instead of 'available'

This commit is contained in:
2026-07-06 15:26:35 +08:00
parent 72b0eed36e
commit 1c097dc230
3 changed files with 4 additions and 3 deletions

View File

@@ -27,6 +27,7 @@ import PermissionButton from '../../components/PermissionButton';
const statusMap: Record<string, { text: string; color: string }> = {
available: { text: '可用', color: 'green' },
in_use: { text: '使用中', color: 'blue' },
reserved: { text: '已预留', color: 'purple' },
maintenance: { text: '维护中', color: 'orange' },
archived: { text: '已归档', color: '#999' },
};
@@ -223,7 +224,7 @@ const ClassroomsPage: React.FC = () => {
if (!e.target.value) setSearchText('');
}}
/>
<Select placeholder="状态" allowClear style={{ width: 110 }} value={filterStatus} onChange={setFilterStatus} options={[{value:'available',label:'可用'},{value:'in_use',label:'使用中'},{value:'maintenance',label:'维护中'}]} />
<Select placeholder="状态" allowClear style={{ width: 110 }} value={filterStatus} onChange={setFilterStatus} options={[{value:'available',label:'可用'},{value:'in_use',label:'使用中'},{value:'reserved',label:'已预留'},{value:'maintenance',label:'维护中'}]} />
<Button
type={showArchived ? 'primary' : 'default'}
onClick={() => setShowArchived(!showArchived)}

View File

@@ -56,7 +56,7 @@ export class ClassroomsService {
async restore(id: number) {
await this.findOne(id);
await this.repo.update(id, { status: 'available' });
await this.repo.update(id, { status: 'reserved' });
return this.repo.findOne({ where: { id } });
}

View File

@@ -27,7 +27,7 @@ export class Classroom {
@Column({ length: 50, nullable: true })
supervisor: string;
@Column({ type: 'varchar', length: 20, default: 'available' })
@Column({ type: 'varchar', length: 20, default: 'reserved' })
status: string;
@Column({ type: 'text', nullable: true })