|
@@ -114,9 +114,12 @@
|
|
<div class="qe-part-body">
|
|
<div class="qe-part-body">
|
|
<div id="qe-part-richtext-list">
|
|
<div id="qe-part-richtext-list">
|
|
<div
|
|
<div
|
|
- class="qe-part-richtext"
|
|
|
|
v-for="(richJsonItem, rindex) in paperRichJsonGroup"
|
|
v-for="(richJsonItem, rindex) in paperRichJsonGroup"
|
|
:key="rindex"
|
|
:key="rindex"
|
|
|
|
+ :class="[
|
|
|
|
+ 'qe-part-richtext',
|
|
|
|
+ { 'is-error': richJsonItem.exceptions.length },
|
|
|
|
+ ]"
|
|
>
|
|
>
|
|
<v-editor
|
|
<v-editor
|
|
ref="RichTextEditor"
|
|
ref="RichTextEditor"
|
|
@@ -175,11 +178,11 @@
|
|
<p class="desc-qcout">
|
|
<p class="desc-qcout">
|
|
<span>共识别 </span>
|
|
<span>共识别 </span>
|
|
<span class="color-success">
|
|
<span class="color-success">
|
|
- {{ parseQuestionData.successCount }}
|
|
|
|
|
|
+ {{ questionStatData.successCount }}
|
|
</span>
|
|
</span>
|
|
<span> 题,其中识别有误 </span>
|
|
<span> 题,其中识别有误 </span>
|
|
<span class="color-danger">
|
|
<span class="color-danger">
|
|
- {{ parseQuestionData.errorCount }}
|
|
|
|
|
|
+ {{ questionStatData.errorCount }}
|
|
</span>
|
|
</span>
|
|
<span> 题</span>
|
|
<span> 题</span>
|
|
</p>
|
|
</p>
|
|
@@ -188,11 +191,14 @@
|
|
<div class="qe-part-head-menu">
|
|
<div class="qe-part-head-menu">
|
|
<el-tabs
|
|
<el-tabs
|
|
v-model="filterQuestionType"
|
|
v-model="filterQuestionType"
|
|
- @tab-click="filterQuestionTypeClick"
|
|
|
|
|
|
+ @tab-click="filterQuestionTypeChange"
|
|
>
|
|
>
|
|
- <el-tab-pane label="全部" name=""></el-tab-pane>
|
|
|
|
<el-tab-pane
|
|
<el-tab-pane
|
|
- v-for="item in parseQuestionData.qtypes"
|
|
|
|
|
|
+ :label="`全部(${questionStatData.total})`"
|
|
|
|
+ name="all"
|
|
|
|
+ ></el-tab-pane>
|
|
|
|
+ <el-tab-pane
|
|
|
|
+ v-for="item in questionStatData.qtypes"
|
|
:key="item.questionType"
|
|
:key="item.questionType"
|
|
:label="`${item.questionTypeName}(${item.questionCount})`"
|
|
:label="`${item.questionTypeName}(${item.questionCount})`"
|
|
:name="item.questionType"
|
|
:name="item.questionType"
|
|
@@ -202,10 +208,10 @@
|
|
</div>
|
|
</div>
|
|
<div id="qe-part-paper" class="qe-part-body">
|
|
<div id="qe-part-paper" class="qe-part-body">
|
|
<question-import-paper-edit
|
|
<question-import-paper-edit
|
|
- v-if="paperData.length"
|
|
|
|
|
|
+ v-if="filterPaperData.length"
|
|
ref="QuestionImportPaperEdit"
|
|
ref="QuestionImportPaperEdit"
|
|
:key="questionKey"
|
|
:key="questionKey"
|
|
- :paper="paperData"
|
|
|
|
|
|
+ :paper="filterPaperData"
|
|
:course-id="data.importData.courseId"
|
|
:course-id="data.importData.courseId"
|
|
></question-import-paper-edit>
|
|
></question-import-paper-edit>
|
|
</div>
|
|
</div>
|
|
@@ -272,7 +278,7 @@ import {
|
|
questionWordImportTemplate,
|
|
questionWordImportTemplate,
|
|
} from "../api";
|
|
} from "../api";
|
|
import ImportFileDialog from "@/components/ImportFileDialog.vue";
|
|
import ImportFileDialog from "@/components/ImportFileDialog.vue";
|
|
-import { QUESTION_API } from "@/constants/constants";
|
|
|
|
|
|
+import { QUESTION_API, QUESTION_TYPES } from "@/constants/constants";
|
|
import { downloadByApi } from "@/plugins/download";
|
|
import { downloadByApi } from "@/plugins/download";
|
|
import { richTextToJSON, renderRichText } from "./import-edit/richText";
|
|
import { richTextToJSON, renderRichText } from "./import-edit/richText";
|
|
import scrollMixins from "./import-edit/scrollMixins";
|
|
import scrollMixins from "./import-edit/scrollMixins";
|
|
@@ -346,21 +352,6 @@ export default {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- parseQuestionData() {
|
|
|
|
- // TODO:
|
|
|
|
- return {
|
|
|
|
- total: 0,
|
|
|
|
- successCount: 0,
|
|
|
|
- errorCount: 0,
|
|
|
|
- qtypes: [
|
|
|
|
- {
|
|
|
|
- questionType: "1",
|
|
|
|
- questionTypeName: "单选题",
|
|
|
|
- questionCount: 0,
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -368,6 +359,7 @@ export default {
|
|
modalIsShow: false,
|
|
modalIsShow: false,
|
|
loading: false,
|
|
loading: false,
|
|
questionKey: "",
|
|
questionKey: "",
|
|
|
|
+ filterPaperData: [],
|
|
paperData: [],
|
|
paperData: [],
|
|
paperRichJson: { sections: [] },
|
|
paperRichJson: { sections: [] },
|
|
paperRichJsonGroup: [],
|
|
paperRichJsonGroup: [],
|
|
@@ -387,13 +379,51 @@ export default {
|
|
uploadUrl: `${QUESTION_API}/word/parse/struct`,
|
|
uploadUrl: `${QUESTION_API}/word/parse/struct`,
|
|
showIframeDialog: false,
|
|
showIframeDialog: false,
|
|
// question types
|
|
// question types
|
|
- filterQuestionType: "",
|
|
|
|
|
|
+ questionStatData: {
|
|
|
|
+ total: 0,
|
|
|
|
+ successCount: 0,
|
|
|
|
+ errorCount: 0,
|
|
|
|
+ qtypes: [],
|
|
|
|
+ },
|
|
|
|
+ filterQuestionType: "all",
|
|
modalForm: this.getInitForm(),
|
|
modalForm: this.getInitForm(),
|
|
|
|
+ rules: {
|
|
|
|
+ courseId: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请选择课程",
|
|
|
|
+ trigger: "change",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ name: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请输入试卷名称",
|
|
|
|
+ trigger: "change",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ totalScore: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: "请输入试卷总分",
|
|
|
|
+ trigger: "change",
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
this.$bus.on("markIgnoreRepeatQuestion", this.markIgnoreRepeat);
|
|
this.$bus.on("markIgnoreRepeatQuestion", this.markIgnoreRepeat);
|
|
},
|
|
},
|
|
|
|
+ watch: {
|
|
|
|
+ paperData: {
|
|
|
|
+ handler() {
|
|
|
|
+ this.parseQuestionStatData();
|
|
|
|
+ this.filterQuestionTypeChange({ name: this.filterQuestionType });
|
|
|
|
+ this.questionKey = randomCode();
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
getInitForm() {
|
|
getInitForm() {
|
|
return {
|
|
return {
|
|
@@ -409,6 +439,51 @@ export default {
|
|
courseChange(val) {
|
|
courseChange(val) {
|
|
this.modalForm.courseName = val ? val.name : "";
|
|
this.modalForm.courseName = val ? val.name : "";
|
|
this.getCourseProperty();
|
|
this.getCourseProperty();
|
|
|
|
+ this.uploadData = { courseId: this.modalForm.courseId };
|
|
|
|
+ },
|
|
|
|
+ parseQuestionStatData() {
|
|
|
|
+ const total = calcSum(
|
|
|
|
+ this.paperData.map((item) => item.questions.length)
|
|
|
|
+ );
|
|
|
|
+ const successCount = calcSum(
|
|
|
|
+ this.paperData.map(
|
|
|
|
+ (item) =>
|
|
|
|
+ item.questions.filter((v) => !v.questionExceptions.length).length
|
|
|
|
+ )
|
|
|
|
+ );
|
|
|
|
+ const errorCount = calcSum(
|
|
|
|
+ this.paperData.map(
|
|
|
|
+ (item) =>
|
|
|
|
+ item.questions.filter((v) => v.questionExceptions.length).length
|
|
|
|
+ )
|
|
|
|
+ );
|
|
|
|
+ const questionTypeStat = {};
|
|
|
|
+ this.paperData.forEach((detail) => {
|
|
|
|
+ detail.questions.forEach((question) => {
|
|
|
|
+ const { questionType } = question;
|
|
|
|
+ if (questionTypeStat[questionType]) {
|
|
|
|
+ questionTypeStat[questionType]++;
|
|
|
|
+ } else {
|
|
|
|
+ questionTypeStat[questionType] = 1;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ const qtMap = {};
|
|
|
|
+ QUESTION_TYPES.forEach((item) => {
|
|
|
|
+ qtMap[item.code] = item.name;
|
|
|
|
+ });
|
|
|
|
+ const qtypes = Object.keys(questionTypeStat).map((key) => ({
|
|
|
|
+ questionType: key,
|
|
|
|
+ questionTypeName: qtMap[key],
|
|
|
|
+ questionCount: questionTypeStat[key],
|
|
|
|
+ }));
|
|
|
|
+
|
|
|
|
+ this.questionStatData = {
|
|
|
|
+ total,
|
|
|
|
+ successCount,
|
|
|
|
+ errorCount,
|
|
|
|
+ qtypes,
|
|
|
|
+ };
|
|
},
|
|
},
|
|
inHasIgnore(indexes) {
|
|
inHasIgnore(indexes) {
|
|
return this.ignoreRepeatExceptionIndexArr.includes(indexes.toString());
|
|
return this.ignoreRepeatExceptionIndexArr.includes(indexes.toString());
|
|
@@ -494,8 +569,31 @@ export default {
|
|
this.getRichTextIndexList();
|
|
this.getRichTextIndexList();
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- filterQuestionTypeClick(val) {
|
|
|
|
|
|
+ filterQuestionTypeChange(val) {
|
|
|
|
+ console.log(val);
|
|
this.filterQuestionType = val.name;
|
|
this.filterQuestionType = val.name;
|
|
|
|
+
|
|
|
|
+ const filterQuestionType =
|
|
|
|
+ this.filterQuestionType === "all" ? "" : this.filterQuestionType;
|
|
|
|
+ if (!filterQuestionType) {
|
|
|
|
+ this.filterPaperData = this.paperData;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.filterPaperData = this.paperData
|
|
|
|
+ .filter((detail) => {
|
|
|
|
+ return detail.questions.some(
|
|
|
|
+ (question) => question.questionType == filterQuestionType
|
|
|
|
+ );
|
|
|
|
+ })
|
|
|
|
+ .map((detail) => {
|
|
|
|
+ return {
|
|
|
|
+ ...detail,
|
|
|
|
+ questions: detail.questions.filter(
|
|
|
|
+ (question) => question.questionType == filterQuestionType
|
|
|
|
+ ),
|
|
|
|
+ };
|
|
|
|
+ });
|
|
},
|
|
},
|
|
getRichTextIndexList() {
|
|
getRichTextIndexList() {
|
|
const richTextListDom = document.getElementById("qe-part-richtext-list");
|
|
const richTextListDom = document.getElementById("qe-part-richtext-list");
|
|
@@ -707,6 +805,8 @@ export default {
|
|
}, 5000);
|
|
}, 5000);
|
|
},
|
|
},
|
|
initData() {
|
|
initData() {
|
|
|
|
+ this.filterPaperData = [];
|
|
|
|
+ this.filterQuestionType = "all";
|
|
this.paperData = [];
|
|
this.paperData = [];
|
|
this.paperRichJson = { sections: [] };
|
|
this.paperRichJson = { sections: [] };
|
|
window.sessionStorage.removeItem("coursePropertys");
|
|
window.sessionStorage.removeItem("coursePropertys");
|
|
@@ -1146,6 +1246,9 @@ export default {
|
|
return true;
|
|
return true;
|
|
},
|
|
},
|
|
async confirm() {
|
|
async confirm() {
|
|
|
|
+ const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
|
|
+ if (!valid) return;
|
|
|
|
+
|
|
const confirm = await this.$confirm("确认加入题库吗?", "提示", {
|
|
const confirm = await this.$confirm("确认加入题库吗?", "提示", {
|
|
type: "warning",
|
|
type: "warning",
|
|
}).catch(() => {});
|
|
}).catch(() => {});
|