Administrator
2022-04-11 79d9fc857559982b00b68b2d709807bdc4cd286f
src/views/trainExam/examStatistics.vue
@@ -1,8 +1,4 @@
/*
 * @Author: zhongrj
 * @Date: 2022-01-18
 * menu-name 考试统计查询
 */
/* * @Author: zhongrj * @Date: 2022-01-18 * menu-name 考试统计查询 */
<template>
  <el-row class="morpheus-box-paper">
    <el-col :span="24">
@@ -10,7 +6,7 @@
        <div
          :class="[
            'exam-card-body',
            $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '',
            $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : ''
          ]"
        >
          <avue-crud
@@ -80,7 +76,14 @@
      size="60%"
    >
      <div style="position: absolute;top: 3.5rem;left: 1rem;">
          <el-button type="warning" icon="el-icon-download" plain size="mini" @click="exportExamInfo">导出</el-button>
        <el-button
          type="warning"
          icon="el-icon-download"
          plain
          size="mini"
          @click="exportExamInfo"
          >导出</el-button
        >
      </div>
      <div style="height: 40%">
        <!-- <avue-crud
@@ -143,11 +146,7 @@
            </el-table-column>
            <el-table-column prop="ycnum" label="审查异常人数" align="center">
            </el-table-column>
            <el-table-column
              prop="qknum"
              label="缺考人数"
              align="center"
            >
            <el-table-column prop="qknum" label="缺考人数" align="center">
            </el-table-column>
            <el-table-column
              prop="absentProportion"
@@ -206,7 +205,11 @@
            </el-table-column>
            <el-table-column prop="allGrade" label="平均分" align="center">
            </el-table-column>
            <el-table-column prop="qualified" label="考试成绩状态" align="center">
            <el-table-column
              prop="qualified"
              label="考试成绩状态"
              align="center"
            >
              <template slot-scope="scope">
                {{
                  scope.row.qualified == 0
@@ -243,7 +246,7 @@
<script>
import {
  getExamStatistics,
  getExamInfoByExamId,
  getExamInfoByExamId
} from "@/api/examapi/examination";
import { mapGetters } from "vuex";
import Qs from "qs";
@@ -252,7 +255,7 @@
import Legend from "@/components/liu-legend/Legend";
export default {
  components: {
    Legend,
    Legend
  },
  data() {
    return {
@@ -294,7 +297,7 @@
            search: true,
            searchSpan: 5,
            searchLabelWidth: 110,
            overHidden: true,
            overHidden: true
            // width:180,
          },
          {
@@ -310,49 +313,49 @@
              {
                required: true,
                message: "请选择考试时间",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "考试时间",
            prop: "startTime",
            type: "datetime",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd"
          },
          {
            label: "报名人数",
            prop: "znum",
            prop: "znum"
          },
          {
            label: "机考人数",
            prop: "yknum",
            prop: "yknum"
          },
          {
            label: "纸质考试人数",
            prop: "zznum",
            prop: "zznum"
          },
          {
            label: "缺考人数",
            prop: "qknum",
            prop: "qknum"
          },
          {
            label: "审查异常人数",
            prop: "ycnum",
            prop: "ycnum"
          },
          {
            label: "已取消考试人数",
            prop: "qxnum",
          },
        ],
            prop: "qxnum"
          }
        ]
      },
      option: {
        // 操作栏多余按钮去除
        delBtn: false,
        editBtn: false,
        addBtn: false,
        menu: false,
        menu: true,
        //合计
        showSummary: true,
        viewBtn: false,
@@ -372,67 +375,67 @@
            // search:true,
            // searchSpan:5,
            searchLabelWidth: 110,
            overHidden: true,
            overHidden: true
          },
          {
            label: "报名人数",
            prop: "znum",
            prop: "znum"
          },
          {
            label: "审查异常人数",
            prop: "ycnum",
            prop: "ycnum"
          },
          {
            label: "缺考/纸质考试人数",
            prop: "qknum",
            prop: "qknum"
          },
          {
            label: "缺考/纸质占比(%)",
            prop: "absentProportion",
            prop: "absentProportion"
          },
          {
            label: "及格人数",
            prop: "yknum",
            prop: "yknum"
          },
          {
            label: "及格人数占比(%)",
            prop: "qualifiedProportion",
          },
            prop: "qualifiedProportion"
          }
        ],
        sumColumnList: [
          {
            label: "合计:",
            name: "deptName",
            name: "deptName"
          },
          {
            name: "znum",
            type: "sum",
            type: "sum"
          },
          {
            name: "ycnum",
            type: "sum",
            type: "sum"
          },
          {
            name: "qknum",
            type: "sum",
            type: "sum"
          },
          {
            name: "absentProportion",
            type: "avg",
            type: "avg"
          },
          {
            name: "yknum",
            type: "sum",
            type: "sum"
          },
          {
            name: "qualifiedProportion",
            type: "avg",
            type: "avg"
          },
          {
            name: "znum",
            type: "sum",
          },
        ],
            type: "sum"
          }
        ]
      },
      questionBankSearch: {},
      search: {},
