sakura 1 год назад
Родитель
Сommit
04a6fb059a

+ 11 - 0
school-in-out-admin/src/main/java/com/schoolinout/web/controller/system/TeacherClassRelationController.java

@@ -47,4 +47,15 @@ public class TeacherClassRelationController extends BaseController {
     public AjaxResult bindTeacherClass(@Validated @RequestBody AddTeacherClassRelationDto form) {
         return toAjax(teacherClassRelationService.bindTeacherClass(form));
     }
+
+    /**
+     * 搜索 教师绑定的班级
+     *
+     * @param teacherId
+     * @return
+     */
+    @GetMapping("/search/{teacherId}")
+    public AjaxResult searchTeacherBindClass(@PathVariable Long teacherId) {
+        return success(teacherClassRelationService.listTeacherBindClass(teacherId));
+    }
 }

+ 2 - 0
school-in-out-system/src/main/java/com/schoolinout/system/mapper/TeacherClassRelationMapper.java

@@ -85,4 +85,6 @@ public interface TeacherClassRelationMapper extends BaseMapper<TeacherClassRelat
     void deleteRelationBatchForClassId(@Param("schoolId") Long schoolId, @Param("teacherId") Long teacherId, @Param("list") List<Long> classIdsToRemove);
 
     void insertRelationBatchForClassId(@Param("schoolId") Long schoolId, @Param("teacherId") Long teacherId, @Param("list") List<Long> newClassIds);
+
+    List<Long> selectTeacherBindClass(Long teacherId);
 }

+ 8 - 0
school-in-out-system/src/main/java/com/schoolinout/system/service/ITeacherClassRelationService.java

@@ -85,4 +85,12 @@ public interface ITeacherClassRelationService {
      * @return 结果
      */
     public String bindClassTeacherMain(BindClassTeacherMain form);
+
+    /**
+     * 搜索教师绑定的班级列表
+     *
+     * @param teacherId 教师id
+     * @return 返回绑定的班级id
+     */
+    public List<Long> listTeacherBindClass(Long teacherId);
 }

+ 7 - 0
school-in-out-system/src/main/java/com/schoolinout/system/service/impl/TeacherClassRelationServiceImpl.java

@@ -122,6 +122,8 @@ public class TeacherClassRelationServiceImpl implements ITeacherClassRelationSer
         List<Long> newClassIds = form.getClassId();
         if (newClassIds == null || newClassIds.isEmpty()) {
             teacherClassRelationMapper.deleteAllRelationsForClass(form.getSchoolId(), null, form.getTeacherId());
+        } else if (existingClassIds == null || existingClassIds.isEmpty()) {
+            teacherClassRelationMapper.insertRelationBatchForClassId(form.getSchoolId(), form.getTeacherId(), newClassIds);
         } else {
             // 计算要删除的id
             List<Long> classIdsToRemove = existingClassIds.stream()
@@ -187,4 +189,9 @@ public class TeacherClassRelationServiceImpl implements ITeacherClassRelationSer
 
         return ans;
     }
+
+    @Override
+    public List<Long> listTeacherBindClass(Long teacherId) {
+        return teacherClassRelationMapper.selectTeacherBindClass(teacherId);
+    }
 }

+ 5 - 0
school-in-out-system/src/main/resources/mapper/system/TeacherClassRelationMapper.xml

@@ -86,6 +86,11 @@
             AND teacher_main = 'Y'
         </where>
     </select>
+    <select id="selectTeacherBindClass" resultType="java.lang.Long">
+        select class_id
+        from tb_school_teacher_class_relation
+        where teacher_id = #{teacherId}
+    </select>
 
 
     <insert id="insertTeacherClassRelation" parameterType="TeacherClassRelation" useGeneratedKeys="true"

+ 8 - 0
school-in-out-ui/src/api/system/teacher_class_relation.js

@@ -26,4 +26,12 @@ export function teacherBindClass(data) {
     method: 'post',
     data
   })
+}
+
+// 获取关系列表
+export function searchTeacherBindClass(teacherId) {
+  return request({
+    url: '/system/relation/search/' + teacherId,
+    method: 'get',
+  })
 }

