|
@@ -12,8 +12,7 @@
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div v-if="checkPrivilege('link', 'EditPaperStruct')">
|
|
<div v-if="checkPrivilege('link', 'EditPaperStruct')">
|
|
- <span>开启编辑:</span>
|
|
|
|
- <el-switch v-model="editOpen" style="margin-top: -4px"></el-switch>
|
|
|
|
|
|
+ <el-switch v-model="editOpen" active-text="开启编辑"></el-switch>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@@ -226,7 +225,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { calcSum } from "@/plugins/utils";
|
|
|
|
|
|
+import { calcSum, maxNum } from "@/plugins/utils";
|
|
import { QUESTION_TYPE_LIST } from "@/constants/enumerate";
|
|
import { QUESTION_TYPE_LIST } from "@/constants/enumerate";
|
|
import { mapState, mapMutations } from "vuex";
|
|
import { mapState, mapMutations } from "vuex";
|
|
import { markStructureSave } from "../../api";
|
|
import { markStructureSave } from "../../api";
|
|
@@ -365,22 +364,25 @@ export default {
|
|
}
|
|
}
|
|
if (nextMainStartPos === null) return this.tableData.length;
|
|
if (nextMainStartPos === null) return this.tableData.length;
|
|
},
|
|
},
|
|
|
|
+ getNewMainNumber() {
|
|
|
|
+ return maxNum(this.tableData.map((item) => item.mainNumber)) + 1;
|
|
|
|
+ },
|
|
toAddMain(row) {
|
|
toAddMain(row) {
|
|
const startPos = this.tableData.findIndex((item) => item.key === row.key);
|
|
const startPos = this.tableData.findIndex((item) => item.key === row.key);
|
|
const nextMainStartPos = this.getNextMainStartPos(startPos, row.mainId);
|
|
const nextMainStartPos = this.getNextMainStartPos(startPos, row.mainId);
|
|
|
|
+
|
|
this.tableData.splice(
|
|
this.tableData.splice(
|
|
nextMainStartPos,
|
|
nextMainStartPos,
|
|
0,
|
|
0,
|
|
this.getNewRow({
|
|
this.getNewRow({
|
|
mainId: this.$randomCode(),
|
|
mainId: this.$randomCode(),
|
|
- mainNumber: row.mainNumber + 1,
|
|
|
|
|
|
+ mainNumber: this.getNewMainNumber(),
|
|
totalScore: row.totalScore,
|
|
totalScore: row.totalScore,
|
|
questionType: row.questionType,
|
|
questionType: row.questionType,
|
|
objective: row.objective,
|
|
objective: row.objective,
|
|
})
|
|
})
|
|
);
|
|
);
|
|
this.$set(this.intervalScorePerTopic, row.mainId, undefined);
|
|
this.$set(this.intervalScorePerTopic, row.mainId, undefined);
|
|
- this.updateMainData();
|
|
|
|
},
|
|
},
|
|
updateMainData() {
|
|
updateMainData() {
|
|
let curMainNumber = 0,
|
|
let curMainNumber = 0,
|
|
@@ -438,7 +440,6 @@ export default {
|
|
item.mainFirstSub = !index;
|
|
item.mainFirstSub = !index;
|
|
});
|
|
});
|
|
this.updateSubData(row.mainId);
|
|
this.updateSubData(row.mainId);
|
|
- this.updateMainData();
|
|
|
|
},
|
|
},
|
|
switchExpandSub(row) {
|
|
switchExpandSub(row) {
|
|
row.expandSub = !row.expandSub;
|
|
row.expandSub = !row.expandSub;
|