|
@@ -0,0 +1,139 @@
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ class="paper-params"
|
|
|
+ :visible.sync="modalIsShow"
|
|
|
+ top="10vh"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ append-to-body
|
|
|
+ @open="dialogOpen"
|
|
|
+ @close="dialogClose"
|
|
|
+ >
|
|
|
+ <h1 slot="title">请上传阅卷参数 <span>卷面总分合计:100分 </span></h1>
|
|
|
+ <div class="params-main">
|
|
|
+ <div class="params-head">
|
|
|
+ <el-button
|
|
|
+ :type="!topicType ? 'primary' : 'default'"
|
|
|
+ @click="selectType(0)"
|
|
|
+ >客观题区</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ :type="topicType ? 'primary' : 'default'"
|
|
|
+ @click="selectType(1)"
|
|
|
+ >主观题区</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <div class="params-body"></div>
|
|
|
+ </div>
|
|
|
+ <div slot="footer">
|
|
|
+ <el-button type="danger" @click="cancel" plain>取消</el-button>
|
|
|
+ <el-button type="primary" :disabled="isSubmit" @click="submit"
|
|
|
+ >确认</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: "paper-params",
|
|
|
+ props: {
|
|
|
+ pages: {
|
|
|
+ type: Object,
|
|
|
+ default() {
|
|
|
+ return {};
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ modalIsShow: false,
|
|
|
+ topicType: 0,
|
|
|
+ objectives: [],
|
|
|
+ subjectives: [],
|
|
|
+ objectiveScores: {},
|
|
|
+ subjectiveScores: {}
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ dialogOpen() {
|
|
|
+ let objectiveList = [];
|
|
|
+ let subjectiveList = [];
|
|
|
+ let objectives = [];
|
|
|
+ let subjectives = [];
|
|
|
+ this.pages.forEach(page => {
|
|
|
+ page.columns.forEach(column => {
|
|
|
+ column.elements.forEach(element => {
|
|
|
+ if (element.sign && element.type !== "TOPIC_HEAD") {
|
|
|
+ if (element.sign === "objective") objectiveList.push(element);
|
|
|
+ if (element.sign === "subjective") subjectiveList.push(element);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // 客观题
|
|
|
+ objectiveList.forEach(item => {
|
|
|
+ let topic = {
|
|
|
+ index: objectives.length,
|
|
|
+ sumScore: 0,
|
|
|
+ choiceList: this.getChoiceList(item.optionCount, item.isFill),
|
|
|
+ questions: this.getQuestions(item),
|
|
|
+ ...item
|
|
|
+ };
|
|
|
+ objectives.push(topic);
|
|
|
+ });
|
|
|
+ // 主观题
|
|
|
+ subjectiveList.forEach(item => {
|
|
|
+ if (item.type === "FILL_LINE") {
|
|
|
+ let topic = {
|
|
|
+ index: subjectives.length,
|
|
|
+ sumScore: 0,
|
|
|
+ questions: this.getQuestions(item),
|
|
|
+ ...item
|
|
|
+ };
|
|
|
+ subjectives.push(topic);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getQuestions(data) {
|
|
|
+ let questions = [];
|
|
|
+ for (let j = data.startNumber; j < data.questionsCount; j++) {
|
|
|
+ let quesiton = {
|
|
|
+ questionNo: j,
|
|
|
+ score: 0
|
|
|
+ };
|
|
|
+ // if (data.type === "FILL_QUESTION")
|
|
|
+ // quesiton.answers = data.isMultiply ? [] : "";
|
|
|
+ questions[j] = quesiton;
|
|
|
+ }
|
|
|
+ return questions;
|
|
|
+ },
|
|
|
+ getObjectiveTopicName(data) {
|
|
|
+ if (data.isMultiply) {
|
|
|
+ return "选择题(多选)";
|
|
|
+ } else if (data.isFill) {
|
|
|
+ return "填空题";
|
|
|
+ } else {
|
|
|
+ return "选择题(单选)";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getChoiceList(num, isFill) {
|
|
|
+ const options = !isFill ? "abcdefghijklmn" : "√×";
|
|
|
+ return options
|
|
|
+ .toUpperCase()
|
|
|
+ .slice(0, num)
|
|
|
+ .split("");
|
|
|
+ },
|
|
|
+ dialogClose() {},
|
|
|
+ cancel() {
|
|
|
+ this.modalIsShow = false;
|
|
|
+ },
|
|
|
+ open() {
|
|
|
+ this.modalIsShow = true;
|
|
|
+ },
|
|
|
+ selectType(topicType) {
|
|
|
+ this.topicType = topicType;
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|