| | |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button type="text">预览</el-button> |
| | | <el-button type="text">编辑</el-button> |
| | | <el-button type="text" @click="deletePaper(scope.row)" class="link-left">删除</el-button> |
| | | <el-button type="text" @click="handleUpdate(scope.row)">编辑</el-button> |
| | | <el-button type="text" @click="deleteTemplate(scope.row)" class="link-left">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <el-form-item label="考试时长(分钟)" prop="suggestTime"> |
| | | <el-input-number v-model="form.suggestTime" placeholder="请输入考试时长"/> |
| | | </el-form-item> |
| | | <el-form-item label="权限" prop="visibility"> |
| | | <el-radio v-model="form.visibility" :label="'1'">私有</el-radio> |
| | | <el-radio v-model="form.visibility" :label="'2'">公开</el-radio> |
| | | </el-form-item> |
| | | <el-form-item label="多选题得分类型" prop="deductType" v-show="addedQuestionTypes.includes(2)"><!-- 有多选才出现 --> |
| | | <div> |
| | | <el-select v-model="form.deductType" placeholder="请选择多选题得分类型" style="width: 200px;margin-right: 30px"> |
| | |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-input-number v-model="form.score" placeholder="请输入多选得分分数" |
| | | <el-input-number v-model="form.deductTypeScore" placeholder="请输入多选评分" |
| | | v-show="form.deductType === 2 || form.deductType === 3"/> |
| | | </div> |
| | | </el-form-item> |
| | |
| | | <el-button @click="cancel">取 消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!-- 添加题目对话框 --> |
| | | <el-dialog :title="questionTitle" :visible.sync="questionOpen" width="400px" append-to-body> |
| | | <el-form ref="questionForm" :model="questionForm" :rules="questionRules"> |
| | |
| | | } from '@/api/examTemplate' |
| | | import subjectApi from '@/api/subject' |
| | | import Pagination from "@/components/Pagination" |
| | | import question from "../../../api/question"; |
| | | |
| | | export default { |
| | | components: {Pagination}, |
| | | data() { |
| | | var validateDeductType = (rule, value, callback) => { |
| | | const index = this.addedQuestionTypes.findIndex(item => item.questionType === 2) |
| | | if (index && (!value || value === '')) { |
| | | if (index !== -1 && (!value || value === '')) { |
| | | callback(new Error('请选择多选题得分方式')); |
| | | } else { |
| | | callback(); |
| | |
| | | currentPage: 1, |
| | | pageSize: 10 |
| | | }, |
| | | form: {}, |
| | | form: { |
| | | visibility: 1 |
| | | }, |
| | | questionForm: {}, |
| | | tableData: [], |
| | | subjects: [], |
| | |
| | | name: null, |
| | | subjectId: null, |
| | | suggestTime: null, |
| | | deductType: null, |
| | | deductTypeScore: null, |
| | | visibility: 1 |
| | | }; |
| | | this.addedQuestionTypes = [] |
| | | this.questionList = [] |
| | |
| | | //新增模板 |
| | | addTemplate() { |
| | | this.reset(); |
| | | this.questionReset(); |
| | | this.title = "新增模板" |
| | | this.open = true; |
| | | }, |
| | |
| | | this.questionTitle = "添加题目" |
| | | this.questionOpen = true; |
| | | }, |
| | | deletePaper(row) { |
| | | //删除模板 |
| | | deleteTemplate(row) { |
| | | deleteExamTemplateById(row.id).then(re => { |
| | | if (re.code === 1) { |
| | | if (re.data.code === 1) { |
| | | this.getPage() |
| | | this.$message.success("删除成功") |
| | | } else { |
| | | this.$message.error(re.message) |
| | | this.$message.error(re.data.message) |
| | | } |
| | | }) |
| | | }, |
| | | //编辑模板 |
| | | handleUpdate(row) { |
| | | this.reset(); |
| | | this.questionReset(); |
| | | this.form = row; |
| | | this.questionList = row.questionList; |
| | | if (this.questionList && this.questionList.length > 0) { |
| | | this.addedQuestionTypes = this.questionList.map(question => question.questionType); |
| | | } |
| | | this.title="编辑模板" |
| | | this.open = true; |
| | | }, |
| | | getPage() { |
| | | this.listLoading = true |
| | |
| | | submitForm() { |
| | | this.$refs['form'].validate(valid => { |
| | | if (valid) { |
| | | if (this.form.deptId && this.form.deptId.length > 0) { |
| | | this.form.deptId = this.form.deptId[this.form.deptId.length - 1] |
| | | } |
| | | let temp = { |
| | | ...this.form, |
| | | category: parseInt(this.form.category) |
| | | }; |
| | | temp.questionList = this.questionList |
| | | if (temp.id != null) { |
| | | updatePoint(temp).then(response => { |
| | | this.$modal.msgSuccess("修改成功"); |
| | | editExamTemplate(temp).then(response => { |
| | | this.$message.success("修改成功"); |
| | | this.open = false; |
| | | this.getList(); |
| | | this.getPage(); |
| | | }); |
| | | } else { |
| | | addPoint(temp).then(response => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | addExamTemplate(temp).then(response => { |
| | | this.$message.success("新增成功"); |
| | | this.open = false; |
| | | this.reset() |
| | | this.getList(); |
| | | this.getPage(); |
| | | }); |
| | | } |
| | | } else { |