|
@@ -12,69 +12,104 @@
|
|
|
@opened="visibleChange"
|
|
|
@closed="initData"
|
|
|
>
|
|
|
- <el-dialog
|
|
|
- title="录入说明"
|
|
|
- :visible.sync="showIframeDialog"
|
|
|
- append-to-body
|
|
|
- width="900px"
|
|
|
- top="30px"
|
|
|
- >
|
|
|
- <div
|
|
|
- style="width: 100%; height: calc(100vh - 250px); overflow: auto"
|
|
|
- id="doc-box"
|
|
|
- ></div>
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="showIframeDialog = false"
|
|
|
- >关闭</el-button
|
|
|
- >
|
|
|
- </span>
|
|
|
- </el-dialog>
|
|
|
- <div slot="title" class="box-justify">
|
|
|
- <div>
|
|
|
- <h2>文件上传</h2>
|
|
|
+ <div slot="title">
|
|
|
+ <div class="box-justify">
|
|
|
+ <div>
|
|
|
+ <h2>文件上传</h2>
|
|
|
+ </div>
|
|
|
+ <div style="display: flex; align-items: center">
|
|
|
+ <el-button
|
|
|
+ style="margin-left: 10px"
|
|
|
+ size="mini"
|
|
|
+ type="danger"
|
|
|
+ @click="cancel"
|
|
|
+ >返回</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div style="display: flex; align-items: center">
|
|
|
- <upload-button
|
|
|
- btn-content="重新上传文件"
|
|
|
- btn-icon="icon icon-import"
|
|
|
- :disabled="loading"
|
|
|
- :upload-data="uploadData"
|
|
|
- :upload-url="uploadUrl"
|
|
|
- :format="importFileTypes"
|
|
|
- @valid-error="validError"
|
|
|
- @upload-success="uploaded"
|
|
|
- :auto-upload="false"
|
|
|
- ></upload-button>
|
|
|
- <el-button
|
|
|
- style="margin-left: 10px"
|
|
|
- size="small"
|
|
|
- type="danger"
|
|
|
- @click="cancel"
|
|
|
- >返回</el-button
|
|
|
- >
|
|
|
+ <div class="head-form">
|
|
|
+ <el-form ref="modalFormComp" :model="modalForm" :rules="rules" inline>
|
|
|
+ <el-form-item prop="courseId" label="课程名称:">
|
|
|
+ <course-select
|
|
|
+ v-model="modalForm.courseId"
|
|
|
+ @change="courseChange"
|
|
|
+ >
|
|
|
+ </course-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-checkbox v-model="modalForm.useOriginalPaper"
|
|
|
+ >是否以导入试题同步生成试卷</el-checkbox
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ <template v-if="modalForm.useOriginalPaper">
|
|
|
+ <el-form-item>
|
|
|
+ <el-input
|
|
|
+ v-model="modalForm.name"
|
|
|
+ placeholder="请输入试卷名称"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-checkbox v-model="modalForm.checkTotalScore"
|
|
|
+ >是否校验导入试卷总分</el-checkbox
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="modalForm.checkTotalScore">
|
|
|
+ <el-input-number
|
|
|
+ v-model="modalForm.totalScore"
|
|
|
+ style="width: 80px"
|
|
|
+ :min="1"
|
|
|
+ :max="1000"
|
|
|
+ :step="1"
|
|
|
+ step-strictly
|
|
|
+ :controls="false"
|
|
|
+ ></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-form>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="qe-body">
|
|
|
<div class="qe-part qe-part-edit">
|
|
|
<div class="qe-part-main">
|
|
|
<div class="qe-part-head">
|
|
|
- <h3>
|
|
|
- 题目编辑
|
|
|
- <div
|
|
|
- style="color: #9a9dab; font-size: 14px; font-weight: normal"
|
|
|
- >
|
|
|
- <i class="icon icon-tips"></i>
|
|
|
- 提示:若识别有误,可点击左侧题目按格式进行修改后重新识别
|
|
|
+ <div class="qe-part-head-title">
|
|
|
+ <h3>题目编辑</h3>
|
|
|
+ <div>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="icon icon-edit-warning"
|
|
|
+ @click="showDocx"
|
|
|
+ >录入说明</el-button
|
|
|
+ >
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="icon icon-export-prop"
|
|
|
+ class="margin-right-10"
|
|
|
+ @click="getWordTemplate"
|
|
|
+ >模板下载</el-button
|
|
|
+ >
|
|
|
+ <upload-button
|
|
|
+ btn-content="上传文件"
|
|
|
+ btn-icon="icon icon-import"
|
|
|
+ :disabled="loading || !modalForm.courseId"
|
|
|
+ :upload-data="uploadData"
|
|
|
+ :upload-url="uploadUrl"
|
|
|
+ :format="importFileTypes"
|
|
|
+ @valid-error="validError"
|
|
|
+ @upload-success="uploaded"
|
|
|
+ :auto-upload="false"
|
|
|
+ ></upload-button>
|
|
|
</div>
|
|
|
- </h3>
|
|
|
- <el-button
|
|
|
- size="small"
|
|
|
- type="primary"
|
|
|
- plain
|
|
|
- icon="icon icon-edit-warning"
|
|
|
- @click="showDocx"
|
|
|
- >录入说明</el-button
|
|
|
- >
|
|
|
+ </div>
|
|
|
+ <div class="qe-part-head-desc">
|
|
|
+ <i class="icon icon-tips"></i>
|
|
|
+ 提示:若识别有误,可点击左侧题目按格式进行修改后重新识别
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="qe-part-body">
|
|
|
<div id="qe-part-richtext-list">
|
|
@@ -114,25 +149,55 @@
|
|
|
<div class="qe-part qe-part-view">
|
|
|
<div class="qe-part-main">
|
|
|
<div class="qe-part-head">
|
|
|
- <h3>题目阅览</h3>
|
|
|
- <div>
|
|
|
- <el-button
|
|
|
- size="small"
|
|
|
- type="primary"
|
|
|
- plain
|
|
|
- icon="icon icon-export-answer"
|
|
|
- @click="toImportAnswer"
|
|
|
- >导入答案属性</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- size="small"
|
|
|
- type="primary"
|
|
|
- icon="icon icon-save-white"
|
|
|
- :loading="loading"
|
|
|
- :disabled="!paperData.length || hasErrorTips"
|
|
|
- @click="confirm"
|
|
|
- >识别无误,加入题库</el-button
|
|
|
+ <div class="qe-part-head-title">
|
|
|
+ <h3>题目阅览</h3>
|
|
|
+ <div>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="icon icon-export-answer"
|
|
|
+ @click="toImportAnswer"
|
|
|
+ >导入答案属性</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ icon="icon icon-save-white"
|
|
|
+ :loading="loading"
|
|
|
+ :disabled="!paperData.length || hasErrorTips"
|
|
|
+ @click="confirm"
|
|
|
+ >识别无误,加入题库</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="qe-part-head-desc">
|
|
|
+ <p class="desc-qcout">
|
|
|
+ <span>共识别 </span>
|
|
|
+ <span class="color-success">
|
|
|
+ {{ parseQuestionData.successCount }}
|
|
|
+ </span>
|
|
|
+ <span> 题,其中识别有误 </span>
|
|
|
+ <span class="color-danger">
|
|
|
+ {{ parseQuestionData.errorCount }}
|
|
|
+ </span>
|
|
|
+ <span> 题</span>
|
|
|
+ </p>
|
|
|
+ <el-checkbox>仅查看识别有误试题</el-checkbox>
|
|
|
+ </div>
|
|
|
+ <div class="qe-part-head-menu">
|
|
|
+ <el-tabs
|
|
|
+ v-model="filterQuestionType"
|
|
|
+ @tab-click="filterQuestionTypeClick"
|
|
|
>
|
|
|
+ <el-tab-pane label="全部" name=""></el-tab-pane>
|
|
|
+ <el-tab-pane
|
|
|
+ v-for="item in parseQuestionData.qtypes"
|
|
|
+ :key="item.questionType"
|
|
|
+ :label="`${item.questionTypeName}(${item.questionCount})`"
|
|
|
+ :name="item.questionType"
|
|
|
+ ></el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div id="qe-part-paper" class="qe-part-body">
|
|
@@ -159,6 +224,25 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <!-- 录入说明 -->
|
|
|
+ <el-dialog
|
|
|
+ title="录入说明"
|
|
|
+ :visible.sync="showIframeDialog"
|
|
|
+ append-to-body
|
|
|
+ width="900px"
|
|
|
+ top="30px"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ style="width: 100%; height: calc(100vh - 250px); overflow: auto"
|
|
|
+ id="doc-box"
|
|
|
+ ></div>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="showIframeDialog = false"
|
|
|
+ >关闭</el-button
|
|
|
+ >
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
<!-- 上传答案文件 -->
|
|
|
<import-file-dialog
|
|
|
ref="ImportAnswerDialog"
|
|
@@ -184,10 +268,11 @@ import {
|
|
|
questionImportPaperSave,
|
|
|
questionImportParseRichText,
|
|
|
questionImportDownloadTemplate,
|
|
|
+ propertyNameQueryApi,
|
|
|
+ questionWordImportTemplate,
|
|
|
} from "../api";
|
|
|
import ImportFileDialog from "@/components/ImportFileDialog.vue";
|
|
|
import { QUESTION_API } from "@/constants/constants";
|
|
|
-import { propertyNameQueryApi } from "@/modules/question/api";
|
|
|
import { downloadByApi } from "@/plugins/download";
|
|
|
import { richTextToJSON, renderRichText } from "./import-edit/richText";
|
|
|
import scrollMixins from "./import-edit/scrollMixins";
|
|
@@ -209,6 +294,25 @@ export default {
|
|
|
name: "QuestionImportEdit",
|
|
|
components: { QuestionImportPaperEdit, ImportFileDialog, UploadButton },
|
|
|
mixins: [scrollMixins, timeMixin],
|
|
|
+ props: {
|
|
|
+ data: {
|
|
|
+ type: Object,
|
|
|
+ default() {
|
|
|
+ return {
|
|
|
+ richText: { sections: [] },
|
|
|
+ detailInfo: [],
|
|
|
+ importData: {
|
|
|
+ courseId: "",
|
|
|
+ courseName: "",
|
|
|
+ name: "",
|
|
|
+ checkTotalScore: false,
|
|
|
+ useOriginalPaper: false,
|
|
|
+ totalScore: 0,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
computed: {
|
|
|
hasErrorTips() {
|
|
|
// return (this.paperRichJsonGroup || []).some((item) => {
|
|
@@ -242,24 +346,20 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- },
|
|
|
- props: {
|
|
|
- data: {
|
|
|
- type: Object,
|
|
|
- default() {
|
|
|
- return {
|
|
|
- richText: { sections: [] },
|
|
|
- detailInfo: [],
|
|
|
- importData: {
|
|
|
- courseId: "",
|
|
|
- courseName: "",
|
|
|
- name: "",
|
|
|
- checkTotalScore: false,
|
|
|
- useOriginalPaper: false,
|
|
|
- totalScore: 0,
|
|
|
+ parseQuestionData() {
|
|
|
+ // TODO:
|
|
|
+ return {
|
|
|
+ total: 0,
|
|
|
+ successCount: 0,
|
|
|
+ errorCount: 0,
|
|
|
+ qtypes: [
|
|
|
+ {
|
|
|
+ questionType: "1",
|
|
|
+ questionTypeName: "单选题",
|
|
|
+ questionCount: 0,
|
|
|
},
|
|
|
- };
|
|
|
- },
|
|
|
+ ],
|
|
|
+ };
|
|
|
},
|
|
|
},
|
|
|
data() {
|
|
@@ -286,12 +386,30 @@ export default {
|
|
|
uploadData: {},
|
|
|
uploadUrl: `${QUESTION_API}/word/parse/struct`,
|
|
|
showIframeDialog: false,
|
|
|
+ // question types
|
|
|
+ filterQuestionType: "",
|
|
|
+ modalForm: this.getInitForm(),
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.$bus.on("markIgnoreRepeatQuestion", this.markIgnoreRepeat);
|
|
|
},
|
|
|
methods: {
|
|
|
+ getInitForm() {
|
|
|
+ return {
|
|
|
+ courseId: null,
|
|
|
+ courseName: null,
|
|
|
+ name: "",
|
|
|
+ checkTotalScore: false,
|
|
|
+ useOriginalPaper: false,
|
|
|
+ totalScore: 0,
|
|
|
+ toOtherCourse: false,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ courseChange(val) {
|
|
|
+ this.modalForm.courseName = val ? val.name : "";
|
|
|
+ this.getCourseProperty();
|
|
|
+ },
|
|
|
inHasIgnore(indexes) {
|
|
|
return this.ignoreRepeatExceptionIndexArr.includes(indexes.toString());
|
|
|
},
|
|
@@ -344,16 +462,21 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ async getWordTemplate() {
|
|
|
+ const res = await downloadByApi(() => {
|
|
|
+ return questionWordImportTemplate();
|
|
|
+ }).catch((e) => {
|
|
|
+ this.$message.error(e || "下载失败,请重新尝试!");
|
|
|
+ });
|
|
|
+
|
|
|
+ if (!res) return;
|
|
|
+ this.$message.success("下载成功!");
|
|
|
+ },
|
|
|
async visibleChange() {
|
|
|
this.ignoreRepeatExceptionIndexArr = [];
|
|
|
- await this.getCourseProperty();
|
|
|
-
|
|
|
- // this.resetData({
|
|
|
- // richText: paperRichTextJson,
|
|
|
- // detailInfo: paperParseData,
|
|
|
- // });
|
|
|
- this.resetData(this.data);
|
|
|
+ this.getCourseProperty();
|
|
|
|
|
|
+ if (this.data) this.resetData(this.data);
|
|
|
this.$nextTick(() => {
|
|
|
this.registScrollEvent();
|
|
|
});
|
|
@@ -364,13 +487,16 @@ export default {
|
|
|
this.transformDataInfo();
|
|
|
this.paperRichJsonGroup = this.getRichTextGroup();
|
|
|
|
|
|
- this.uploadData = { courseId: this.data.importData.courseId };
|
|
|
+ this.uploadData = { courseId: this.modalForm.courseId };
|
|
|
this.questionKey = randomCode();
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
this.getRichTextIndexList();
|
|
|
});
|
|
|
},
|
|
|
+ filterQuestionTypeClick(val) {
|
|
|
+ this.filterQuestionType = val.name;
|
|
|
+ },
|
|
|
getRichTextIndexList() {
|
|
|
const richTextListDom = document.getElementById("qe-part-richtext-list");
|
|
|
const elPos = richTextListDom.getBoundingClientRect();
|
|
@@ -396,11 +522,12 @@ export default {
|
|
|
this.richTextIndexList = richTextIndexList;
|
|
|
},
|
|
|
async getCourseProperty() {
|
|
|
- const res = await propertyNameQueryApi(this.data.importData.courseId, "");
|
|
|
+ if (!this.modalForm.courseId) return;
|
|
|
+ const res = await propertyNameQueryApi(this.modalForm.courseId, "");
|
|
|
const optionList = res.data || [];
|
|
|
window.sessionStorage.setItem(
|
|
|
"coursePropertys",
|
|
|
- JSON.stringify({ optionList, courseId: this.data.importData.courseId })
|
|
|
+ JSON.stringify({ optionList, courseId: this.modalForm.courseId })
|
|
|
);
|
|
|
},
|
|
|
buildRichText(richText) {
|
|
@@ -612,7 +739,7 @@ export default {
|
|
|
let richText = this.getRichTextJsons();
|
|
|
const res = await questionImportParseRichText({
|
|
|
richText,
|
|
|
- courseId: this.data.importData.courseId,
|
|
|
+ courseId: this.modalForm.courseId,
|
|
|
}).catch(() => {});
|
|
|
this.loading = false;
|
|
|
if (!res) return;
|
|
@@ -714,8 +841,8 @@ export default {
|
|
|
const transformFieldMap = { body: "quesBody", options: "quesOptions" };
|
|
|
const fields = Object.keys(transformFieldMap);
|
|
|
const course = {
|
|
|
- id: this.data.importData.courseId,
|
|
|
- name: this.data.importData.courseName,
|
|
|
+ id: this.modalForm.courseId,
|
|
|
+ name: this.modalForm.courseName,
|
|
|
};
|
|
|
|
|
|
const transformQuestion = (question) => {
|
|
@@ -933,7 +1060,7 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (!this.data.importData.useOriginalPaper) return true;
|
|
|
+ if (!this.modalForm.useOriginalPaper) return true;
|
|
|
|
|
|
let detailNumbers = paperData.map((detail) => detail.number);
|
|
|
// 大题号重复性校验
|
|
@@ -1004,8 +1131,8 @@ export default {
|
|
|
}
|
|
|
|
|
|
if (
|
|
|
- this.data.importData.checkTotalScore &&
|
|
|
- totalScore !== this.data.importData.totalScore
|
|
|
+ this.modalForm.checkTotalScore &&
|
|
|
+ totalScore !== this.modalForm.totalScore
|
|
|
) {
|
|
|
this.$message({
|
|
|
showClose: true,
|
|
@@ -1031,7 +1158,7 @@ export default {
|
|
|
this.loading = true;
|
|
|
console.log("detailInfo", detailInfo);
|
|
|
const res = await questionImportPaperSave({
|
|
|
- ...this.data.importData,
|
|
|
+ ...this.modalForm,
|
|
|
detailInfo,
|
|
|
}).catch(() => {});
|
|
|
|
|
@@ -1055,7 +1182,7 @@ export default {
|
|
|
const detailInfo = this.getImportPaperData();
|
|
|
this.uploadAnswerData = {
|
|
|
detailInfo: JSON.stringify(detailInfo),
|
|
|
- ...this.data.importData,
|
|
|
+ ...this.modalForm,
|
|
|
};
|
|
|
this.$refs.ImportAnswerDialog.open();
|
|
|
},
|
|
@@ -1065,7 +1192,7 @@ export default {
|
|
|
const res = await downloadByApi(() => {
|
|
|
return questionImportDownloadTemplate({
|
|
|
detailInfo,
|
|
|
- ...this.data.importData,
|
|
|
+ ...this.modalForm,
|
|
|
});
|
|
|
}).catch((e) => {
|
|
|
this.$message.error(e || "下载失败,请重新尝试!");
|