Ver código fonte

fast:完成学生管理

sakura 1 ano atrás
pai
commit
f53427c4b7

+ 16 - 0
school-in-out-system/src/main/java/com/schoolinout/system/domain/AccessLog.java

@@ -31,6 +31,13 @@ public class AccessLog extends BaseEntity {
     private Long id;
 
     /**
+     * 学校id
+     */
+    @Excel(name = "学校id")
+    @Schema(description = "学校id")
+    private Long schoolId;
+
+    /**
      * 学生id
      */
     @Excel(name = "学生id")
@@ -98,11 +105,20 @@ public class AccessLog extends BaseEntity {
         this.delFlag = delFlag;
     }
 
+    public Long getSchoolId() {
+        return schoolId;
+    }
+
+    public void setSchoolId(Long schoolId) {
+        this.schoolId = schoolId;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                 .append("id", getId())
                 .append("studentId", getStudentId())
+                .append("schoolId", getSchoolId())
                 .append("inTime", getInTime())
                 .append("outTime", getOutTime())
                 .append("delFlag", getDelFlag())

+ 39 - 23
school-in-out-system/src/main/resources/mapper/system/AccessLogMapper.xml

@@ -1,42 +1,54 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.schoolinout.system.mapper.AccessLogMapper">
-    
+
     <resultMap type="AccessLog" id="AccessLogResult">
-        <result property="id"    column="id"    />
-        <result property="studentId"    column="student_id"    />
-        <result property="inTime"    column="in_time"    />
-        <result property="outTime"    column="out_time"    />
-        <result property="delFlag"    column="del_flag"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="updateBy"    column="update_by"    />
-        <result property="updateTime"    column="update_time"    />
+        <result property="id" column="id"/>
+        <result property="studentId" column="student_id"/>
+        <result property="schoolId" column="school_id"/>
+        <result property="inTime" column="in_time"/>
+        <result property="outTime" column="out_time"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
     </resultMap>
 
     <sql id="selectAccessLogVo">
-        select id, student_id, in_time, out_time, del_flag, create_by, create_time, update_by, update_time from tb_school_access_log
+        select id,
+               student_id,
+               school_id,
+               in_time,
+               out_time,
+               del_flag,
+               create_by,
+               create_time,
+               update_by,
+               update_time
+        from tb_school_access_log
     </sql>
 
     <select id="selectAccessLogList" parameterType="AccessLog" resultMap="AccessLogResult">
         <include refid="selectAccessLogVo"/>
-        <where>  
-            <if test="studentId != null "> and student_id = #{studentId}</if>
-            <if test="inTime != null "> and in_time = #{inTime}</if>
-            <if test="outTime != null "> and out_time = #{outTime}</if>
+        <where>
+            <if test="studentId != null ">and student_id = #{studentId}</if>
+            <if test="inTime != null ">and in_time = #{inTime}</if>
+            <if test="outTime != null ">and out_time = #{outTime}</if>
         </where>
     </select>
-    
+
     <select id="selectAccessLogById" parameterType="Long" resultMap="AccessLogResult">
         <include refid="selectAccessLogVo"/>
         where id = #{id}
     </select>
-        
+
     <insert id="insertAccessLog" parameterType="AccessLog" useGeneratedKeys="true" keyProperty="id">
         insert into tb_school_access_log
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="schoolId != null">student_id = #{schoolId},</if>
             <if test="studentId != null">student_id,</if>
             <if test="inTime != null">in_time,</if>
             <if test="outTime != null">out_time,</if>
@@ -45,8 +57,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="schoolId != null">student_id = #{schoolId},</if>
             <if test="studentId != null">#{studentId},</if>
             <if test="inTime != null">#{inTime},</if>
             <if test="outTime != null">#{outTime},</if>
@@ -55,13 +68,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateAccessLog" parameterType="AccessLog">
         update tb_school_access_log
         <trim prefix="SET" suffixOverrides=",">
             <if test="studentId != null">student_id = #{studentId},</if>
+            <if test="schoolId != null">student_id = #{schoolId},</if>
             <if test="inTime != null">in_time = #{inTime},</if>
             <if test="outTime != null">out_time = #{outTime},</if>
             <if test="delFlag != null">del_flag = #{delFlag},</if>
@@ -74,11 +88,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteAccessLogById" parameterType="Long">
-        delete from tb_school_access_log where id = #{id}
+        delete
+        from tb_school_access_log
+        where id = #{id}
     </delete>
 
     <delete id="deleteAccessLogByIds" parameterType="String">
-        delete from tb_school_access_log where id in 
+        delete from tb_school_access_log where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>

+ 3 - 0
school-in-out-ui/src/assets/styles/ruoyi.scss

@@ -294,6 +294,9 @@
   text-overflow: ellipsis;
   overflow: hidden;
 }
+.w100 {
+  width: 100%;
+}
 
 // bind icon
 .el-icon-bind{

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

@@ -71,16 +71,31 @@
 
     <el-table v-loading="loading" :data="access_logList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="id" align="center" prop="id" />
-      <el-table-column label="学生id" align="center" prop="studentId" />
+      <el-table-column label="序号" align="center" type="index" />
+      <el-table-column label="所属学校" align="center">
+				<template slot-scope="scope">
+					<dict-tag
+						:options="dictTables.schoolDict"
+						:value="scope.row.schoolId"
+					/>
+				</template>
+			</el-table-column>
+      <el-table-column label="学生" align="center" prop="studentId">
+        <template slot-scope="scope">
+					<dict-tag
+						:options="dictTables.studentDict"
+						:value="scope.row.studentId"
+					/>
+				</template>
+      </el-table-column>
       <el-table-column label="到校时间" align="center" prop="inTime" width="180">
         <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.inTime, '{y}-{m}-{d}') }}</span>
