龚焕茏
2024-06-07 e8d84774b46145df1c36e5a27e4b60154df4a179
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!-- 答卷管理 -->
<template>
  <div class="c">
    <div class="bg">
      <div class="main">
        <!-- 待返回的标题 -->
        <TitleIndex title="答卷管理" />
        <div class="content">
          <!-- 搜索 -->
          <div>
            <el-form :inline="true" :model="queryParam" class="demo-form-inline" label-width="80px">
              <el-form-item>
                <el-input v-model="queryParam.name" placeholder="请输入名称" clearable></el-input>
              </el-form-item>
              <el-form-item>
                <el-select v-model="queryParam.subjectId" placeholder="请选择科目" clearable multiple @change="search">
                  <el-option v-for="item in subjects" :key="item.id" :value="item.id" :label="item.name"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item>
                <el-button style="width:100px;" type="primary" size="small" @click="search()">查询</el-button>
              </el-form-item>
            </el-form>
          </div>
          <!-- 表格 -->
          <el-table v-loading="listLoading" :data="tableData" border style="width: 100%;">
            <el-table-column align="center" prop="paperName" label="名称" />
            <el-table-column align="center" prop="subjectName" label="科目" />
            <el-table-column align="center" prop="paperType" label="试卷类型" width="150px">
              <template slot-scope="{row}">
                <span v-if="row.paperType === 1">固定试卷</span>
                <span v-if="row.paperType === 2">随机试卷</span>
                <span v-if="row.paperType === 3">顺序试卷</span>
              </template>
            </el-table-column>
            <el-table-column align="center" prop="questionCount" label="题目数量" width="100px" />
            <el-table-column align="center" prop="systemScore" label="总分" width="100px" />
            <el-table-column align="center" prop="suggestTime" label="建议时长" width="100px" />
            <el-table-column align="center" prop="personAnswerNum" label="参考人数" width="100px">
              <template slot-scope="{row}">
                <span>{{ row.personAnswerNum + "/" + row.personTotalNum }}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" prop="userName" label="创建人" width="100px" />
            <el-table-column label="操作" align="center">
              <template slot-scope="{row}">
                <el-button size="mini" @click="view(row)">查看</el-button>
              </template>
            </el-table-column>
          </el-table>
          <pagination v-show="total > 0" :total="total" :page.sync="queryParam.pageIndex"
            :limit.sync="queryParam.pageSize" @pagination="search" />
        </div>
      </div>
    </div>
  </div>
</template>
<script>
// 引入彈出窗口組件
import subjectApi from '@/api/subject'
import examPaperAnwserApi from '@/api/examPaperAnswer'
import Pagination from '@/components/Pagination'
 
export default {
  // 注册
  components: {
    Pagination
  },
  data() {
    return {
      listLoading: true,
      queryParam: {
        name: '',
        pageIndex: 1,
        pageSize: 10
      },
      formLoading: false,
      total: 0,
      tableData: [],
      visible: false,
      subjects: []
    };
  },
  created() {
    this.search()
    this.getSubjects();
  },
  methods: {
    // 获取科目
    getSubjects() {
      subjectApi.list().then(re => {
        this.subjects = re.data
      })
    },
    // 获取列表
    search() {
      this.listLoading = true
      examPaperAnwserApi.pageExamPaper(this.queryParam).then(re => {
        this.tableData = re.data.list
        this.total = re.data.total
        this.queryParam.pageSize = re.data.pageSize
        this.queryParam.pageIndex = re.data.pageNum
        this.listLoading = false
      })
    },
    view(row) {
      this.$router.push({ path: '/manage/answer-list', query: { id: row.id } });
    }
  }
};
</script>
<style scoped lang="scss">
.flex {
  display: flex;
}
 
// 内容
.content {
  width: 1262px;
  margin-bottom: 80px;
  background-color: #fff;
  padding: 20px 40px;
  border-radius: 10px;
}
</style>