example.vue 2.22 KB
<template>
 
  <el-table :data="tableData" border style="width: 100%">
    <el-table-column prop="title" label="题号" align="center"></el-table-column>
    <el-table-column prop="questionType" label="题型" align="center">
      <template slot-scope="scoped">{{
        setSubPro(scoped.row.questionType)
      }}</template>
    </el-table-column>
    <el-table-column prop="answeredNum" label="答题人数" sortable align="center"></el-table-column>
    <el-table-column prop="correctAnswerNum" label="答对人数" sortable align="center"></el-table-column>
    <el-table-column prop="participationRate" label="班级参与度" sortable align="center"><template slot-scope="scoped">{{
      scoped.row.participationRate }}%</template></el-table-column>
    <el-table-column prop="classCorrectRate" label="班级正确率" sortable align="center"><template slot-scope="scoped">{{
      scoped.row.classCorrectRate }}%</template></el-table-column>
    <el-table-column prop="answerCorrectRate" label="已答正确率" sortable align="center"><template slot-scope="scoped">{{
      scoped.row.answerCorrectRate }}%</template></el-table-column>
    <el-table-column prop="correctAnswer" label="正确答案" align="center">
      <template slot-scope="scoped">{{
        scoped.row.correctAnswer == 1
        ? "✓"
        : scoped.row.correctAnswer == 2
          ? "✗"
          : scoped.row.correctAnswer
      }}</template></el-table-column>
    <el-table-column prop="fallible" label="干扰答案" align="center"><template slot-scope="scoped">{{
      scoped.row.fallible == 1
      ? "✓"
      : scoped.row.fallible == 2
        ? "✗"
        : scoped.row.fallible
    }}</template></el-table-column>
  </el-table>
</template>
<script>
export default {
  props: {
    tableData: Array,
  },
  data() {
    return {};
  },
  created() { },
  methods: {
    setSubPro(type) {
      let tit;
      switch (type) {
        case 2:
          tit = "单选题";
          break;
        case 3:
          tit = "多选题";
          break;
        case 4:
          tit = "判断题";
          break;
        case 5:
          tit = "主观题";
          break;
        default:
          tit = "其他";
      }
      return tit;
    },
  }
};
</script>