|
@@ -288,16 +288,15 @@
|
|
|
label="试卷模板"
|
|
|
>
|
|
|
<el-select
|
|
|
- v-model="curPaperTemp"
|
|
|
+ v-model="exportModel.paperTemplateId"
|
|
|
placeholder="请选择试卷模板"
|
|
|
- value-key="id"
|
|
|
@change="paperTempChange"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in paperTempList"
|
|
|
:key="item.id"
|
|
|
:label="item.name"
|
|
|
- :value="item"
|
|
|
+ :value="item.id"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
@@ -339,6 +338,7 @@
|
|
|
ref="PaperBuildConfig"
|
|
|
:config-sources="configSources"
|
|
|
:show-confirm-btn="false"
|
|
|
+ :build-config="buildConfig"
|
|
|
></paper-build-config>
|
|
|
<div slot="footer">
|
|
|
<el-button
|
|
@@ -458,7 +458,11 @@ import { QUESTION_API } from "@/constants/constants";
|
|
|
import { LEVEL_TYPE, PUBLICITY_LIST } from "../constants/constants";
|
|
|
import { mapState } from "vuex";
|
|
|
import { downloadByApi, downloadByBlob } from "@/plugins/download";
|
|
|
-import { paperTemplateListApi } from "../../paper-export/api";
|
|
|
+import {
|
|
|
+ paperTemplateListApi,
|
|
|
+ paperParamInfoApi,
|
|
|
+ paperParamSaveApi,
|
|
|
+} from "../../paper-export/api";
|
|
|
import { deepCopy } from "@/plugins/utils";
|
|
|
import { paperDetailInfoApi } from "../../paper/api";
|
|
|
import { buildPdf } from "@/plugins/htmlToPdf";
|
|
@@ -519,6 +523,7 @@ export default {
|
|
|
templateId: "",
|
|
|
exportContent: "",
|
|
|
seqMode: "MODE3",
|
|
|
+ paperTemplateId: "",
|
|
|
},
|
|
|
pageCountMode: "SIMPLE",
|
|
|
isShow: true,
|
|
@@ -535,6 +540,7 @@ export default {
|
|
|
examId: [{ required: true, message: "请输入名称", trigger: "change" }],
|
|
|
},
|
|
|
// pdf download
|
|
|
+ buildConfig: {},
|
|
|
paperPreviewUrl: "",
|
|
|
answerPreviewUrl: "",
|
|
|
downloading: false,
|
|
@@ -596,9 +602,19 @@ export default {
|
|
|
delete window.submitPaperTemp;
|
|
|
},
|
|
|
methods: {
|
|
|
- exportContentChange(val) {
|
|
|
+ async exportContentChange(val) {
|
|
|
if (val === "PAPER") {
|
|
|
- this.getPaperTempList();
|
|
|
+ await this.getParamInfo();
|
|
|
+ await this.getPaperTempList();
|
|
|
+
|
|
|
+ if (!this.paperTempList.length) {
|
|
|
+ this.$message.error("导出模板缺失!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const curPaperTemp = this.paperTempList.find(
|
|
|
+ (item) => item.id === this.exportModel.paperTemplateId
|
|
|
+ );
|
|
|
+ this.paperTempChange(curPaperTemp || this.paperTempList[0]);
|
|
|
return;
|
|
|
}
|
|
|
if (val === "ANSWER") {
|
|
@@ -1059,12 +1075,28 @@ export default {
|
|
|
this.searchGenPaper();
|
|
|
},
|
|
|
// download paper pdf
|
|
|
+ async getParamInfo() {
|
|
|
+ const res = await paperParamInfoApi(this.exportModel.id);
|
|
|
+ const result = res.data || {};
|
|
|
+ this.exportModel.seqMode = result.seqMode || "MODE3";
|
|
|
+ this.exportModel.paperTemplateId = result.paperTemplateId || "";
|
|
|
+ this.buildConfig = result;
|
|
|
+ },
|
|
|
+ async saveParamInfo() {
|
|
|
+ await paperParamSaveApi({
|
|
|
+ paperId: this.exportModel.id,
|
|
|
+ seqMode: this.exportModel.seqMode,
|
|
|
+ paperTemplateId: this.exportModel.paperTemplateId,
|
|
|
+ ...this.$refs.PaperBuildConfig.getData(),
|
|
|
+ });
|
|
|
+ },
|
|
|
async getPaperTempList() {
|
|
|
if (this.paperTempList.length) return;
|
|
|
const res = await paperTemplateListApi("PAPER_EXPORT");
|
|
|
this.paperTempList = res.data;
|
|
|
},
|
|
|
paperTempChange(paperTemp) {
|
|
|
+ this.curPaperTemp = paperTemp;
|
|
|
// console.log(paperTemp);
|
|
|
let paperTempJson = paperTemp.content
|
|
|
? JSON.parse(paperTemp.content)
|
|
@@ -1102,6 +1134,7 @@ export default {
|
|
|
if (this.downloading) return;
|
|
|
this.downloading = true;
|
|
|
|
|
|
+ this.saveParamInfo();
|
|
|
const configModalForm = this.$refs.PaperBuildConfig.getData();
|
|
|
window.paperSet = {
|
|
|
paperTemp: this.curPaperTemp,
|