| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="queryParam" ref="queryForm" :inline="true"> |
| | | <el-form-item label="题目ID:"> |
| | | <el-form-item label="试卷ID:"> |
| | | <el-input v-model="queryParam.id" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="年级:"> |
| | | <el-select v-model="queryParam.level" placeholder="年级" @change="levelChange" clearable> |
| | | <el-option v-for="item in levelEnum" :key="item.key" :value="item.key" :label="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="学科:" > |
| | | <el-select v-model="queryParam.subjectId" clearable> |
| | | <el-option v-for="item in subjectFilter" :key="item.id" :value="item.id" :label="item.name+' ( '+item.levelName+' )'"></el-option> |
| | | <el-select |
| | | v-model="queryParam.subjectId" |
| | | placeholder="全部科目" |
| | | clearable |
| | | > |
| | | <el-option v-for="item in subjects" :key="item.id" :label="item.name" :value="item.id"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-table v-loading="listLoading" :data="tableData" border fit highlight-current-row style="width: 100%"> |
| | | <el-table-column prop="id" label="Id" width="90px"/> |
| | | <el-table-column prop="subjectId" label="学科" :formatter="subjectFormatter" width="120px" /> |
| | | <el-table-column prop="name" label="名称" /> |
| | | <el-table-column prop="createTime" label="创建时间" width="160px"/> |
| | | <el-table-column align="center" prop="id" label="Id" width="90px"/> |
| | | <el-table-column align="center" prop="subjectId" label="学科" width="120px" > |
| | | <template slot-scope="scope"> |
| | | {{ translate(scope.row.subjectId) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" prop="name" label="名称" /> |
| | | <el-table-column |
| | | align="center" |
| | | prop="paperType" |
| | | label="试卷类型" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <div v-if="scope.row.paperType === 1">固定试卷</div> |
| | | <div v-else-if="scope.row.paperType === 2">随机试卷</div> |
| | | <div v-else-if="scope.row.paperType === 3">随序试卷</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | align="center" |
| | | prop="suggestTime" |
| | | label="建议时长(分钟)" |
| | | > |
| | | </el-table-column> |
| | | <el-table-column |
| | | align="center" |
| | | prop="num" |
| | | label="题目数量" |
| | | > |
| | | </el-table-column> |
| | | <el-table-column |
| | | align="center" |
| | | prop="score" |
| | | label="总分" |
| | | > |
| | | </el-table-column> |
| | | <el-table-column align="center" prop="createTime" label="创建时间" width="160px"/> |
| | | <el-table-column label="操作" align="center" width="160px"> |
| | | <template slot-scope="{row}"> |
| | | <el-button size="mini" @click="$router.push({path:'/exam/paper/edit',query:{id:row.id}})" >编辑</el-button> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { mapGetters, mapState, mapActions } from 'vuex' |
| | | import Pagination from '@/components/Pagination' |
| | | import subjectApi from '@/api/subject' |
| | | import examPaperApi from '@/api/examPaper' |
| | | |
| | | export default { |
| | |
| | | pageIndex: 1, |
| | | pageSize: 10 |
| | | }, |
| | | subjectFilter: null, |
| | | listLoading: true, |
| | | tableData: [], |
| | | subjects: [], |
| | | total: 0 |
| | | } |
| | | }, |
| | | created () { |
| | | this.initSubject() |
| | | this.getSubjects() |
| | | this.search() |
| | | }, |
| | | methods: { |
| | |
| | | } |
| | | }) |
| | | }, |
| | | levelChange () { |
| | | this.queryParam.subjectId = null |
| | | this.subjectFilter = this.subjects.filter(data => data.level === this.queryParam.level) |
| | | // 获取科目 |
| | | getSubjects() { |
| | | subjectApi.list().then(re => { |
| | | this.subjects = re.data |
| | | }) |
| | | }, |
| | | subjectFormatter (row, column, cellValue, index) { |
| | | return this.subjectEnumFormat(cellValue) |
| | | }, |
| | | ...mapActions('exam', { initSubject: 'initSubject' }) |
| | | }, |
| | | computed: { |
| | | ...mapGetters('enumItem', ['enumFormat']), |
| | | ...mapState('enumItem', { |
| | | levelEnum: state => state.user.levelEnum |
| | | }), |
| | | ...mapGetters('exam', ['subjectEnumFormat']), |
| | | ...mapState('exam', { subjects: state => state.subjects }) |
| | | translate(subjectId) { |
| | | const subject = this.subjects.find(subject => subject.id == subjectId); |
| | | return subject ? subject.name : '未知'; |
| | | } |
| | | } |
| | | } |
| | | </script> |