| | |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="submitForm">查询</el-button> |
| | | <router-link :to="{path:'/exam/paper/edit'}" class="link-left"> |
| | | <router-link :to="{ path: '/exam/paper/edit' }" class="link-left"> |
| | | <el-button type="primary" >添加</el-button> |
| | | </router-link> |
| | | <el-button class="link-left" type="danger" @click="downloadImportTemplate">下载导入模板</el-button> |
| | | <router-link :to="{ path: '/exam/paper/import' }" class="link-left"> |
| | | <el-button type="success">导入</el-button> |
| | | </router-link> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-table v-loading="listLoading" :data="tableData" border fit highlight-current-row style="width: 100%"> |
| | | <el-table-column align="center" prop="id" label="Id" width="90px"/> |
| | | <el-table-column align="center" prop="name" label="名称" /> |
| | | <el-table-column |
| | | align="center" |
| | | prop="paperType" |
| | | label="试卷类型" |
| | | > |
| | | <el-table-column align="center" prop="id" label="Id" width="90px" /> |
| | | <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 align="center" prop="suggestTime" label="建议时长(分钟)"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | align="center" |
| | | prop="num" |
| | | label="题目数量" |
| | | > |
| | | <el-table-column align="center" prop="num" label="题目数量"> |
| | | </el-table-column> |
| | | <el-table-column |
| | | align="center" |
| | | prop="score" |
| | | label="总分" |
| | | > |
| | | <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"> |
| | | <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> |
| | | <el-button size="mini" type="danger" @click="deletePaper(row)" class="link-left">删除</el-button> |
| | | <el-button size="mini" @click="$router.push({ path: '/exam/paper/edit', query: { id: row.id } })">编辑</el-button> |
| | | <el-button size="mini" type="danger" @click="deletePaper(row)" class="link-left">删除</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"/> |
| | | <pagination v-show="total > 0" :total="total" :page.sync="queryParam.pageIndex" :limit.sync="queryParam.pageSize" |
| | | @pagination="search" /> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import Pagination from '@/components/Pagination' |
| | | import subjectApi from '@/api/subject' |
| | | import examPaperApi from '@/api/examPaper' |
| | | import { downloadExcel } from '@/utils/download' |
| | | |
| | | export default { |
| | | components: { Pagination }, |
| | | data () { |
| | | data() { |
| | | return { |
| | | queryParam: { |
| | | id: null, |
| | |
| | | total: 0 |
| | | } |
| | | }, |
| | | created () { |
| | | created() { |
| | | this.getSubjects() |
| | | this.search() |
| | | }, |
| | | methods: { |
| | | submitForm () { |
| | | // 下载导入模板 |
| | | downloadImportTemplate() { |
| | | examPaperApi.downloadImportTemplate().then(res => { |
| | | downloadExcel(res, '题目导入模板') |
| | | }) |
| | | }, |
| | | submitForm() { |
| | | this.queryParam.pageIndex = 1 |
| | | this.search() |
| | | }, |
| | | search () { |
| | | search() { |
| | | this.listLoading = true |
| | | examPaperApi.pageList(this.queryParam).then(data => { |
| | | const re = data.data |
| | |
| | | this.listLoading = false |
| | | }) |
| | | }, |
| | | deletePaper (row) { |
| | | deletePaper(row) { |
| | | let _this = this |
| | | examPaperApi.deletePaper(row.id).then(re => { |
| | | if (re.code === 1) { |
| | |
| | | }) |
| | | }, |
| | | // 获取科目 |
| | | getSubjects () { |
| | | getSubjects() { |
| | | subjectApi.list().then(re => { |
| | | this.subjects = re.data |
| | | }) |
| | | }, |
| | | translate (subjectId) { |
| | | translate(subjectId) { |
| | | const subject = this.subjects.find(subject => subject.id == subjectId); |
| | | return subject ? subject.name : '未知'; |
| | | } |