已修复:

实验课场地区块改为独立卡片布局,校区、教学楼和场地选择不再被嵌套表单挤压。
批量设置新增独立的“批量指定实验课场地”入口,包含场地性质、实验校区、教学楼和具体场地,并会联动筛选。
后端会保存并校验批量实验场地范围,避免跨校区/教学楼的无效设置。
This commit is contained in:
2026-08-09 16:26:41 +08:00 Unverified
parent 400761beaa
commit 26a39322fd
4 changed files with 120 additions and 40 deletions
+78 -38
View File
@@ -236,8 +236,17 @@ const batchFilteredClassrooms = computed(() =>
item.buildingId === constraintBatchForm.requiredBuildingId),
),
)
const batchFilteredExperimentBuildings = computed(() =>
constraintBatchForm.experimentRequiredCampusId
? buildings.value.filter((item) => item.campusId === constraintBatchForm.experimentRequiredCampusId)
: buildings.value,
)
const batchFilteredExperimentClassrooms = computed(() =>
batchFilteredClassrooms.value.filter((item) =>
classrooms.value.filter((item) =>
(!constraintBatchForm.experimentRequiredCampusId ||
item.campusId === constraintBatchForm.experimentRequiredCampusId) &&
(!constraintBatchForm.experimentRequiredBuildingId ||
item.buildingId === constraintBatchForm.experimentRequiredBuildingId) &&
(!(constraintBatchForm.allowedExperimentVenueNatures ?? []).length ||
(venueNatureValue(item.teachingVenueNature) &
(constraintBatchForm.allowedExperimentVenueNatures ?? [])
@@ -405,6 +414,8 @@ function openConstraintBatch() {
requiredBuildingId: undefined,
allowedClassroomIds: [],
updateExperimentClassroomScope: false,
experimentRequiredCampusId: undefined,
experimentRequiredBuildingId: undefined,
allowedExperimentVenueNatures: [],
allowedExperimentClassroomIds: [],
updateDays: false,
@@ -463,6 +474,12 @@ async function saveConstraintBatch() {
? constraintBatchForm.allowedClassroomIds
: null,
updateExperimentClassroomScope,
experimentRequiredCampusId: updateExperimentClassroomScope
? constraintBatchForm.experimentRequiredCampusId || null
: null,
experimentRequiredBuildingId: updateExperimentClassroomScope
? constraintBatchForm.experimentRequiredBuildingId || null
: null,
allowedExperimentVenueNatures: updateExperimentClassroomScope
? (constraintBatchForm.allowedExperimentVenueNatures ?? [])
.reduce((value: number, nature: number) => value | nature, 0)
@@ -1299,7 +1316,8 @@ onBeforeUnmount(() => {
</el-checkbox-group>
<small class="field-hint">仅约束实验课不勾选时可使用全部实验教学场地</small>
</el-form-item>
<el-form-item v-if="constraintForm.coursePracticeHours" label="实验课指定可用场地">
<section v-if="constraintForm.coursePracticeHours" class="experiment-classroom-scope">
<div class="experiment-classroom-scope__title">实验课指定可用场地</div>
<div class="form-grid">
<el-form-item label="实验课限定校区">
<el-select v-model="constraintForm.experimentRequiredCampusId" clearable @change="constraintForm.experimentRequiredBuildingId = undefined; constraintForm.allowedExperimentClassroomIds = []">
@@ -1312,16 +1330,18 @@ onBeforeUnmount(() => {
</el-select>
</el-form-item>
</div>
<el-select v-model="constraintForm.allowedExperimentClassroomIds" multiple filterable collapse-tags>
<el-option
v-for="item in filteredExperimentClassrooms"
:key="item.id"
:label="`${item.buildingName} / ${item.name}${item.roomType}${item.capacity}人)`"
:value="item.id"
/>
</el-select>
<small class="field-hint">可在上方场地性质范围内指定实验室不选择时按场地性质自动筛选</small>
</el-form-item>
<el-form-item label="实验课指定可用场地">
<el-select v-model="constraintForm.allowedExperimentClassroomIds" multiple filterable collapse-tags>
<el-option
v-for="item in filteredExperimentClassrooms"
:key="item.id"
:label="`${item.buildingName} / ${item.name}${item.roomType}${item.capacity}人)`"
:value="item.id"
/>
</el-select>
<small class="field-hint">可在上方场地性质范围内指定实验室不选择时按场地性质自动筛选</small>
</el-form-item>
</section>
</template>
<el-form-item label="允许上课日">
<el-checkbox-group v-model="constraintForm.allowedDayOfWeeks">
@@ -1406,32 +1426,6 @@ onBeforeUnmount(() => {
<el-option v-for="item in batchFilteredBuildings" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
</div>
<el-checkbox v-model="constraintBatchForm.updateExperimentClassroomScope">
批量指定实验课场地
</el-checkbox>
<div v-if="constraintBatchForm.updateExperimentClassroomScope" class="batch-classroom-scope">
<el-alert
title="仅作用于含实验学时的教学任务;不选择具体场地时,按场地性质自动分配。"
type="warning"
:closable="false"
show-icon
/>
<el-form-item label="统一实验课允许的场地性质">
<el-checkbox-group v-model="constraintBatchForm.allowedExperimentVenueNatures">
<el-checkbox v-for="nature in experimentVenueNatures" :key="nature.value" :value="nature.value">{{ nature.label }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="统一实验课指定可用场地">
<el-select v-model="constraintBatchForm.allowedExperimentClassroomIds" multiple filterable collapse-tags placeholder="不选择则允许符合性质的任意实验场地">
<el-option
v-for="item in batchFilteredExperimentClassrooms"
:key="item.id"
:label="`${item.buildingName} / ${item.name}${item.roomType}${item.capacity}人)`"
:value="item.id"
/>
</el-select>
</el-form-item>
</div>
<el-form-item label="统一指定可用教室">
<el-select
@@ -1452,6 +1446,52 @@ onBeforeUnmount(() => {
</el-form-item>
</div>
</template>
<el-checkbox v-model="constraintBatchForm.updateExperimentClassroomScope">
批量指定实验课场地
</el-checkbox>
<div v-if="constraintBatchForm.updateExperimentClassroomScope" class="batch-classroom-scope">
<el-alert
title="仅作用于含实验学时的教学任务;不选择具体场地时,按场地性质自动分配。"
type="warning"
:closable="false"
show-icon
/>
<el-form-item label="统一实验课允许的场地性质">
<el-checkbox-group v-model="constraintBatchForm.allowedExperimentVenueNatures">
<el-checkbox v-for="nature in experimentVenueNatures" :key="nature.value" :value="nature.value">{{ nature.label }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<div class="form-grid">
<el-form-item label="统一实验课限定校区">
<el-select
v-model="constraintBatchForm.experimentRequiredCampusId"
clearable
@change="constraintBatchForm.experimentRequiredBuildingId = undefined; constraintBatchForm.allowedExperimentClassroomIds = []"
>
<el-option v-for="item in campuses" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="统一实验课限定教学楼">
<el-select
v-model="constraintBatchForm.experimentRequiredBuildingId"
clearable
@change="constraintBatchForm.allowedExperimentClassroomIds = []"
>
<el-option v-for="item in batchFilteredExperimentBuildings" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
</div>
<el-form-item label="统一实验课指定可用场地">
<el-select v-model="constraintBatchForm.allowedExperimentClassroomIds" multiple filterable collapse-tags placeholder="不选择则允许符合性质的任意实验场地">
<el-option
v-for="item in batchFilteredExperimentClassrooms"
:key="item.id"
:label="`${item.buildingName} / ${item.name}${item.roomType}${item.capacity}人)`"
:value="item.id"
/>
</el-select>
</el-form-item>
</div>
<el-checkbox v-model="constraintBatchForm.updateDays">修改允许上课日</el-checkbox>
<el-form-item v-if="constraintBatchForm.updateDays" label="统一允许上课日">
<el-checkbox-group v-model="constraintBatchForm.allowedDayOfWeeks">