forked from wangziqi/gongxue-base
feat: new classrooms default to 'reserved' status instead of 'available'
This commit is contained in:
@@ -27,6 +27,7 @@ import PermissionButton from '../../components/PermissionButton';
|
|||||||
const statusMap: Record<string, { text: string; color: string }> = {
|
const statusMap: Record<string, { text: string; color: string }> = {
|
||||||
available: { text: '可用', color: 'green' },
|
available: { text: '可用', color: 'green' },
|
||||||
in_use: { text: '使用中', color: 'blue' },
|
in_use: { text: '使用中', color: 'blue' },
|
||||||
|
reserved: { text: '已预留', color: 'purple' },
|
||||||
maintenance: { text: '维护中', color: 'orange' },
|
maintenance: { text: '维护中', color: 'orange' },
|
||||||
archived: { text: '已归档', color: '#999' },
|
archived: { text: '已归档', color: '#999' },
|
||||||
};
|
};
|
||||||
@@ -223,7 +224,7 @@ const ClassroomsPage: React.FC = () => {
|
|||||||
if (!e.target.value) setSearchText('');
|
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
|
<Button
|
||||||
type={showArchived ? 'primary' : 'default'}
|
type={showArchived ? 'primary' : 'default'}
|
||||||
onClick={() => setShowArchived(!showArchived)}
|
onClick={() => setShowArchived(!showArchived)}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export class ClassroomsService {
|
|||||||
|
|
||||||
async restore(id: number) {
|
async restore(id: number) {
|
||||||
await this.findOne(id);
|
await this.findOne(id);
|
||||||
await this.repo.update(id, { status: 'available' });
|
await this.repo.update(id, { status: 'reserved' });
|
||||||
return this.repo.findOne({ where: { id } });
|
return this.repo.findOne({ where: { id } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export class Classroom {
|
|||||||
@Column({ length: 50, nullable: true })
|
@Column({ length: 50, nullable: true })
|
||||||
supervisor: string;
|
supervisor: string;
|
||||||
|
|
||||||
@Column({ type: 'varchar', length: 20, default: 'available' })
|
@Column({ type: 'varchar', length: 20, default: 'reserved' })
|
||||||
status: string;
|
status: string;
|
||||||
|
|
||||||
@Column({ type: 'text', nullable: true })
|
@Column({ type: 'text', nullable: true })
|
||||||
|
|||||||
Reference in New Issue
Block a user