|
@@ -365,28 +365,51 @@ export default {
|
|
|
this.$store.dispatch("copyPage", page);
|
|
|
},
|
|
|
deletePage(page, index) {
|
|
|
- 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
|
|
|
- );
|
|
|
- this.questionList[selectIndex].isChecked = false;
|
|
|
- deleteList.push({ index: selectIndex, item: question[0] });
|
|
|
+ this.$msgbox({
|
|
|
+ title: "删除",
|
|
|
+ message: "删除后不可撤回,确定删除?",
|
|
|
+ showCancelButton: true,
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ beforeClose: (action, instance, done) => {
|
|
|
+ if (action === "confirm") {
|
|
|
+ instance.confirmButtonLoading = true;
|
|
|
+ instance.confirmButtonText = "执行中...";
|
|
|
+ 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
|
|
|
+ );
|
|
|
+ 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);
|
|
|
+ this.$message.success("删除成功");
|
|
|
+ done();
|
|
|
+ } else {
|
|
|
+ done();
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- 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);
|
|
|
+ })
|
|
|
+ .then(() => {})
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
addPage() {
|
|
|
this.bodyBackgroundColor =
|