教室管理增加具备多媒体、投影属性(添加+修改+查询条件+列表)

This commit is contained in:
buliping committed 2026-09-29 14:21:44 +08:00
1 parent 9c720a2535
commit 0bf7d961ab
3 files changed
+95 -7

No files matched your search

@@ -57,6 +57,9 @@ public class TrainClassroomInfoServiceImpl implements ITrainClassroomInfoService
vo.setRoomStatus(classroom.getRoomStatus());
vo.setRemark(classroom.getRemark());
vo.setCreateTime(classroom.getCreateTime());
vo.setSeatArrange(classroom.getSeatArrange());
vo.setMultimedia(classroom.getMultimedia());
vo.setProjector(classroom.getProjector());
// 按 bind_classroom_id 查询绑定的电子班牌(0..N),映射为轻量摘要 VO,无绑定时返回空列表 []
TrainElectronicBoard boardQuery = new TrainElectronicBoard();
@@ -29,9 +29,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTrainClassroomInfoVo"/>
where del_flag = '0'
<if test="roomName != null and roomName != ''"> and room_name like concat('%', #{roomName}, '%')</if>
<if test="roomLocation != null and roomLocation != ''"> and room_location = #{roomLocation}</if>
<if test="roomLocation != null and roomLocation != ''"> and room_location like concat('%', #{roomLocation}, '%')</if>
<if test="capacity != null "> and capacity = #{capacity}</if>
<if test="roomStatus != null "> and room_status = #{roomStatus}</if>
<if test="multimedia != null "> and multimedia = #{multimedia}</if>
<if test="projector != null "> and projector = #{projector}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
order by create_time desc
</select>
@@ -80,9 +82,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="seatArrange != null">#{seatArrange}</if>
<if test="multimedia != null">#{multimedia}</if>
<if test="projector != null">#{projector}</if>
<if test="seatArrange != null">#{seatArrange},</if>
<if test="multimedia != null">#{multimedia},</if>
<if test="projector != null">#{projector},</if>
</trim>
</insert>
+86 -3
View File
@@ -1,6 +1,6 @@
<template>
<div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="68px">
<el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="88px">
<el-form-item label="教室名称" prop="roomName">
<el-input
v-model="queryParams.roomName"
@@ -24,6 +24,26 @@
<el-option label="维护中" :value="2" />
</el-select>
</el-form-item>
<el-form-item label="具备多媒体" prop="multimedia">
<el-select v-model="queryParams.multimedia" placeholder="具备多媒体" clearable>
<el-option
v-for="dict in yesNoOptions"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="具备投影" prop="projector">
<el-select v-model="queryParams.projector" placeholder="具备投影" clearable>
<el-option
v-for="dict in yesNoOptions"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -71,7 +91,17 @@
<el-tag v-else type="info">维护中</el-tag>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="具备多媒体" align="center" prop="multimedia">
<template slot-scope="scope">
<dict-tag :options="dict.type.train_yes_no" :value="scope.row.multimedia" />
</template>
</el-table-column>
<el-table-column label="具备投影" align="center" prop="projector">
<template slot-scope="scope">
<dict-tag :options="dict.type.train_yes_no" :value="scope.row.projector" />
</template>
</el-table-column>
<!-- <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
<template slot-scope="scope">
<el-button
@@ -120,6 +150,24 @@
<el-radio :label="2">维护中</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="具备多媒体" prop="multimedia">
<el-radio-group v-model="form.multimedia">
<el-radio
v-for="dict in yesNoOptions"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="具备投影" prop="projector">
<el-radio-group v-model="form.projector">
<el-radio
v-for="dict in yesNoOptions"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" maxlength="500" />
</el-form-item>
@@ -137,6 +185,8 @@ import { listClassroom, getClassroom, addClassroom, updateClassroom, delClassroo
export default {
name: 'Classroom',
// 是否类字典(sys_yes_no),注入后可通过 dict.type.sys_yes_no 访问
dicts: ['sys_yes_no', 'train_yes_no'],
data() {
return {
// 遮罩层
@@ -164,7 +214,9 @@ export default {
roomName: null,
roomLocation: null,
capacity: null,
roomStatus: null
roomStatus: null,
multimedia: null,
projector: null
},
// 表单参数
form: {},
@@ -191,10 +243,35 @@ export default {
}
}
},
computed: {
/*
* 是否(sys_yes_no)单选选项。
* 数据库 multimedia / projector 为数值型(1=是,0=否),
* 字典 dictValue 为 Y/N 字符串,此处统一转换为数值,保证回显与提交类型一致。
*/
yesNoOptions() {
const list = (this.dict && this.dict.type && this.dict.type.train_yes_no) || []
return list.map(item => ({
label: item.label,
//value: this.toYesNoValue(item.value)
value: /^\d+$/.test(String(item.value)) ? Number(item.value) : item.value
}))
}
},
created() {
this.getList()
},
methods: {
/** 是否值归一化:Y->1,N->0,纯数字字符串转 Number */
toYesNoValue(value) {
if (value === null || value === undefined || value === '') {
return null
}
const text = String(value)
if (text === 'Y' || text === 'y') return 1
if (text === 'N' || text === 'n') return 0
return /^\d+$/.test(text) ? Number(text) : value
},
/** 查询教室信息列表 */
getList() {
this.loading = true
@@ -217,6 +294,8 @@ export default {
roomLocation: null,
capacity: 50,
roomStatus: 1,
multimedia: 0,
projector: 0,
remark: null
}
this.resetForm('form')
@@ -249,6 +328,10 @@ export default {
const classRoomId = row.classRoomId || this.ids
getClassroom(classRoomId).then(response => {
this.form = response.data
console.log("multimedia==="+this.form.multimedia);
// 归一化是否值,保证与单选选项(数值)类型一致,避免回显不选中
//this.$set(this.form, 'multimedia', /^\d+$/.test(String(this.form.multimedia)) ? Number(this.form.multimedia) : this.form.multimedia)
//this.$set(this.form, 'projector', /^\d+$/.test(String(this.form.projector)) ? Number(this.form.projector) : this.form.projector)
this.open = true
this.title = '修改教室信息'
})