实验排课

This commit is contained in:
2026-08-09 12:30:33 +08:00 Unverified
parent 1229f3163d
commit c692002676
25 changed files with 21294 additions and 1189 deletions
+18 -3
View File
@@ -54,6 +54,10 @@ const weekdays = [
{ value: 6, label: '星期六' },
{ value: 7, label: '星期日' },
]
const experimentVenueNatures = [
{ value: 2, label: '实验室' }, { value: 4, label: '实训室' },
{ value: 8, label: '计算机机房' }, { value: 16, label: '语音室' },
]
const periods = computed(() => {
const configured = timeSlots.value
.filter((item) => item.isEnabled)
@@ -126,7 +130,7 @@ const selectedTaskConstraint = computed(() =>
constraints.value.find((item) => item.id === entryForm.teachingTaskId),
)
const isExperimentRoom = (room: any) =>
['实验', '实训', '机房', '语音'].some((keyword) => room.roomType?.includes(keyword))
(Number(room.teachingVenueNature) & (2 | 4 | 8 | 16)) !== 0
const entryClassrooms = computed(() =>
classrooms.value.filter((room) =>
(!selectedTaskConstraint.value?.requiredCampusId
@@ -294,6 +298,9 @@ function openConstraint(item: any) {
requiredCampusId: item.requiredCampusId,
requiredBuildingId: item.requiredBuildingId,
allowedClassroomIds: [...item.allowedClassroomIds],
allowedExperimentVenueNatures: experimentVenueNatures
.filter((nature) => (Number(item.allowedExperimentVenueNatures) & nature.value) !== 0)
.map((nature) => nature.value),
allowedDayOfWeeks: item.allowedDayOfWeeks.length
? [...item.allowedDayOfWeeks]
: [1, 2, 3, 4, 5],
@@ -311,6 +318,8 @@ async function saveConstraint() {
requiredCampusId: constraintForm.requiredCampusId || null,
requiredBuildingId: constraintForm.requiredBuildingId || null,
allowedClassroomIds: constraintForm.allowedClassroomIds ?? [],
allowedExperimentVenueNatures: (constraintForm.allowedExperimentVenueNatures ?? [])
.reduce((value: number, nature: number) => value | nature, 0),
allowedDayOfWeeks: constraintForm.allowedDayOfWeeks ?? [],
earliestPeriod: constraintForm.earliestPeriod || null,
latestPeriod: constraintForm.latestPeriod || null,
@@ -1208,7 +1217,7 @@ onBeforeUnmount(() => {
</el-select>
</el-form-item>
</div>
<el-form-item label="指定可用教室">
<el-form-item label="指定可用教室">
<el-select v-model="constraintForm.allowedClassroomIds" multiple filterable collapse-tags>
<el-option
v-for="item in filteredClassrooms"
@@ -1217,7 +1226,13 @@ onBeforeUnmount(() => {
:value="item.id"
/>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item label="实验课允许的场地性质">
<el-checkbox-group v-model="constraintForm.allowedExperimentVenueNatures">
<el-checkbox v-for="nature in experimentVenueNatures" :key="nature.value" :value="nature.value">{{ nature.label }}</el-checkbox>
</el-checkbox-group>
<small class="field-hint">仅约束实验课不勾选时可使用全部实验教学场地</small>
</el-form-item>
</template>
<el-form-item label="允许上课日">
<el-checkbox-group v-model="constraintForm.allowedDayOfWeeks">