@@ -445,24 +448,24 @@
        pageSize: 10,
        currentPage: 1,
        total: 16,
        ...this.$store.state.control.changePageSize,
        ...this.$store.state.control.changePageSize
      },
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
        total: 0
      },
      questionBankQuery: {},
      query: {},
      questionBankSelectionList: [],
      selectionList: [],
      selectionList: []
    };
  },
  mounted() {},
  computed: {
    ids() {
      let ids = [];
      this.questionBankSelectionList.forEach((ele) => {
      this.questionBankSelectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
@@ -473,27 +476,27 @@
        addBtn: this.vaildData(null, false),
        viewBtn: this.vaildData(null, false),
        delBtn: this.vaildData(null, false),
        editBtn: this.vaildData(null, false),
        editBtn: this.vaildData(null, false)
      };
    },
    }
  },
  watch: {},
  methods: {
    //导出考试统计数据
    exportExamInfo(){
    exportExamInfo() {
      this.$confirm("是否导出考试统计情况数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      }).then(() => {
        //获取查询条件
        var data = {
          companyName: this.companyName,
          examDate: this.startTime,
          trainUnitId: this.trainUnitId,
          examType: 2,
          examType: 2
        };
        console.log(data,11225111);
        console.log(data, 11225111);
        //序列号url形式,用&拼接
        data = Qs.stringify(data);
        window.open(
@@ -517,15 +520,15 @@
          return;
        }
        if (index === 5) {
          sums[index] = (sums[4]/sums[2]*100).toFixed(2);
          sums[index] = ((sums[4] / sums[2]) * 100).toFixed(2);
          return;
        }
        if (index === 7) {
          sums[index] = (sums[6]/sums[2]*100).toFixed(2);
          sums[index] = ((sums[6] / sums[2]) * 100).toFixed(2);
          return;
        }
        const values = data.map((item) => Number(item[column.property]));
        if (!values.every((value) => isNaN(value))) {
        const values = data.map(item => Number(item[column.property]));
        if (!values.every(value => isNaN(value))) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
@@ -551,7 +554,7 @@
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.questionBankQuery)
      ).then((res) => {
      ).then(res => {
        const data = res.data.data;
        this.questionBankPage.total = data.total;
        this.questionBankData = data.records;
@@ -563,7 +566,7 @@
      params["startTime"] = this.startTime;
      params["trainUnitId"] = this.trainUnitId;
      getExamInfoByExamId(1, 20, Object.assign(params, this.query)).then(
        (res) => {
        res => {
          const data = res.data.data;
          this.data = data.records;
        }
@@ -577,7 +580,7 @@
      params["trainUnitId"] = this.trainUnitId;
      params["examType"] = 2;
      getList(page.currentPage, page.pageSize, Object.assign(params)).then(
        (res) => {
        res => {
          const data = res.data.data;
          that.page.total = data.total;
          that.dataDetail = data.records;
@@ -640,8 +643,8 @@
      this.title = row.schoolName + row.startTime + "考试情况";
      this.onLoad(this.page);
      this.onLoadDetail(this.page);
    },
  },
    }
  }
};
</script>