|
@@ -1,13 +1,20 @@
|
|
|
<template>
|
|
|
<div class="mark-param-structure">
|
|
|
- <div class="part-box part-box-pad">
|
|
|
- <p class="tips-info">
|
|
|
- 1.请确认展示的试卷结构与提交的试卷、答题卡是否一致?
|
|
|
- </p>
|
|
|
- <p class="tips-info">2.请补充所有题目的小题分值,并确认试卷总分!</p>
|
|
|
- <p class="tips-info tips-error">
|
|
|
- 3.开始阅卷后不允许修改试卷结构,请确认清楚后再提交!
|
|
|
- </p>
|
|
|
+ <div class="part-box part-box-pad box-justify">
|
|
|
+ <div>
|
|
|
+ <p class="tips-info">
|
|
|
+ 1.请确认展示的试卷结构与提交的试卷、答题卡是否一致?
|
|
|
+ </p>
|
|
|
+ <p class="tips-info">2.请补充所有题目的小题分值,并确认试卷总分!</p>
|
|
|
+ <p class="tips-info tips-error">
|
|
|
+ 3.开始阅卷后不允许修改试卷结构,请确认清楚后再提交!
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div v-if="checkPrivilege('link', 'EditPaperStruct')">
|
|
|
+ <span>开启编辑:</span>
|
|
|
+ <el-switch v-model="editOpen" style="margin-top: -4px"></el-switch>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<div class="part-box part-box-pad mb-0">
|
|
@@ -32,7 +39,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <template v-if="structureCanEdit">
|
|
|
+ <template v-if="structureEditable">
|
|
|
<el-table-column prop="mainTitle" label="大题名称">
|
|
|
<span slot-scope="scope" v-if="scope.row.mainFirstSub">
|
|
|
<el-input
|
|
@@ -50,6 +57,8 @@
|
|
|
v-model="scope.row.questionType"
|
|
|
placeholder="请选择"
|
|
|
class="width-full"
|
|
|
+ :disabled="checkMainQuestionHasGroup(scope.row.mainId)"
|
|
|
+ @visible-change="(val) => qTypeVisibleChange(val, scope.row)"
|
|
|
@change="qTypeChange(scope.row)"
|
|
|
>
|
|
|
<el-option
|
|
@@ -170,7 +179,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- v-if="structureCanEdit"
|
|
|
+ v-if="structureEditable"
|
|
|
class-name="action-column"
|
|
|
label="操作"
|
|
|
width="200px"
|
|
@@ -189,7 +198,9 @@
|
|
|
>新增小题</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
- :disabled="tableData.length <= 1"
|
|
|
+ :disabled="
|
|
|
+ tableData.length <= 1 || checkSubQuestionHasGroup(scope.row)
|
|
|
+ "
|
|
|
class="btn-danger"
|
|
|
type="text"
|
|
|
@click="toDeleteSub(scope.row)"
|
|
@@ -225,11 +236,13 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
tableData: [],
|
|
|
+ curRow: {},
|
|
|
QUESTION_TYPE_LIST,
|
|
|
questionTypeDict: {},
|
|
|
scoresPerTopic: {},
|
|
|
intervalScorePerTopic: {},
|
|
|
loading: false,
|
|
|
+ editOpen: false,
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -237,10 +250,21 @@ export default {
|
|
|
"basicInfo",
|
|
|
"structureCanEdit",
|
|
|
"paperStructureInfo",
|
|
|
+ "groupInfo",
|
|
|
]),
|
|
|
paperTotalScore() {
|
|
|
return calcSum(this.tableData.map((item) => item.totalScore || 0));
|
|
|
},
|
|
|
+ structureEditable() {
|
|
|
+ return this.structureCanEdit || this.editOpen;
|
|
|
+ },
|
|
|
+ groupQuestions() {
|
|
|
+ return this.groupInfo
|
|
|
+ .map((group) => {
|
|
|
+ return group.questions.map((q) => `${q.mainNumber}-${q.subNumber}`);
|
|
|
+ })
|
|
|
+ .flat();
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
this.initData();
|
|
@@ -248,6 +272,8 @@ export default {
|
|
|
methods: {
|
|
|
...mapMutations("markParam", ["setPaperStructureInfo"]),
|
|
|
initData() {
|
|
|
+ this.editOpen = this.structureCanEdit;
|
|
|
+
|
|
|
let questionTypeDict = {};
|
|
|
QUESTION_TYPE_LIST.forEach((item) => {
|
|
|
questionTypeDict[item.code] = item.name;
|
|
@@ -281,7 +307,7 @@ export default {
|
|
|
this.scoresPerTopic = scoresPerTopic;
|
|
|
this.intervalScorePerTopic = intervalScorePerTopic;
|
|
|
|
|
|
- if (!this.tableData.length && this.structureCanEdit) {
|
|
|
+ if (!this.tableData.length && this.structureEditable) {
|
|
|
this.createMain();
|
|
|
}
|
|
|
},
|
|
@@ -380,7 +406,21 @@ export default {
|
|
|
item.subNumber = index + 1;
|
|
|
});
|
|
|
},
|
|
|
- toDeleteSub(row) {
|
|
|
+ async toDeleteSub(row) {
|
|
|
+ if (row.objective) {
|
|
|
+ const confirm = await this.$confirm(`确定要删除小题吗?`, "提示", {
|
|
|
+ type: "warning",
|
|
|
+ }).catch(() => {});
|
|
|
+ if (confirm !== "confirm") return;
|
|
|
+ } else {
|
|
|
+ if (
|
|
|
+ this.groupQuestions.includes(`${row.mainNumber}-${row.subNumber}`)
|
|
|
+ ) {
|
|
|
+ this.$message.error("当前小题已有分组,不可删除!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const subPos = this.tableData.findIndex((item) => item.key === row.key);
|
|
|
this.tableData.splice(subPos, 1);
|
|
|
|
|
@@ -403,7 +443,37 @@ export default {
|
|
|
.filter((item) => item.mainId === row.mainId && !item.mainFirstSub)
|
|
|
.forEach((item) => (item.mainTitle = row.mainTitle));
|
|
|
},
|
|
|
- qTypeChange(row) {
|
|
|
+ qTypeVisibleChange(val, row) {
|
|
|
+ if (!val) return;
|
|
|
+ this.curRow = { ...row };
|
|
|
+ },
|
|
|
+ checkMainQuestionHasGroup(mainId) {
|
|
|
+ return this.tableData
|
|
|
+ .filter((item) => item.mainId === mainId)
|
|
|
+ .some((item) => this.checkSubQuestionHasGroup(item));
|
|
|
+ },
|
|
|
+ checkSubQuestionHasGroup(item) {
|
|
|
+ return this.groupQuestions.includes(
|
|
|
+ `${item.mainNumber}-${item.subNumber}`
|
|
|
+ );
|
|
|
+ },
|
|
|
+ async qTypeChange(row) {
|
|
|
+ if (row.objective) {
|
|
|
+ const confirm = await this.$confirm(`确定要更改题型吗?`, "提示", {
|
|
|
+ type: "warning",
|
|
|
+ }).catch(() => {});
|
|
|
+ if (confirm !== "confirm") {
|
|
|
+ row.questionType = this.curRow.questionType;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.checkMainQuestionHasGroup(row.mainId)) {
|
|
|
+ row.questionType = this.curRow.questionType;
|
|
|
+ this.$message.error("当前大题已有分组,不可更改");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const curQt = this.QUESTION_TYPE_LIST.find(
|
|
|
(item) => item.code === row.questionType
|
|
|
);
|