+ 1 - 1
school-in-out-ui/src/components/DictTag/index.vue

@@ -22,7 +22,7 @@
       </template>
     </template>
     <template v-if="unmatch && showValue">
-      {{ unmatchArray | handleArray }} ajja
+      {{ unmatchArray | handleArray }} 
     </template>
   </div>
 </template>

+ 4 - 4
school-in-out-ui/src/views/system/access_log/index.vue

@@ -24,7 +24,7 @@
     </el-form>
 
     <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
+      <!-- <el-col :span="1.5">
         <el-button
           type="primary"
           plain
@@ -44,7 +44,7 @@
           @click="handleUpdate"
           v-hasPermi="['system:access_log:edit']"
         >修改</el-button>
-      </el-col>
+      </el-col> -->
       <el-col :span="1.5">
         <el-button
           type="danger"
@@ -100,13 +100,13 @@
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
+          <!-- <el-button
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['system:access_log:edit']"
-          >修改</el-button>
+          >修改</el-button> -->
           <el-button
             size="mini"
             type="text"

+ 5 - 2
school-in-out-ui/src/views/system/clazz/index.vue

@@ -332,6 +332,7 @@ export default {
 			this.reset();
 			this.$refs.clazzForm.open = true;
 			this.$refs.clazzForm.title = '添加班级';
+			setTimeout(() => {this.$refs.clazzForm.loading =false}, 500)
 		},
 		/** 修改按钮操作 */
 		handleUpdate(row) {
@@ -342,8 +343,10 @@ export default {
 				this.$refs.clazzForm.open = true;
 				this.$refs.clazzForm.title = '修改班级信息';
 				this.$refs.clazzForm.searchTeacherOption(true);
-				this.$refs.clazzForm.schoolOptions =
-					this.dictTables.schoolDict;
+				this.$refs.clazzForm.schoolOptions = this.dictTables.schoolDict;
+				
+			}).finally(() => {
+				setTimeout(() => {this.$refs.clazzForm.loading =false}, 500)
 			});
 		},
 		/** 提交按钮 */

+ 5 - 1
school-in-out-ui/src/views/system/clazz/module/BindTeacherClass.vue

@@ -102,7 +102,11 @@ export default {
                         this.closeDialog();
                         // 重置列表
                         this.$emit('resetTable');
-                        this.loading = false
+                       
+                    }).finally(() => {
+                        setTimeout(() => {
+                            this.loading = false;
+                        }, 500)
                     })
                 }
             })

+ 3 - 3
school-in-out-ui/src/views/system/clazz/module/ClassStudentList.vue

@@ -11,13 +11,13 @@
 			:data="tableData" 
 			height="380" border 
 			style="width: 100%">
-			<el-table-column prop="schoolName" label="学校">
+			<!-- <el-table-column prop="schoolName" label="学校">
 			</el-table-column>
 			<el-table-column prop="className" label="班级">
-			</el-table-column>
+			</el-table-column> -->
 			<el-table-column prop="studentName" label="姓名">
 			</el-table-column>
-			<el-table-column prop="className" label="班级">
+			<el-table-column prop="studentNum" label="学号">
 			</el-table-column>
 			<el-table-column
 				label="学生照片"

+ 11 - 9
school-in-out-ui/src/views/system/clazz/module/ClazzForm.vue

@@ -2,17 +2,19 @@
     <div class="box">
         <!-- 添加或修改班级管理对话框 -->
         <el-dialog 
-            v-loading="loading"  
-            :element-loading-text="'正在' + title + '...'"
-            element-loading-spinner="el-icon-loading"
-            element-loading-background="rgba(0, 0, 0, 0.8)"
             :title="title" 
             :close-on-click-modal="false" 
             :visible.sync="open" 
             width="500px" 
             append-to-body
         >
-            <el-form ref="Cform" :model="form" :rules="rules" label-width="80px">
+            <el-form
+             v-loading="loading"  
+             ref="Cform" 
+             :model="form" 
+             :rules="rules" 
+             label-width="80px"
+            >
                 <el-form-item label="所属学校" prop="schoolId">
                     <el-select 
                         v-model="form.schoolId" 
