123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897 |
- <template>
- <div>
- <section class="content" style="margin-top: -10px;">
- <div class="box box-info">
- <!-- 头信息 -->
- <div
- class="box-header with-border"
- style="background-color:#D3DCE6;margin-bottom:20px;"
- >
- <h3 class="box-title">学生管理</h3>
- <div class="box-tools pull-right">
- <button
- type="button"
- class="btn btn-box-tool"
- data-widget="collapse"
- >
- <i class="fa fa-minus"></i>
- </button>
- </div>
- </div>
- <!-- 正文信息 -->
- <div class="box-body">
- <el-form
- :inline="true"
- :model="formSearch"
- label-position="right"
- label-width="80px"
- >
- <el-form-item
- v-if="isSuperAdmin"
- label="顶级机构"
- class="pull-left"
- >
- <el-select
- style="width: 180px"
- class="input_width_lg"
- v-model="formSearch.rootOrgId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in rootOrgList"
- :label="item.name"
- :value="item.id"
- :key="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="姓名" class="pull-left">
- <el-input
- placeholder="请输入姓名"
- v-model="formSearch.name"
- ></el-input>
- </el-form-item>
- <el-form-item label="学号" class="pull-left">
- <el-input
- placeholder="请输入学号"
- v-model="formSearch.studentCode"
- ></el-input>
- </el-form-item>
- <el-form-item label="身份证" class="pull-left">
- <el-input
- placeholder="请输入身份证"
- v-model="formSearch.identityNumber"
- ></el-input>
- </el-form-item>
- <el-form-item class="pull-right buttonframe">
- <el-button
- v-if="rolePrivileges.search_student"
- size="small"
- type="primary"
- icon="search"
- @click="searchForm"
- >查询
- </el-button>
- <el-button
- v-if="rolePrivileges.upload_student_photo"
- size="small"
- type="info"
- @click="uploadPhoto"
- >上传照片
- </el-button>
- <el-button
- v-if="rolePrivileges.reset_student_password"
- size="small"
- type="warning"
- @click="resetPassword('');"
- >重置密码
- </el-button>
- <el-button
- v-if="rolePrivileges.change_student_availability"
- size="small"
- type="success"
- @click="enableStudent('');"
- >启用
- </el-button>
- <el-button
- v-if="rolePrivileges.change_student_availability"
- size="small"
- type="danger"
- @click="disableStudent('');"
- >禁用
- </el-button>
- </el-form-item>
- </el-form>
- <!-- 页面列表 -->
- <el-table
- :data="tableData"
- border
- style="width: 100%;text-align:center;"
- @selection-change="selectChange"
- >
- <el-table-column type="selection" width="50"></el-table-column>
- <el-table-column prop="id" width="100" label="ID"></el-table-column>
- <el-table-column label="考生" width="100">
- <template slot-scope="scope">
- <el-popover trigger="hover" placement="left">
- <div style="font-size: 18px;font-family: 新宋体">
- <tr>
- <td style="color: green">姓名</td>
- <td style="color:purple;padding-left: 20px;">
- {{ scope.row.name }}
- </td>
- </tr>
- <tr>
- <td style="color: green">身份证号</td>
- <td style="color:purple;padding-left: 20px;">
- {{ scope.row.identityNumber }}
- </td>
- </tr>
- <tr>
- <td style="color: green">学号</td>
- <td style="color:purple;padding-left: 20px;">
- {{ scope.row.studentCode }}
- </td>
- </tr>
- <tr>
- <td style="color: green">学习中心</td>
- <td style="color:purple;padding-left: 20px;">
- {{ scope.row.orgName }}
- </td>
- </tr>
- <tr>
- <td style="color: green">手机号</td>
- <td style="color:purple;padding-left: 20px;">
- {{ scope.row.phoneNumber }}
- </td>
- </tr>
- <tr>
- <td style="color: green">安全手机号</td>
- <td style="color:purple;padding-left: 20px;">
- {{ scope.row.securityPhone }}
- </td>
- </tr>
- <tr>
- <td style="color: green">创建时间</td>
- <td style="color:purple;padding-left: 20px;">
- {{ scope.row.creationTime }}
- </td>
- </tr>
- </div>
- <div slot="reference" class="name-wrapper">
- <span>{{ scope.row.name }}</span>
- </div>
- </el-popover>
- </template>
- </el-table-column>
- <el-table-column
- prop="studentCode"
- width=""
- label="学号"
- ></el-table-column>
- <el-table-column
- prop="identityNumber"
- width=""
- label="身份证"
- ></el-table-column>
- <el-table-column
- prop="updateTime"
- width="168"
- label="更新时间"
- ></el-table-column>
- <el-table-column width="100" label="状态">
- <template slot-scope="scope">
- <div>
- <span>
- <el-tag :type="getTag(scope.row.enable)">
- {{ getEnable(scope.row.enable) }}
- </el-tag>
- </span>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="450">
- <template slot-scope="scope">
- <div>
- <el-button
- size="mini"
- type="warning"
- @click="showPhoto(scope.row);"
- >查看照片
- </el-button>
- <el-button
- size="mini"
- type="warning"
- @click="showStuExamDialog(scope.row);"
- >考试记录
- </el-button>
- <el-button
- v-if="rolePrivileges.reset_student_password"
- size="mini"
- type="warning"
- @click="resetPassword(scope.row);"
- >重置密码
- </el-button>
- <el-button
- v-if="
- null != scope.row.enable &&
- !scope.row.enable &&
- rolePrivileges.change_student_availability
- "
- size="mini"
- type="success"
- @click="enableStudent(scope.row);"
- >启用
- </el-button>
- <el-button
- v-else-if="rolePrivileges.change_student_availability"
- size="mini"
- type="danger"
- @click="disableStudent(scope.row);"
- >禁用
- </el-button>
- <el-button
- v-if="rolePrivileges.unbind_student_code"
- size="mini"
- type="warning"
- @click="unbindStudentCode(scope.row);"
- >解绑学号
- </el-button>
- <el-button
- v-if="rolePrivileges.unbind_security_phone"
- size="mini"
- type="warning"
- @click="unbindSecurityPhone(scope.row);"
- >解绑安全手机
- </el-button>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <div class="page pull-right">
- <el-pagination
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-size="pageSize"
- layout="total, prev, pager, next, jumper"
- :total="total"
- >
- </el-pagination>
- </div>
- <!-- 考试记录 -->
- <el-dialog
- title="学生考试记录"
- size="small"
- :visible.sync="stuExamDialog"
- v-loading="stuExamLoading"
- element-loading-text="拼命加载中"
- >
- <el-form
- :inline="true"
- :model="stuExamSearch"
- label-position="right"
- label-width="100px"
- >
- <el-form-item label="考试" class="pull-left">
- <el-select
- class="input"
- :remote-method="queryExams4Search"
- remote
- :loading="queryExams4SearchLoading"
- filterable
- clearable
- v-model="stuExamSearch.examId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in examList4Search"
- :label="item.name"
- :value="item.id"
- :key="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item class="pull-left">
- <el-button
- size="small"
- type="primary"
- icon="search"
- @click="searchStuExam"
- >查询
- </el-button>
- </el-form-item>
- </el-form>
- <el-table
- :data="stuExamList"
- border
- style="width: 100%;text-align:center;"
- >
- <el-table-column inline-template label="学生姓名">
- <div>
- <span>{{ row.studentName }}</span>
- </div>
- </el-table-column>
- <el-table-column inline-template label="学号">
- <div>
- <span>{{ row.studentCode }}</span>
- </div>
- </el-table-column>
- <el-table-column inline-template label="身份证">
- <div>
- <span>{{ row.identityNumber }}</span>
- </div>
- </el-table-column>
- <el-table-column inline-template label="考试">
- <div>
- <span>{{ row.examName }}</span>
- </div>
- </el-table-column>
- <el-table-column inline-template label="课程">
- <div>
- <span>{{ row.courseName }}</span>
- </div>
- </el-table-column>
- <el-table-column inline-template width="100" label="考试状态">
- <div>
- <span v-if="null == row.started"></span>
- <span v-else-if="row.started">已考</span>
- <span v-else>未考</span>
- </div>
- </el-table-column>
- </el-table>
- <div class="page pull-right">
- <el-pagination
- @current-change="stuExamCurChange"
- :current-page="stuExamCurPage"
- :page-size="stuExamPageSize"
- layout="total, prev, pager, next, jumper"
- :total="stuExamTotal"
- >
- </el-pagination>
- </div>
- </el-dialog>
- <!-- 导入弹窗 -->
- <el-dialog
- title="学生照片导入页"
- size="tiny"
- :visible.sync="photoUploadDialog"
- >
- <el-form>
- <el-row>
- <el-form-item style="margin-left:30px">
- <el-upload
- class="form_left"
- ref="upload"
- list-type="picture"
- :action="uploadAction"
- :headers="uploadHeaders"
- :data="uploadData"
- :before-upload="beforeUpload"
- :on-progress="uploadProgress"
- :on-success="uploadSuccess"
- :on-error="uploadError"
- :file-list="fileList"
- :auto-upload="false"
- :multiple="false"
- >
- <el-button size="small" slot="trigger" type="primary"
- >选择文件
- </el-button>
- <el-button
- size="small"
- style="margin-left:10px;"
- type="success"
- @click="submitUpload"
- >确认上传
- </el-button>
- <div slot="tip" class="el-upload__tip">
- 只能上传jpg,png文件
- </div>
- </el-upload>
- </el-form-item>
- </el-row>
- </el-form>
- </el-dialog>
- <el-dialog title="照片" :visible.sync="photoDialog">
- <div class="student_photo">
- <img :src="photo.url" alt="学生照片" height="20%" width="30%" />
- </div>
- </el-dialog>
- </div>
- </div>
- </section>
- </div>
- </template>
- <script>
- import {
- CORE_API,
- EXAM_WORK_API,
- EXCHANGE_API
- } from "@/constants/constants.js";
- import { mapState } from "vuex";
- export default {
- data() {
- return {
- rolePrivileges: {
- search_student: false,
- upload_student_photo: false,
- reset_student_password: false,
- change_student_availability: false,
- unbind_student_code: false,
- unbind_security_phone: false
- },
- isSuperAdmin: false,
- rootOrgList: null,
- stuExamLoading: false,
- button: {},
- formSearch: {
- rootOrgId: null,
- name: "",
- studentCode: "",
- identityNumber: "",
- enable: ""
- },
- selectedStuIds: [],
- statusList: [
- {
- value: true,
- label: "启用"
- },
- {
- value: false,
- label: "禁用"
- }
- ],
- tableData: [],
- currentPage: 1,
- pageSize: 10,
- total: 10,
- photoDialog: false,
- photo: { url: "" },
- errMessages: [],
- uploadAction: EXCHANGE_API + "/facepp/add",
- uploadData: {},
- fileLoading: false,
- fileList: [],
- uploadHeaders: {},
- photoUploadDialog: false,
- stuExamCurPage: 1,
- stuExamPageSize: 10,
- stuExamTotal: 10,
- stuExamDialog: false,
- stuExamList: [],
- examList4Search: [],
- queryExams4SearchLoading: false,
- stuExamSearch: {
- rootOrgId: "",
- examId: "",
- studentCode: "",
- studentName: "",
- orgId: "",
- specialtyName: "",
- courseCode: "",
- courseName: "",
- infoCollector: "",
- identityNumber: "",
- identityNumberLike: false,
- withStarted: true
- }
- };
- },
- computed: {
- ...mapState({ user: state => state.user }),
- stuIds() {
- var stuIds = "";
- for (let stuId of this.selectedStuIds) {
- if (!stuIds) {
- stuIds += stuId;
- } else {
- stuIds += "," + stuId;
- }
- }
- return stuIds;
- }
- },
- methods: {
- queryExams4Search(name) {
- this.queryExams(name, "search");
- },
- queryExams(name, where) {
- console.log("queryExams; name: " + name);
- if ("search" == where) {
- this.queryExams4SearchLoading = true;
- }
- this.$http
- .get(EXAM_WORK_API + "/exam/queryByNameLike?name=" + name)
- .then(response => {
- if ("search" == where) {
- this.queryExams4SearchLoading = false;
- this.examList4Search = response.body;
- }
- })
- .catch(response => {
- if (response.status == 500) {
- this.$notify({
- showClose: true,
- message: response.body.desc,
- type: "error"
- });
- }
- if ("search" == where) {
- this.queryExams4SearchLoading = false;
- }
- });
- },
- closeStuExamDialog() {
- this.stuExamDialog = false;
- },
- showStuExamDialog(row) {
- this.stuExamSearch.identityNumber = row.identityNumber;
- this.stuExamList = [];
- this.stuExamTotal = 0;
- this.searchStuExam();
- this.stuExamDialog = true;
- },
- searchStuExam() {
- var param = new URLSearchParams(this.stuExamSearch);
- this.stuExamLoading = true;
- var url =
- EXAM_WORK_API +
- "/exam_student/examStudentPage/" +
- (this.stuExamCurPage - 1) +
- "/" +
- this.stuExamPageSize +
- "?" +
- param;
- this.$http
- .get(url)
- .then(response => {
- this.stuExamList = response.data.list;
- this.stuExamTotal = response.data.total;
- this.stuExamLoading = false;
- })
- .catch(function(response) {
- if (response.status == 500) {
- this.$notify({
- showClose: true,
- message: response.body.desc,
- type: "error"
- });
- }
- this.stuExamLoading = false;
- });
- },
- stuExamCurChange(val) {
- this.stuExamCurPage = val;
- this.stuExamSearch.page = val - 1;
- this.searchStuExam();
- },
- showPhoto(row) {
- if (row.photoPath) {
- this.photo.url = row.photoPath;
- this.photoDialog = true;
- } else {
- this.$notify({
- showClose: true,
- message: "未上传照片",
- type: "error"
- });
- }
- },
- uploadPhoto() {
- this.photoUploadDialog = true;
- this.initUpload();
- },
- selectChange(row) {
- this.selectedStuIds = [];
- row.forEach((element, index) => {
- console.log(index);
- this.selectedStuIds.push(element.id);
- });
- console.log(this.selectedStuIds);
- },
- getStatus(status) {
- if (status == true) {
- return "启用";
- } else if (status == false) {
- return "禁用";
- } else {
- return "";
- }
- },
- handleCurrentChange(val) {
- this.currentPage = val;
- this.searchForm();
- },
- //查询方法
- searchForm() {
- var param = new URLSearchParams(this.formSearch);
- var url =
- CORE_API +
- "/student/studentPage/" +
- (this.currentPage - 1) +
- "/" +
- this.pageSize +
- "?" +
- param;
- this.$http
- .get(url)
- .then(response => {
- this.tableData = response.data.list;
- this.total = response.data.total;
- })
- .catch(function(response) {
- if (response.status == 500) {
- this.$notify({
- showClose: true,
- message: response.body.desc,
- type: "error"
- });
- }
- });
- },
- checkIds(row) {
- if (row) {
- return row.id;
- } else {
- if (this.stuIds.length == 0) {
- this.$notify({
- type: "warning",
- message: "请选择学生"
- });
- return "";
- } else {
- return this.stuIds;
- }
- }
- },
- unbindStudentCode(row) {
- var stuIds = this.checkIds(row);
- if (!stuIds) return;
- this.$confirm("是否解绑学号?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- var url = CORE_API + "/student/unbindStudentCode/" + stuIds;
- this.$http.put(url).then(response => {
- console.log(response);
- this.$notify({
- type: "success",
- message: "解绑成功"
- });
- this.searchForm();
- });
- });
- },
- unbindSecurityPhone(row) {
- var stuIds = this.checkIds(row);
- if (!stuIds) return;
- this.$confirm("是否解绑安全手机号?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- var url = CORE_API + "/student/unbindSecurityPhone/" + stuIds;
- this.$http.put(url).then(response => {
- console.log(response);
- this.$notify({
- type: "success",
- message: "解绑成功"
- });
- this.searchForm();
- });
- });
- },
- //重置密码方法
- resetPassword(row) {
- var stuIds = this.checkIds(row);
- if (!stuIds) return;
- this.$confirm("是否重置所选学生的密码?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- var url = CORE_API + "/student/resetPass/" + stuIds;
- this.$http.put(url).then(response => {
- console.log(response);
- this.$notify({
- type: "success",
- message: "重置密码成功"
- });
- this.searchForm();
- });
- });
- },
- //禁用
- disableStudent(row) {
- var stuIds = this.checkIds(row);
- if (!stuIds) return;
- this.$confirm("是否禁用所选学生?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- var url = CORE_API + "/student/disable/" + stuIds;
- this.$http.put(url).then(response => {
- console.log(response);
- this.$notify({
- type: "success",
- message: "禁用成功"
- });
- this.searchForm();
- });
- });
- },
- //启用
- enableStudent(row) {
- var stuIds = this.checkIds(row);
- if (!stuIds) return;
- this.$confirm("是否启用所选学生?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- var url = CORE_API + "/student/enable/" + stuIds;
- this.$http.put(url).then(response => {
- console.log(response);
- this.$notify({
- type: "success",
- message: "启用成功"
- });
- this.searchForm();
- });
- });
- },
- beforeUpload(file) {
- console.log(file);
- },
- uploadProgress(event, file, fileList) {
- console.log("uploadProgress");
- console.log(event);
- console.log(file);
- console.log(fileList);
- },
- uploadSuccess(response, file, fileList) {
- console.log(response);
- console.log(file);
- console.log(fileList);
- this.$notify({
- message: "上传成功",
- type: "success"
- });
- this.fileLoading = false;
- this.photoUploadDialog = false;
- this.searchForm();
- },
- uploadError(response, file, fileList) {
- console.log(response);
- console.log(file);
- console.log(fileList);
- var jsonStr = response.message.substring(4);
- var resp = eval("(" + jsonStr + ")");
- if (response.status == 500) {
- this.$notify({
- message: resp.desc,
- type: "error"
- });
- }
- this.fileLoading = false;
- },
- initUpload() {
- this.fileList = [];
- },
- checkUpload() {
- var fileList = this.$refs.upload.uploadFiles;
- if (fileList.length == 0) {
- this.$notify({
- message: "上传文件不能为空",
- type: "error"
- });
- return false;
- }
- if (fileList.length > 1) {
- this.$notify({
- message: "每次只能上传一个文件",
- type: "error"
- });
- return false;
- }
- for (let file of fileList) {
- let f = file.name.toLowerCase();
- if (!f.endsWith(".jpg") && !f.endsWith(".png")) {
- this.$notify({
- message: "上传文件必须为jpg或者png格式",
- type: "error"
- });
- this.initUpload();
- return false;
- }
- }
- return true;
- },
- //确定上传
- submitUpload() {
- if (!this.checkUpload()) {
- return false;
- }
- this.$refs.upload.submit();
- this.fileLoading = true;
- },
- //清空文件
- removeFile() {
- this.$refs.upload.clearFiles();
- },
- getTag(status) {
- if (status == true) {
- return "success";
- } else if (status == false) {
- return "danger";
- } else {
- return status;
- }
- },
- getEnable(enable) {
- if (enable == true) {
- return "启用";
- } else if (enable == false) {
- return "禁用";
- } else {
- return "启用";
- }
- },
- initPrivileges() {
- let params = new URLSearchParams({
- privilegeCodes: Object.keys(this.rolePrivileges).toString()
- });
- let url = CORE_API + "/rolePrivilege/checkPrivileges?" + params;
- this.$http.post(url).then(response => {
- this.rolePrivileges = response.data;
- });
- },
- init() {
- this.initPrivileges();
- for (let role of this.user.roleList) {
- if (role.roleCode == "SUPER_ADMIN") {
- this.isSuperAdmin = true;
- break;
- }
- }
- var url = CORE_API + "/org/getRootOrgList";
- this.$http.get(url).then(response => {
- this.rootOrgList = response.data;
- this.formSearch.rootOrgId = this.user.rootOrgId;
- this.searchForm();
- });
- }
- },
- created() {
- this.init();
- this.uploadHeaders = {
- key: this.user.key,
- token: this.user.token
- };
- }
- };
- </script>
- <style scoped></style>
|