From 81e1b297b1fabec596c1cb7187ce2d6199026429 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Thu, 30 Nov 2023 16:51:10 +0800
Subject: [PATCH] 模拟考试成绩查询

---
 src/views/exam/scoreManage.vue                   |  259 +++++++++++++++++++++++++++++++++++++++++++++++++++
 src/api/simulateExamRecord/simulateExamRecord.js |   13 ++
 2 files changed, 272 insertions(+), 0 deletions(-)

diff --git a/src/api/simulateExamRecord/simulateExamRecord.js b/src/api/simulateExamRecord/simulateExamRecord.js
new file mode 100644
index 0000000..022c7f0
--- /dev/null
+++ b/src/api/simulateExamRecord/simulateExamRecord.js
@@ -0,0 +1,13 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/simulateExamRecord/page',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
diff --git a/src/views/exam/scoreManage.vue b/src/views/exam/scoreManage.vue
new file mode 100644
index 0000000..31816f6
--- /dev/null
+++ b/src/views/exam/scoreManage.vue
@@ -0,0 +1,259 @@
+<template>
+  <basic-container
+    :class="[
+      'exam-card-body',
+      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
+    ]"
+  >
+    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page"
+               :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave"
+               @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
+               @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
+               @refresh-change="refreshChange" @on-load="onLoad">
+    </avue-crud>
+  </basic-container>
+</template>
+
+<script>
+import { getList} from "@/api/simulateExamRecord/simulateExamRecord"
+import { mapGetters } from "vuex"
+export default {
+  name: "scoreManage",
+  data(){
+    return{
+      form: {},
+      query: {},
+      loading: true,
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+      option: {
+        height: 'auto',
+        calcHeight: 160,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        border: true,
+        index: true,
+        indexLabel: '序号',
+        searchBtnText: '查 询',
+        emptyBtnText: '重 置',
+        emptyBtnIcon: 'el-icon-refresh',
+        viewBtn: false,
+        selection: false,
+        dialogClickModal: false,
+        header: false,
+        refreshBtn: false,
+        columnBtn: false,
+        searchShowBtn: false,
+        delBtn:false,
+        editBtn:false,
+        menu:false,
+
+        column: [
+          {
+            label: "姓名",
+            prop: "userName",
+            search:true,
+          },
+
+          {
+            label: "手机号",
+            prop: "phone",
+            search:true,
+          },
+
+          {
+            label: "得分",
+            prop: "score",
+          },
+
+          {
+            label: "考试状态",
+            prop: "status",
+            type: 'select',
+            props:{
+              label:'name',
+              value:'code'
+            },
+            dicData:[
+              {
+              name:'考试中',
+              code:1
+              },
+              {
+              name:'暂停考试',
+              code:2
+            },
+              {
+                name:'考试完成',
+                code:3
+              },
+              {
+                name:'考试已废弃',
+                code:4
+              },
+            ]
+          },
+
+          {
+            label: "剩余考试时长",
+            prop: "answerTime",
+          },
+
+          {
+            label: "开始时间",
+            prop: "startTime",
+          },
+          {
+            label: "结束时间",
+            prop: "endTime",
+          },
+        ]
+      },
+      data: [],
+    }
+  },
+  computed: {
+    ...mapGetters(["permission","userInfo"]),
+    permissionList () {
+      return {
+        addBtn: this.vaildData(this.permission.patrolRecord_add, false),
+        viewBtn: this.vaildData(this.permission.patrolRecord_view, true),
+        delBtn: this.vaildData(this.permission.patrolRecord_delete, false),
+        editBtn: this.vaildData(this.permission.patrolRecord_edit, false)
+      }
+    },
+    ids () {
+      let ids = []
+      this.selectionList.forEach(ele => {
+        ids.push(ele.id)
+      })
+      return ids.join(",")
+    }
+  },
+  methods: {
+    rowSave (row, done, loading) {
+      add(row).then(() => {
+        this.onLoad(this.page)
+        this.$message({
+          type: "success",
+          message: "操作成功!"
+        })
+        done()
+      }, error => {
+        loading()
+      })
+    },
+    rowUpdate (row, index, done, loading) {
+      update(row).then(() => {
+        this.onLoad(this.page)
+        this.$message({
+          type: "success",
+          message: "操作成功!"
+        })
+        done()
+      }, error => {
+        loading()
+      })
+    },
+    rowDel (row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          return remove(row.id)
+        })
+        .then(() => {
+          this.onLoad(this.page)
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          })
+        })
+    },
+    handleDelete () {
+      if (this.selectionList.length === 0) {
+        this.$message.warning("请选择至少一条数据")
+        return
+      }
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          return remove(this.ids)
+        })
+        .then(() => {
+          this.onLoad(this.page)
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          })
+          this.$refs.crud.toggleSelection()
+        })
+    },
+    beforeOpen (done, type) {
+      if (["edit", "view"].includes(type)) {
+        getDetail(this.form.id).then(res => {
+          this.form = res.data.data
+        })
+      }
+      done()
+    },
+    searchReset () {
+      this.query = {}
+      this.onLoad(this.page)
+    },
+    searchChange (params, done) {
+      this.query = params
+      this.page.currentPage = 1
+      this.onLoad(this.page, params)
+      done()
+    },
+    selectionChange (list) {
+      this.selectionList = list
+    },
+    selectionClear () {
+      this.selectionList = []
+      this.$refs.crud.toggleSelection()
+    },
+    currentChange (currentPage) {
+      this.page.currentPage = currentPage
+    },
+    sizeChange (pageSize) {
+      this.page.pageSize = pageSize
+    },
+    refreshChange () {
+      this.onLoad(this.page, this.query)
+    },
+    onLoad (page, params = {}) {
+      this.loading = true
+
+
+      //对于管理员可以查看全部,对于其他角色只能查看本公司
+     if (this.userInfo.role_name != "administrator"){
+       params.deptId = this.userInfo.dept_id
+     }
+
+      getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+        const data = res.data.data
+        this.page.total = data.total
+        this.data = data.records
+        this.loading = false
+        this.selectionClear()
+      })
+    },
+
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

--
Gitblit v1.9.3