|
@@ -384,15 +384,6 @@ export default {
|
|
|
this.$store.dispatch("copyPage", page);
|
|
|
},
|
|
|
deletePage(page, index) {
|
|
|
- var qusetionCount = this.pages.length - this.resultPageCount;
|
|
|
- if (qusetionCount <= index) {
|
|
|
- console.log("删除结论页", index, qusetionCount);
|
|
|
- this.$store.dispatch("delPage", page);
|
|
|
- this.resultPageCount -= 1;
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- console.log("删除提目", index, qusetionCount);
|
|
|
this.$msgbox({
|
|
|
title: "删除",
|
|
|
message: "删除后不可撤回,确定删除?",
|
|
@@ -401,32 +392,40 @@ export default {
|
|
|
cancelButtonText: "取消",
|
|
|
beforeClose: (action, instance, done) => {
|
|
|
if (action === "confirm") {
|
|
|
- var pageSlelctQ = this.selectQuestions[index - 1] || [];
|
|
|
- var deleteList = [];
|
|
|
- for (var i = 0; i < pageSlelctQ.length; i++) {
|
|
|
- var question = this.questionList.filter(
|
|
|
- item => item.questionId == pageSlelctQ[i]
|
|
|
- );
|
|
|
- if (question.length > 0) {
|
|
|
- var selectIndex = this.questionList.findIndex(
|
|
|
- itemTemp => itemTemp.questionId == question[0].questionId
|
|
|
+ var qusetionCount = this.pages.length - this.resultPageCount;
|
|
|
+ if (qusetionCount <= index) {
|
|
|
+ console.log("删除结论页", index, qusetionCount);
|
|
|
+ this.$store.dispatch("delPage", page);
|
|
|
+ this.resultPageCount -= 1;
|
|
|
+ } else {
|
|
|
+ console.log("删除题目", index, qusetionCount);
|
|
|
+ var pageSlelctQ = this.selectQuestions[index - 1] || [];
|
|
|
+ var deleteList = [];
|
|
|
+ for (var i = 0; i < pageSlelctQ.length; i++) {
|
|
|
+ var question = this.questionList.filter(
|
|
|
+ item => item.questionId == pageSlelctQ[i]
|
|
|
);
|
|
|
- this.questionList[selectIndex].isChecked = false;
|
|
|
- deleteList.push({ index: selectIndex, item: question[0] });
|
|
|
+ if (question.length > 0) {
|
|
|
+ var selectIndex = this.questionList.findIndex(
|
|
|
+ itemTemp => itemTemp.questionId == question[0].questionId
|
|
|
+ );
|
|
|
+ this.questionList[selectIndex].isChecked = false;
|
|
|
+ deleteList.push({ index: selectIndex, item: question[0] });
|
|
|
+ }
|
|
|
}
|
|
|
+ for (var i = 0; i < deleteList.length; i++) {
|
|
|
+ console.log("WWWWWWWWW", deleteList[i]);
|
|
|
+ this.selectCheckbox(
|
|
|
+ false,
|
|
|
+ deleteList[i].item,
|
|
|
+ deleteList[i].index
|
|
|
+ );
|
|
|
+ }
|
|
|
+ this.questions.splice(index, 1);
|
|
|
+ this.$store.dispatch("delPage", page);
|
|
|
+ var editingPage = this.pages[index - 1];
|
|
|
+ this.setEditingPage(editingPage, index - 1);
|
|
|
}
|
|
|
- for (var i = 0; i < deleteList.length; i++) {
|
|
|
- console.log("WWWWWWWWW", deleteList[i]);
|
|
|
- this.selectCheckbox(
|
|
|
- false,
|
|
|
- deleteList[i].item,
|
|
|
- deleteList[i].index
|
|
|
- );
|
|
|
- }
|
|
|
- this.questions.splice(index, 1);
|
|
|
- this.$store.dispatch("delPage", page);
|
|
|
- var editingPage = this.pages[index - 1];
|
|
|
- this.setEditingPage(editingPage, index - 1);
|
|
|
this.$message.success("删除成功");
|
|
|
done();
|
|
|
} else {
|