123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- <template>
- <div>
- <el-form :model="form" inline>
- <el-form-item label="姓名">
- <el-input v-model.trim="form.name"></el-input>
- </el-form-item>
- <el-form-item label="证件号">
- <el-input v-model.trim="form.identity"></el-input>
- </el-form-item>
- <el-form-item label="状态">
- <StateSelect v-model="form.enable"></StateSelect>
- </el-form-item>
- <el-button @click="searchForm">查询</el-button>
- </el-form>
- <el-table :data="tableData" stripe style="width: 100%;">
- <el-table-column type="selection" width="42" />
- <el-table-column width="100" label="ID">
- <span slot-scope="scope">{{ scope.row.id }}</span>
- </el-table-column>
- <el-table-column width="100" label="姓名">
- <span slot-scope="scope">{{ scope.row.name }}</span>
- </el-table-column>
- <el-table-column width="200" label="证件号">
- <span slot-scope="scope">{{ scope.row.identity }}</span>
- </el-table-column>
- <el-table-column width="100" label="机构">
- <span slot-scope="scope">{{ scope.row.orgName }}</span>
- </el-table-column>
- <el-table-column width="120" label="状态">
- <span slot-scope="scope">{{
- scope.row.enable | zeroOneEnableDisableFilter
- }}</span>
- </el-table-column>
- <el-table-column width="120" label="照片">
- <span slot-scope="scope">
- <el-button
- size="mini"
- type="primary"
- plain
- @click="openBasePhotoDialog(scope.row.basePhotoPath)"
- v-if="scope.row.basePhotoPath"
- >
- 查看底照
- </el-button>
- <span v-else>无底照</span>
- </span>
- </el-table-column>
- <el-table-column width="120" label="更新人">
- <span slot-scope="scope">{{ scope.row.updateName }}</span>
- </el-table-column>
- <el-table-column sortable width="170" label="更新时间">
- <span slot-scope="scope">{{
- scope.row.updateTime | datetimeFilter
- }}</span>
- </el-table-column>
- <el-table-column :context="_self" label="操作" width="260">
- <div slot-scope="scope">
- <el-button
- size="mini"
- type="primary"
- plain
- @click="openExamRecord(scope.row)"
- >
- 考试记录
- </el-button>
- <el-button
- size="mini"
- type="primary"
- plain
- @click="resetStudentPassword(scope.row)"
- >
- 重置密码
- </el-button>
- <el-button
- size="mini"
- type="primary"
- plain
- @click="toggleEnableStudent(scope.row)"
- >
- {{ !scope.row.enable | booleanEnableDisableFilter }}
- </el-button>
- </div>
- </el-table-column>
- </el-table>
- <div class="page float-right">
- <el-pagination
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-size="pageSize"
- :page-sizes="[10, 20, 50, 100, 200, 300]"
- @size-change="handleSizeChange"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- />
- </div>
- <el-dialog
- title="底照"
- :visible.sync="basePhotoDialogVisible"
- destroy-on-close
- >
- <img :src="selectedBasePhoto" style="width: 400px;" />
- </el-dialog>
- <StudentManagementDialog ref="theDialog" :student="selectedStudent" />
- </div>
- </template>
- <script>
- import {
- searchStudents,
- toggleEnableStudent,
- resetStudentPassword,
- } from "@/api/examwork-student";
- import StudentManagementDialog from "./StudentManagementDialog";
- export default {
- name: "StudentManagement",
- data() {
- return {
- form: {
- name: "",
- identity: "",
- enable: null,
- },
- tableData: [],
- currentPage: 1,
- pageSize: 10,
- total: 10,
- basePhotoDialogVisible: false,
- selectedBasePhoto: null,
- selectedStudent: {},
- };
- },
- components: { StudentManagementDialog },
- async created() {},
- methods: {
- async searchForm() {
- const res = await searchStudents({
- enable: this.form.enable,
- name: this.form.name,
- pageNumber: this.currentPage,
- pageSize: this.pageSize,
- });
- this.tableData = res.data.data.records;
- // this.tableData.forEach(
- // (v) =>
- // (v.basePhotoPath =
- // "https://ecs-test-static.qmth.com.cn/org_logo/0/1597046412749.png")
- // );
- this.total = res.data.data.total;
- },
- handleCurrentChange(val) {
- this.currentPage = val;
- this.searchForm();
- },
- handleSizeChange(val) {
- this.pageSize = val;
- this.currentPage = 1;
- this.searchForm();
- },
- openBasePhotoDialog(url) {
- this.selectedBasePhoto = url;
- this.basePhotoDialogVisible = true;
- },
- openExamRecord(user) {
- this.selectedStudent = user;
- this.$refs.theDialog.openDialog();
- },
- async toggleEnableStudent(user) {
- await toggleEnableStudent({
- id: user.id,
- enable: user.enable === 0 ? 1 : 0,
- });
- this.searchForm();
- },
- async resetStudentPassword(user) {
- await resetStudentPassword({
- id: user.id,
- password: "123456",
- });
- this.searchForm();
- },
- },
- };
- </script>
- <style></style>
|