+          <span>{{ parseTime(scope.row.inTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
         </template>
       </el-table-column>
       <el-table-column label="离校时间" align="center" prop="outTime" width="180">
         <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.outTime, '{y}-{m}-{d}') }}</span>
+          <span>{{ parseTime(scope.row.outTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
         </template>
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -117,22 +132,21 @@
         <el-form-item label="到校时间" prop="inTime">
           <el-date-picker clearable
             v-model="form.inTime"
-            type="date"
-            value-format="yyyy-MM-dd"
+            type="datetime"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            style="width: 100%;"
             placeholder="请选择到校时间">
           </el-date-picker>
         </el-form-item>
         <el-form-item label="离校时间" prop="outTime">
           <el-date-picker clearable
             v-model="form.outTime"
-            type="date"
-            value-format="yyyy-MM-dd"
+            type="datetime"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            style="width: 100%;"
             placeholder="请选择离校时间">
           </el-date-picker>
         </el-form-item>
-        <el-form-item label="删除标志" prop="delFlag">
-          <el-input v-model="form.delFlag" placeholder="请输入删除标志" />
-        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -144,9 +158,10 @@
 
 <script>
 import { listAccess_log, getAccess_log, delAccess_log, addAccess_log, updateAccess_log } from "@/api/system/access_log";
-
+import Textyixia from '@/mixin/Textyixia';
 export default {
   name: "Access_log",
+  mixins: [Textyixia],
   data() {
     return {
       // 遮罩层
@@ -182,11 +197,23 @@ export default {
         studentId: [
           { required: true, message: "学生id不能为空", trigger: "change" }
         ],
+      },
+      // 字典
+      dictTables: {
+        schoolDict: [],
+        studentDict: [],
       }
     };
   },
   created() {
     this.getList();
+    this.dictTableData('tb_school,school_name,id').then(data => {
+			this.dictTables.schoolDict = data;
+		});
+		this.dictTableData('tb_school_student,student_name,id').then(data => {
+      console.log('aaaa', data);
+			this.dictTables.studentDict = data;
+		});
   },
   methods: {
     /** 查询进出学校记录列表 */

+ 559 - 355
school-in-out-ui/src/views/system/student/index.vue

@@ -1,366 +1,570 @@
 <template>
-  <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="学生名称" prop="studentName">
-        <el-input
-          v-model="queryParams.studentName"
-          placeholder="请输入学生名称"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="学生性别" prop="studentGender">
-        <el-select v-model="queryParams.studentGender" placeholder="请选择学生性别" clearable>
-          <el-option
-            v-for="dict in dict.type.sys_user_sex"
-            :key="dict.value"
-            :label="dict.label"
-            :value="dict.value"
-          />
-        </el-select>
-      </el-form-item>
-      <el-form-item label="学号" prop="studentNum">
-        <el-input
-          v-model="queryParams.studentNum"
-          placeholder="请输入学号"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </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>
-      </el-form-item>
-    </el-form>
+	<div class="app-container">
+		<el-form
+			:model="queryParams"
+			ref="queryForm"
+			size="small"
+			:inline="true"
+			v-show="showSearch"
+			label-width="68px"
+		>
+			<el-form-item label="学生名称" prop="studentName">
+				<el-input
+					v-model="queryParams.studentName"
+					placeholder="请输入学生名称"
+					clearable
+					@keyup.enter.native="handleQuery"
+				/>
+			</el-form-item>
+			<el-form-item label="学生性别" prop="studentGender">
+				<el-select
+					v-model="queryParams.studentGender"
+					placeholder="请选择学生性别"
+					clearable
+				>
+					<el-option
+						v-for="dict in dict.type.sys_user_sex"
+						:key="dict.value"
+						:label="dict.label"
+						:value="dict.value"
+					/>
+				</el-select>
+			</el-form-item>
+			<el-form-item label="学号" prop="studentNum">
+				<el-input
+					v-model="queryParams.studentNum"
+					placeholder="请输入学号"
+					clearable
+					@keyup.enter.native="handleQuery"
+				/>
+			</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
+				>
+			</el-form-item>
+		</el-form>
 
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-          v-hasPermi="['system:student:add']"
-        >新增</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-          v-hasPermi="['system:student:edit']"
-        >修改</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-          v-hasPermi="['system:student:remove']"
-        >删除</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-          v-hasPermi="['system:student:export']"
-        >导出</el-button>
-      </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
+		<el-row :gutter="10" class="mb8">
+			<el-col :span="1.5">
+				<el-button
+					type="primary"
+					plain
+					icon="el-icon-plus"
+					size="mini"
+					@click="handleAdd"
+					v-hasPermi="['system:student:add']"
+					>新增</el-button
+				>
+			</el-col>
+			<el-col :span="1.5">
+				<el-button
+					type="success"
+					plain
+					icon="el-icon-edit"
+					size="mini"
+					:disabled="single"
+					@click="handleUpdate"
+					v-hasPermi="['system:student:edit']"
+					>修改</el-button
+				>
+			</el-col>
+			<el-col :span="1.5">
+				<el-button
+					type="danger"
+					plain
+					icon="el-icon-delete"
+					size="mini"
+					:disabled="multiple"
+					@click="handleDelete"
+					v-hasPermi="['system:student:remove']"
+					>删除</el-button
+				>
+			</el-col>
+			<el-col :span="1.5">
+				<el-button
+					type="warning"
+					plain
+					icon="el-icon-download"
+					size="mini"
+					@click="handleExport"
+					v-hasPermi="['system:student:export']"
+					>导出</el-button
+				>
+			</el-col>
+			<right-toolbar
+				:showSearch.sync="showSearch"
+				@queryTable="getList"
+			></right-toolbar>
+		</el-row>
 
-    <el-table v-loading="loading" :data="studentList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="序号" align="center" type="index"/>
-      <!-- todo 显示 学校名称 -->
-      <el-table-column label="所属学校" align="center">
-        <template slot-scope="scope">
-          <dict-tag :options="dictTables.schoolDict" :value="scope.row.schoolId" />
-        </template>
-      </el-table-column>
-      <el-table-column label="所属班级" align="center" prop="classId" >
-        <template slot-scope="scope">
-          <dict-tag :options="dictTables.classDict" :value="scope.row.classId" />
-        </template>
-      </el-table-column>
+		<el-table
+			v-loading="loading"
+			:data="studentList"
+			@selection-change="handleSelectionChange"
+		>
+			<el-table-column type="selection" width="55" align="center" />
+			<el-table-column label="序号" align="center" type="index" />
+			<!-- todo 显示 学校名称 -->
+			<el-table-column label="所属学校" align="center">
+				<template slot-scope="scope">
+					<dict-tag
+						:options="dictTables.schoolDict"
+						:value="scope.row.schoolId"
+					/>
+				</template>
+			</el-table-column>
+			<el-table-column
+				label="所属班级"
+				align="center"
+				prop="classId"
+			>
+				<template slot-scope="scope">
+					<dict-tag
+						:options="dictTables.classDict"
+						:value="scope.row.classId"
+					/>
+				</template>
+			</el-table-column>
 
-      <el-table-column label="学号" align="center" prop="studentNum" />
-      <el-table-column label="学生名称" align="center" prop="studentName" />
-      <el-table-column label="学生照片" align="center" prop="studentPic" width="100">
-        <template slot-scope="scope">
-          <image-preview :src="scope.row.studentPic" :width="50" :height="50"/>
-        </template>
-      </el-table-column>
-      <el-table-column label="学生性别" align="center" prop="studentGender">
-        <template slot-scope="scope">
-          <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.studentGender"/>
-        </template>
-      </el-table-column>
-    
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['system:student:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['system:student:remove']"
-          >删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
+			<el-table-column
+				label="学号"
+				align="center"
+				prop="studentNum"
+			/>
+			<el-table-column
+				label="学生名称"
+				align="center"
+				prop="studentName"
+			/>
+			<el-table-column
+				label="学生照片"
+				align="center"
+				prop="studentPic"
+				width="100"
+			>
+				<template slot-scope="scope">
+					<image-preview
+						:src="scope.row.studentPic"
+						:width="50"
+						:height="50"
+					/>
+				</template>
+			</el-table-column>
+			<el-table-column
+				label="学生性别"
+				align="center"
+				prop="studentGender"
+			>
+				<template slot-scope="scope">
+					<dict-tag
+						:options="dict.type.sys_user_sex"
+						:value="scope.row.studentGender"
+					/>
+				</template>
+			</el-table-column>
 
-    <!-- 添加或修改学生管理对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="所属学校" prop="schoolId">
-          <el-select v-model="form.schoolId" placeholder="请选择所属学校" clearable>
-            <el-option
-              v-for="dict in dictTables.schoolDict"
-              :key="dict.value"
-              :label="dict.label"
-              :value="dict.value"
-            ></el-option>
-          </el-select>
-        </el-form-item>
-        <!-- todo 需要修改逻辑 -->
-        <el-form-item label="所属班级" prop="classId">
-          <el-select
-            v-model="form.classId" 
-            :disabled="!form.schoolId" 
-            placeholder="请选择所属班级" clearable
-          >
-            <el-option
-              v-for="dict in dictTables.classDict"
-              :key="dict.value"
-              :label="dict.label"
-              :value="dict.value"
-            ></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="学生名称" prop="studentName">
-          <el-input v-model="form.studentName" placeholder="请输入学生名称" />
-        </el-form-item>
-        <el-form-item label="学生照片" prop="studentPic">
-          <image-upload v-model="form.studentPic"/>
-        </el-form-item>
-        <el-form-item label="学生性别" prop="studentGender">
-          <el-select v-model="form.studentGender" placeholder="请选择学生性别">
-            <el-option
-              v-for="dict in dict.type.sys_user_sex"
-              :key="dict.value"
-              :label="dict.label"
-              :value="dict.value"
-            ></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="学号" prop="studentNum">
-          <el-input v-model="form.studentNum" placeholder="请输入学号" />
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
-      </div>
-    </el-dialog>
-  </div>
+			<el-table-column
+				label="操作"
+				align="center"
+				class-name="small-padding fixed-width"
+			>
+				<template slot-scope="scope">
+					<el-button
+						size="mini"
+						type="text"
+						icon="el-icon-edit"
+						@click="handleUpdate(scope.row)"
+						v-hasPermi="['system:student:edit']"
+						>修改</el-button
+					>
+					<el-button
+						size="mini"
+						type="text"
+						icon="el-icon-delete"
+						@click="handleDelete(scope.row)"
+						v-hasPermi="['system:student:remove']"
+						>删除</el-button
+					>
+				</template>
+			</el-table-column>
+		</el-table>
+
+		<pagination
+			v-show="total > 0"
+			:total="total"
+			:page.sync="queryParams.pageNum"
+			:limit.sync="queryParams.pageSize"
+			@pagination="getList"
+		/>
+
+		<!-- 添加或修改学生管理对话框 -->
+		<el-dialog
+			:title="title"
+			:visible.sync="open"
+			width="720px"
+			append-to-body
+		>
+			<el-form
+				ref="form"
+				:model="form"
+				:rules="rules"
+				label-width="80px"
+			>
+				<el-row :gutter="24">
+					<el-col :span="12">
+						<el-form-item
+							label="所属学校"
+							prop="schoolId"
+						>
+							<el-select
+								v-model="form.schoolId"
+								placeholder="请选择所属学校"
+								clearable
+								style="width: 100%"
+							>
+								<el-option
+									v-for="dict in dictTables.schoolDict"
+									:key="dict.value"
+									:label="dict.label"
+									:value="dict.value"
+								></el-option>
+							</el-select>
+						</el-form-item>
+					</el-col>
+					<el-col :span="12">
+						<el-form-item
+							label="学生名称"
+							prop="studentName"
+						>
+							<el-input
+								v-model="form.studentName"
+								placeholder="请输入学生名称"
+							/>
+						</el-form-item>
+					</el-col>
+					<el-col :span="12">
+						<!-- todo 需要修改逻辑 -->
+						<el-form-item
+							label="所属班级"
+							prop="classId"
+						>
+							<el-select
+								v-model="form.classId"
+								:loading="optionsLoading" 
+            		loading-text="正在加载中~~~"
+								@visible-change="searchClassOption" 
+								:disabled="!form.schoolId"
+								placeholder="请选择所属班级"
+								clearable
+								style="width: 100%"
+							>
+								<el-option
+									v-for="dict in classOptions"
+									:key="dict.value"
+									:label="dict.label"
+									:value="dict.value"
+								></el-option>
+							</el-select>
+						</el-form-item>
+					</el-col>
+					<el-col :span="12">
+						<el-form-item
+							label="学生性别"
+							prop="studentGender"
+						>
+							<el-select
+								v-model="form.studentGender"
+								placeholder="请选择学生性别"
+								style="width: 100%"
+							>
+								<el-option
+									v-for="dict in dict.type
+										.sys_user_sex"
+									:key="dict.value"
+									:label="dict.label"
+									:value="dict.value"
+								></el-option>
+							</el-select>
+						</el-form-item>
+					</el-col>
+					<el-col :span="12">
+						<el-form-item
+							label="学生照片"
+							prop="studentPic"
+						>
+							<image-upload
+								:limit="1"
+								v-model="form.studentPic"
+							/>
+						</el-form-item>
+					</el-col>
+					<el-col :span="12">
+						<el-form-item
+							label="学号"
+							prop="studentNum"
+						>
+							<el-input
+								v-model="form.studentNum"
+								placeholder="请输入学号"
+							/>
+						</el-form-item>
+					</el-col>
+					
+				</el-row>
+			</el-form>
+			<div slot="footer" class="dialog-footer">
+				<el-button type="primary" @click="submitForm"
+					>确 定</el-button
+				>
+				<el-button @click="cancel">取 消</el-button>
+			</div>
+		</el-dialog>
+	</div>
 </template>
 
 <script>
-import { listStudent, getStudent, delStudent, addStudent, updateStudent } from "@/api/system/student";
-import Textyixia from "@/mixin/Textyixia"
+import { listClazzOption } from '@/api/system/clazz'
+import {
+	listStudent,
+	getStudent,
+	delStudent,
+	addStudent,
+	updateStudent,
+} from '@/api/system/student';
+import Textyixia from '@/mixin/Textyixia';
 export default {
-  name: "Student",
-  mixins: [Textyixia],
-  dicts: ['sys_user_sex'],
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 学生管理表格数据
-      studentList: [],
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        schoolId: null,
-        classId: null,
-        studentName: null,
-        studentGender: null,
-        studentNum: null,
-      },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {
-        schoolId: [
-          { required: true, message: "学校id不能为空", trigger: "change" }
-        ],
-        classId: [
-          { required: true, message: "班级id不能为空", trigger: "change" }
-        ],
-        studentName: [
-          { required: true, message: "学生名称不能为空", trigger: "blur" }
-        ],
-        studentPic: [
-          { required: true, message: "学生照片不能为空", trigger: "blur" }
-        ],
-      },
-      dictTables: {
-        schoolDict: [],
-        classDict: []
-      },
-    };
-  },
-  created() {
-    this.getList();
-    this.dictTableData("tb_school,school_name,id").then(data => {
-      this.dictTables.schoolDict = data
-    })
-    this.dictTableData("tb_school_class,class_name,id").then(data => {
-      this.dictTables.classDict = data
-    })
-  },
-  methods: {
-    /** 查询学生管理列表 */
-    getList() {
-      this.loading = true;
-      listStudent(this.queryParams).then(response => {
-        this.studentList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        schoolId: null,
-        classId: null,
-        studentName: null,
-        studentPic: null,
-        studentGender: null,
-        studentNum: null,
-        delFlag: null,
-        createBy: null,
-        createTime: null,
-        updateBy: null,
-        updateTime: null
-      };
-      this.resetForm("form");
-    },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
-    },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
-    },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加学生管理";
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const id = row.id || this.ids
-      getStudent(id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改学生管理";
-      });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateStudent(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addStudent(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除学生管理编号为"' + ids + '"的数据项?').then(function() {
-        return delStudent(ids);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('system/student/export', {
-        ...this.queryParams
-      }, `student_${new Date().getTime()}.xlsx`)
-    }
-  }
+	name: 'Student',
+	mixins: [Textyixia],
+	dicts: ['sys_user_sex'],
+	data() {
+		return {
+			// 遮罩层
+			loading: true,
+			// 选中数组
+			ids: [],
+			// 非单个禁用
+			single: true,
+			// 非多个禁用
+			multiple: true,
+			// 显示搜索条件
+			showSearch: true,
+			// 总条数
+			total: 0,
+			// 学生管理表格数据
+			studentList: [],
+			// 弹出层标题
+			title: '',
+			// 是否显示弹出层
+			open: false,
+			// 查询参数
+			queryParams: {
+				pageNum: 1,
+				pageSize: 10,
+				schoolId: null,
+				classId: null,
+				studentName: null,
+				studentGender: null,
+				studentNum: null,
+			},
+			// 表单参数
+			form: {},
+			// 表单校验
+			rules: {
+				schoolId: [
+					{
+						required: true,
+						message: '学校id不能为空',
+						trigger: 'change',
+					},
+				],
+				classId: [
+					{
+						required: true,
+						message: '班级id不能为空',
+						trigger: 'change',
+					},
+				],
+				studentName: [
+					{
+						required: true,
+						message: '学生名称不能为空',
+						trigger: 'blur',
+					},
+				],
+				studentPic: [
+					{
+						required: true,
+						message: '学生照片不能为空',
+						trigger: 'blur',
+					},
+				],
+				studentGender: [
+					{
+						required: true,
+						message: '学生性别不能为空',
+						trigger: 'change',
+					},
+				],
+				studentNum: [
+					{
+						required: true,
+						message: '学生学号不能为空',
+						trigger: 'blur',
+					},
+				],
+			},
+			dictTables: {
+				schoolDict: [],
+				classDict: [],
+			},
+			classOptions: [],
+			optionsLoading: false,
+		};
+	},
+	created() {
+		this.getList();
+		this.dictTableData('tb_school,school_name,id').then(data => {
+			this.dictTables.schoolDict = data;
+		});
+		this.dictTableData('tb_school_class,class_name,id').then(data => {
+			this.dictTables.classDict = data;
+		});
+	},
+	methods: {
+		/** 查询学生管理列表 */
+		getList() {
+			this.loading = true;
+			listStudent(this.queryParams).then(response => {
+				this.studentList = response.rows;
+				this.total = response.total;
+				this.loading = false;
+			});
+		},
+		// 取消按钮
+		cancel() {
+			this.open = false;
+			this.reset();
+		},
+		// 表单重置
+		reset() {
+			this.form = {
+				id: null,
+				schoolId: null,
+				classId: null,
+				studentName: null,
+				studentPic: null,
+				studentGender: null,
+				studentNum: null,
+				delFlag: null,
+				createBy: null,
+				createTime: null,
+				updateBy: null,
+				updateTime: null,
+			};
+			this.resetForm('form');
+		},
+		/** 搜索按钮操作 */
+		handleQuery() {
+			this.queryParams.pageNum = 1;
+			this.getList();
+		},
+		/** 重置按钮操作 */
+		resetQuery() {
+			this.resetForm('queryForm');
+			this.handleQuery();
+		},
+		// 多选框选中数据
+		handleSelectionChange(selection) {
+			this.ids = selection.map(item => item.id);
+			this.single = selection.length !== 1;
+			this.multiple = !selection.length;
+		},
+		/** 新增按钮操作 */
+		handleAdd() {
+			this.reset();
+			this.open = true;
+			this.title = '添加学生管理';
+		},
+		/** 修改按钮操作 */
+		handleUpdate(row) {
+			this.reset();
+			const id = row.id || this.ids;
+			getStudent(id).then(response => {
+				this.form = response.data;
+				this.open = true;
+				this.title = '修改学生管理';
+			});
+		},
+		/** 提交按钮 */
+		submitForm() {
+			this.$refs['form'].validate(valid => {
+				if (valid) {
+					if (this.form.id != null) {
+						updateStudent(this.form).then(response => {
+							this.$modal.msgSuccess('修改成功');
+							this.open = false;
+							this.getList();
+						});
+					} else {
+						addStudent(this.form).then(response => {
+							this.$modal.msgSuccess('新增成功');
+							this.open = false;
+							this.getList();
+						});
+					}
+				}
+			});
+		},
+		/** 删除按钮操作 */
+		handleDelete(row) {
+			const ids = row.id || this.ids;
+			this.$modal
+				.confirm(
+					'是否确认删除学生管理编号为"' +
+						ids +
+						'"的数据项?'
+				)
+				.then(function () {
+					return delStudent(ids);
+				})
+				.then(() => {
+					this.getList();
+					this.$modal.msgSuccess('删除成功');
+				})
+				.catch(() => {});
+		},
+		/** 搜索班级下拉列表 */
+		searchClassOption(openSe) {
+			if (openSe) {
+				this.optionsLoading = true
+				listClazzOption(this.form.schoolId).then(response => {
+					console.log(response);
+					this.classOptions = response.data
+					this.optionsLoading = false
+				})
+			}
+		},
+		/** 导出按钮操作 */
+		handleExport() {
+			this.download(
+				'system/student/export',
+				{
+					...this.queryParams,
+				},
+				`student_${new Date().getTime()}.xlsx`
+			);
+		},
+	},
 };
 </script>

+ 440 - 274
school-in-out-ui/src/views/system/teacher/index.vue

@@ -1,288 +1,454 @@
 <template>
-  <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="老师姓名" prop="teacherName">
-        <el-input v-model="queryParams.teacherName" placeholder="请输入老师姓名" clearable @keyup.enter.native="handleQuery" />
-      </el-form-item>
-      <el-form-item label="性别" prop="gender">
-        <el-select v-model="queryParams.gender" placeholder="请选择性别" clearable>
-          <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label" :value="dict.value" />
-        </el-select>
-      </el-form-item>
-      <el-form-item label="联系电话" prop="phone">
-        <el-input v-model="queryParams.phone" placeholder="请输入联系电话" clearable @keyup.enter.native="handleQuery" />
-      </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>
-      </el-form-item>
-    </el-form>
+	<div class="app-container">
+		<el-form
+			:model="queryParams"
+			ref="queryForm"
+			size="small"
+			:inline="true"
+			v-show="showSearch"
+			label-width="68px"
+		>
+			<el-form-item label="老师姓名" prop="teacherName">
+				<el-input
+					v-model="queryParams.teacherName"
+					placeholder="请输入老师姓名"
+					clearable
+					@keyup.enter.native="handleQuery"
+				/>
+			</el-form-item>
+			<el-form-item label="性别" prop="gender">
+				<el-select
+					v-model="queryParams.gender"
+					placeholder="请选择性别"
+					clearable
+				>
+					<el-option
+						v-for="dict in dict.type.sys_user_sex"
+						:key="dict.value"
+						:label="dict.label"
+						:value="dict.value"
+					/>
+				</el-select>
+			</el-form-item>
+			<el-form-item label="联系电话" prop="phone">
+				<el-input
+					v-model="queryParams.phone"
+					placeholder="请输入联系电话"
+					clearable
+					@keyup.enter.native="handleQuery"
+				/>
+			</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
+				>
+			</el-form-item>
+		</el-form>
 
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
-          v-hasPermi="['system:teacher:add']">新增</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
-          v-hasPermi="['system:teacher:edit']">修改</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
-          v-hasPermi="['system:teacher:remove']">删除</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
-          v-hasPermi="['system:teacher:export']">导出</el-button>
-      </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
+		<el-row :gutter="10" class="mb8">
+			<el-col :span="1.5">
+				<el-button
+					type="primary"
+					plain
+					icon="el-icon-plus"
+					size="mini"
+					@click="handleAdd"
+					v-hasPermi="['system:teacher:add']"
+					>新增</el-button
+				>
+			</el-col>
+			<el-col :span="1.5">
+				<el-button
+					type="success"
+					plain
+					icon="el-icon-edit"
+					size="mini"
+					:disabled="single"
+					@click="handleUpdate"
+					v-hasPermi="['system:teacher:edit']"
+					>修改</el-button
+				>
+			</el-col>
+			<el-col :span="1.5">
+				<el-button
+					type="danger"
+					plain
+					icon="el-icon-delete"
+					size="mini"
+					:disabled="multiple"
+					@click="handleDelete"
+					v-hasPermi="['system:teacher:remove']"
+					>删除</el-button
+				>
+			</el-col>
+			<el-col :span="1.5">
+				<el-button
+					type="warning"
+					plain
+					icon="el-icon-download"
+					size="mini"
+					@click="handleExport"
+					v-hasPermi="['system:teacher:export']"
+					>导出</el-button
+				>
+			</el-col>
+			<right-toolbar
+				:showSearch.sync="showSearch"
+				@queryTable="getList"
+			></right-toolbar>
+		</el-row>
 
-    <el-table v-loading="loading" :data="teacherList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="序号" align="center" type="index" />
-      <!-- todo 显示 学校名称 -->
-      <el-table-column label="所属学校" align="center">
-        <template slot-scope="scope">
-          <dict-tag :options="dictTables.schoolDict" :value="scope.row.schoolId" />
-        </template>
-      </el-table-column>
+		<el-table
+			v-loading="loading"
+			:data="teacherList"
+			@selection-change="handleSelectionChange"
+		>
+			<el-table-column type="selection" width="55" align="center" />
+			<el-table-column label="序号" align="center" type="index" />
+			<!-- todo 显示 学校名称 -->
+			<el-table-column label="所属学校" align="center">
+				<template slot-scope="scope">
+					<dict-tag
+						:options="dictTables.schoolDict"
+						:value="scope.row.schoolId"
+					/>
+				</template>
+			</el-table-column>
 
-      <el-table-column label="老师姓名" align="center" prop="teacherName" />
-      <el-table-column label="性别" align="center" prop="gender">
-        <template slot-scope="scope">
-          <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.gender" />
-        </template>
-      </el-table-column>
-      <el-table-column label="联系电话" align="center" prop="phone" />
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
-            v-hasPermi="['system:teacher:edit']">修改</el-button>
-          <el-button size="mini" type="text" @click="handleBindClass(scope.row)">
-            <i class="el-icon-bind"></i>
-            绑定班级
-          </el-button>
-          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
-            v-hasPermi="['system:teacher:remove']">删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
+			<el-table-column
+				label="老师姓名"
+				align="center"
+				prop="teacherName"
+			/>
+			<el-table-column label="性别" align="center" prop="gender">
+				<template slot-scope="scope">
+					<dict-tag
+						:options="dict.type.sys_user_sex"
+						:value="scope.row.gender"
+					/>
+				</template>
+			</el-table-column>
+			<el-table-column label="联系电话" align="center" prop="phone" />
+			<el-table-column
+				label="操作"
+				align="center"
+				class-name="small-padding fixed-width"
+			>
+				<template slot-scope="scope">
+					<el-button
+						size="mini"
+						type="text"
+						icon="el-icon-edit"
+						@click="handleUpdate(scope.row)"
+						v-hasPermi="['system:teacher:edit']"
+						>修改</el-button
+					>
+					<el-button
+						size="mini"
+						type="text"
+						@click="handleBindClass(scope.row)"
+					>
+						<i class="el-icon-bind"></i>
+						绑定班级
+					</el-button>
+					<el-button
+						size="mini"
+						type="text"
+						icon="el-icon-delete"
+						@click="handleDelete(scope.row)"
+						v-hasPermi="['system:teacher:remove']"
+						>删除</el-button
+					>
+				</template>
+			</el-table-column>
+		</el-table>
 
-    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
-      @pagination="getList" />
+		<pagination
+			v-show="total > 0"
+			:total="total"
+			:page.sync="queryParams.pageNum"
+			:limit.sync="queryParams.pageSize"
+			@pagination="getList"
+		/>
 
-    <!-- 添加或修改教师管理对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="所属学校" prop="schoolId">
-          <el-select v-model="form.schoolId" :disabled='form.schoolId !== null' placeholder="请选择学校" style="width: 100%;">
-            <el-option v-for="dict in dictTables.schoolDict" :key="dict.value" :label="dict.label"
-              :value="dict.value"></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="老师姓名" prop="teacherName">
-          <el-input v-model="form.teacherName" placeholder="请输入老师姓名" />
-        </el-form-item>
-        <el-form-item label="性别" prop="gender">
-          <el-select v-model="form.gender" placeholder="请选择性别" style="width: 100%;">
-            <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label"
-              :value="dict.value"></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="联系电话" prop="phone">
-          <el-input v-model="form.phone" placeholder="请输入联系电话" />
-        </el-form-item>
+		<!-- 添加或修改教师管理对话框 -->
+		<el-dialog
+			:title="title"
+			:visible.sync="open"
+			width="500px"
+			append-to-body
+		>
+			<el-form ref="form" :model="form" :rules="rules" label-width="80px">
+				<el-form-item label="所属学校" prop="schoolId">
+					<el-select
+						v-model="form.schoolId"
+						:disabled="form.schoolId !== null"
+						placeholder="请选择学校"
+						style="width: 100%"
+					>
+						<el-option
+							v-for="dict in dictTables.schoolDict"
+							:key="dict.value"
+							:label="dict.label"
+							:value="dict.value"
+						></el-option>
+					</el-select>
+				</el-form-item>
+				<el-form-item label="老师姓名" prop="teacherName">
+					<el-input
+						v-model="form.teacherName"
+						placeholder="请输入老师姓名"
+					/>
+				</el-form-item>
+				<el-form-item label="性别" prop="gender">
+					<el-select
+						v-model="form.gender"
+						placeholder="请选择性别"
+						style="width: 100%"
+					>
+						<el-option
+							v-for="dict in dict.type.sys_user_sex"
+							:key="dict.value"
+							:label="dict.label"
+							:value="dict.value"
+						></el-option>
+					</el-select>
+				</el-form-item>
+				<el-form-item label="联系电话" prop="phone">
+					<el-input
+						v-model="form.phone"
+						placeholder="请输入联系电话"
+					/>
+				</el-form-item>
+			</el-form>
+			<div slot="footer" class="dialog-footer">
+				<el-button type="primary" @click="submitForm">确 定</el-button>
+				<el-button @click="cancel">取 消</el-button>
+			</div>
+		</el-dialog>
 
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
-      </div>
-    </el-dialog>
-
-    <!-- 绑定班级对话框 -->
-    <bind-class-teacher
-      ref="bindClassTeacher"
-      :dictTables="dictTables"
-      @ok="getList"
-    />
-  </div>
+		<!-- 绑定班级对话框 -->
+		<bind-class-teacher
+			ref="bindClassTeacher"
+			:dictTables="dictTables"
+			@ok="getList"
+		/>
+	</div>
 </template>
 
 <script>
-import { listTeacher, getTeacher, delTeacher, addTeacher, updateTeacher } from "@/api/system/teacher";
-import Textyixia from "@/mixin/Textyixia"
-import BindClassTeacher from './module/BindClassTeacher'
+import {
+	listTeacher,
+	getTeacher,
+	delTeacher,
+	addTeacher,
+	updateTeacher,
+} from '@/api/system/teacher';
+import Textyixia from '@/mixin/Textyixia';
+import BindClassTeacher from './module/BindClassTeacher';
 
 export default {
-  name: "Teacher",
-  mixins: [Textyixia],
-  dicts: ['sys_user_sex'],
-  components: {
-    BindClassTeacher
-  },
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 教师管理表格数据
-      teacherList: [],
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        schoolId: null,
-        teacherName: null,
-        gender: null,
-        phone: null,
-      },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {
-        schoolId: [
-          { required: true, message: "学校id不能为空", trigger: "change" }
-        ],
-        teacherName: [
-          { required: true, message: "老师姓名不能为空", trigger: "blur" }
-        ],
-        gender: [
-          { required: true, message: "性别;0男   1女不能为空", trigger: "change" }
-        ],
-        phone: [
-          { required: true, message: "联系电话不能为空", trigger: "blur" }
-        ],
-      },
-      dictTables: {
-        schoolDict: [],
-        classDict: []
-      },
-    };
-  },
-  created() {
-    this.getList();
-    this.dictTableData("tb_school,school_name,id").then(data => {
-      this.dictTables.schoolDict = data
-    })
-  },
-  methods: {
-    /** 查询教师管理列表 */
-    getList() {
-      this.loading = true;
-      listTeacher(this.queryParams).then(response => {
-        this.teacherList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        schoolId: null,
-        teacherName: null,
-        gender: null,
-        phone: null,
-        delFlag: null,
-        createBy: null,
-        createTime: null,
-        updateBy: null,
-        updateTime: null
-      };
-      this.resetForm("form");
-    },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
-    },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length !== 1
-      this.multiple = !selection.length
-    },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加教师管理";
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const id = row.id || this.ids
-      getTeacher(id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改教师管理";
-      });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateTeacher(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addTeacher(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除教师管理编号为"' + ids + '"的数据项?').then(function () {
-        return delTeacher(ids);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => { });
-    },
-    /** 绑定班级按钮操作 */
-    handleBindClass(row) {
-      this.$refs.bindClassTeacher.handleBindClass(row);
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('system/teacher/export', {
-        ...this.queryParams
-      }, `teacher_${new Date().getTime()}.xlsx`)
-    }
-  }
+	name: 'Teacher',
+	mixins: [Textyixia],
+	dicts: ['sys_user_sex'],
+	components: {
+		BindClassTeacher,
+	},
+	data() {
+		return {
+			// 遮罩层
+			loading: true,
+			// 选中数组
+			ids: [],
+			// 非单个禁用
+			single: true,
+			// 非多个禁用
+			multiple: true,
+			// 显示搜索条件
+			showSearch: true,
+			// 总条数
+			total: 0,
+			// 教师管理表格数据
+			teacherList: [],
+			// 弹出层标题
+			title: '',
+			// 是否显示弹出层
+			open: false,
+			// 查询参数
+			queryParams: {
+				pageNum: 1,
+				pageSize: 10,
+				schoolId: null,
+				teacherName: null,
+				gender: null,
+				phone: null,
+			},
+			// 表单参数
+			form: {},
+			// 表单校验
+			rules: {
+				schoolId: [
+					{
+						required: true,
+						message: '学校id不能为空',
+						trigger: 'change',
+					},
+				],
+				teacherName: [
+					{
+						required: true,
+						message: '老师姓名不能为空',
+						trigger: 'blur',
+					},
+				],
+				gender: [
+					{
+						required: true,
+						message: '性别;0男   1女不能为空',
+						trigger: 'change',
+					},
+				],
+				phone: [
+					{
+						required: true,
+						message: '联系电话不能为空',
+						trigger: 'blur',
+					},
+				],
+			},
+			dictTables: {
+				schoolDict: [],
+				classDict: [],
+			},
+		};
+	},
+	created() {
+		this.getList();
+		this.dictTableData('tb_school,school_name,id').then(data => {
+			this.dictTables.schoolDict = data;
+		});
+	},
+	methods: {
+		/** 查询教师管理列表 */
+		getList() {
+			this.loading = true;
+			listTeacher(this.queryParams).then(response => {
+				this.teacherList = response.rows;
+				this.total = response.total;
+				this.loading = false;
+			});
+		},
+		// 取消按钮
+		cancel() {
+			this.open = false;
+			this.reset();
+		},
+		// 表单重置
+		reset() {
+			this.form = {
+				id: null,
+				schoolId: null,
+				teacherName: null,
+				gender: null,
+				phone: null,
+				delFlag: null,
+				createBy: null,
+				createTime: null,
+				updateBy: null,
+				updateTime: null,
+			};
+			this.resetForm('form');
+		},
+		/** 搜索按钮操作 */
+		handleQuery() {
+			this.queryParams.pageNum = 1;
+			this.getList();
+		},
+		/** 重置按钮操作 */
+		resetQuery() {
+			this.resetForm('queryForm');
+			this.handleQuery();
+		},
+		// 多选框选中数据
+		handleSelectionChange(selection) {
+			this.ids = selection.map(item => item.id);
+			this.single = selection.length !== 1;
+			this.multiple = !selection.length;
+		},
+		/** 新增按钮操作 */
+		handleAdd() {
+			this.reset();
+			this.open = true;
+			this.title = '添加教师管理';
+		},
+		/** 修改按钮操作 */
+		handleUpdate(row) {
+			this.reset();
+			const id = row.id || this.ids;
+			getTeacher(id).then(response => {
+				this.form = response.data;
+				this.open = true;
+				this.title = '修改教师管理';
+			});
+		},
+		/** 提交按钮 */
+		submitForm() {
+			this.$refs['form'].validate(valid => {
+				if (valid) {
+					if (this.form.id != null) {
+						updateTeacher(this.form).then(response => {
+							this.$modal.msgSuccess('修改成功');
+							this.open = false;
+							this.getList();
+						});
+					} else {
+						addTeacher(this.form).then(response => {
+							this.$modal.msgSuccess('新增成功');
+							this.open = false;
+							this.getList();
+						});
+					}
+				}
+			});
+		},
+		/** 删除按钮操作 */
+		handleDelete(row) {
+			const ids = row.id || this.ids;
+			this.$modal
+				.confirm('是否确认删除教师管理编号为"' + ids + '"的数据项?')
+				.then(function () {
+					return delTeacher(ids);
+				})
+				.then(() => {
+					this.getList();
+					this.$modal.msgSuccess('删除成功');
+				})
+				.catch(() => {});
+		},
+		/** 绑定班级按钮操作 */
+		handleBindClass(row) {
+			this.$refs.bindClassTeacher.handleBindClass(row);
+		},
+		/** 导出按钮操作 */
+		handleExport() {
+			this.download(
+				'system/teacher/export',
+				{
+					...this.queryParams,
+				},
+				`teacher_${new Date().getTime()}.xlsx`
+			);
+		},
+	},
 };
 </script>

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

@@ -78,9 +78,9 @@ export default {
             if (openSelect) {
                 this.bindOptionLoding = true
                 listClazzOption(this.bindClassTeacherForm.schoolId).then(response => {
-                console.log(response);
-                this.clazzOption = response.data
-                this.bindOptionLoding = false
+                  console.log(response);
+                  this.clazzOption = response.data
+                  this.bindOptionLoding = false
                 })
             }
         },