@@ -71,7 +73,7 @@ export default {
     mixins: [Textyixia],
     data() {
         return {
-            loading: false,
+            loading: true,
             open: false,
             title: '',
             // 教师下拉框数据
@@ -131,7 +133,6 @@ export default {
                 }else{
                     console.log('====');
                 }
-               
             })
            
         },
@@ -151,8 +152,9 @@ export default {
                 createTime: null,
                 updateBy: null,
                 updateTime: null
-      };
-             this.resetForm("form");
+            };
+            this.loading = true;
+            this.resetForm("form");
         }
     }
 }

+ 4 - 1
school-in-out-ui/src/views/system/teacher/index.vue

@@ -192,7 +192,7 @@
 				<el-form-item label="所属学校" prop="schoolId">
 					<el-select
 						v-model="form.schoolId"
-						:disabled="form.schoolId !== null"
+						:disabled="disabled"
 						placeholder="请选择学校"
 						style="width: 100%"
 					>
@@ -295,6 +295,7 @@ export default {
 			},
 			// 表单参数
 			form: {},
+			disabled: false,
 			// 表单校验
 			rules: {
 				schoolId: [
@@ -336,6 +337,7 @@ export default {
 		this.getList();
 		this.dictTableData('tb_school,school_name,id').then(data => {
 			this.dictTables.schoolDict = data;
+			console.log(this.this.dictTables.schoolDict);
 		});
 	},
 	methods: {
@@ -395,6 +397,7 @@ export default {
 		handleUpdate(row) {
 			this.reset();
 			const id = row.id || this.ids;
+			this.disabled = true
 			getTeacher(id).then(response => {
 				this.form = response.data;
 				this.open = true;

+ 18 - 5
school-in-out-ui/src/views/system/teacher/module/BindClassTeacher.vue

@@ -1,6 +1,6 @@
 <template>
-    <el-dialog title="绑定班级" :visible.sync="classVisible" width="30%" center>
-      <el-form label-position="right" label-width="80px" :model="bindClassTeacherForm">
+    <el-dialog  title="绑定班级" :visible.sync="classVisible" width="30%" center>
+      <el-form v-loading="load" label-position="right" label-width="80px" :model="bindClassTeacherForm">
         <el-form-item label="老师姓名" prop="teacherName">
           <el-input v-model="bindClassTeacherForm.teacherName" disabled placeholder="请输入老师姓名" />
         </el-form-item>
@@ -31,7 +31,7 @@
 
 <script>
 import { listClazzOption } from '@/api/system/clazz'
-import {teacherBindClass} from '@/api/system/teacher_class_relation'
+import {teacherBindClass, searchTeacherBindClass} from '@/api/system/teacher_class_relation'
 export default {
     props: {
         dictTables: {
@@ -48,15 +48,27 @@ export default {
             // 班级下拉列表
             clazzOption: [],
             bindOptionLoding: false,
-            classVisible: false
+            classVisible: false,
+            load: true,
         }
     },
     methods: {
          /** 绑定班级按钮操作 */
         handleBindClass(row) {
             // this.reset();
+            this.load = true
             this.classVisible = true
             this.bindClassTeacherForm = row
+     
+            // 发送请求
+            searchTeacherBindClass(row.id).then(res => {
+              this.bindClassTeacherForm.classId = res.data
+              this.searchClassOption(true)
+            }).finally(() => {
+              setTimeout(() => {
+                this.load = false
+              }, 500)
+            })
         },
         submitBindClassForm() {
             let fomrData = {
@@ -69,8 +81,9 @@ export default {
                 this.$message.success("操作成功");
                 this.classVisible = false;
                 this.bindClassTeacherForm = {}
+                
                 // 父组件调用刷新列表方法
-                this.$$emit('ok')
+                this.$emit('ok')
             })
         },
         /** 懒加载班级列表 */

BIN
uploadPath/upload/2024/01/09/1_20240109161358A001.jpg