diff --git a/src/components/vote/CreateVote.vue b/src/components/vote/CreateVote.vue index 4ebd6111..8fafa16d 100644 --- a/src/components/vote/CreateVote.vue +++ b/src/components/vote/CreateVote.vue @@ -36,7 +36,10 @@
- + asterisk
创建题干:
@@ -252,24 +255,24 @@ export default { }; const handleDel = ({ id, curItem }) => { - console.log(888888888); - console.log(id); - console.log(curItem); // 接口删除 if (curItem.voteStemId) { api.deleteVoteStem(curItem.voteStemId).then((res) => { - console.log(56444); - console.log(res); + if (res.data.code === 200) { + virtualDel(id); + } }); + } else { + virtualDel(); } + }; + const virtualDel = (id) => { // 前端删除 state.allFormsData.forEach((item, index) => { if (item.id === id) { state.allFormsData.splice(index, 1); } }); - console.log(5656777777777); - console.log(state.allFormsData); state.allFormsData.map((item, index) => { item.id = index + 1; return item; diff --git a/src/views/research/ResearchAdd.vue b/src/views/research/ResearchAdd.vue index 9c8c1d95..6bf08bbe 100644 --- a/src/views/research/ResearchAdd.vue +++ b/src/views/research/ResearchAdd.vue @@ -421,8 +421,9 @@ export default { questionType: "1", orderNumber: curItem.orderNumber, }).then((res) => { - console.log(56444); - console.log(res); + if (res.data.code === 200) { + virtualDel(id); + } }); } if (type === 2) { @@ -431,8 +432,9 @@ export default { questionType: "2", orderNumber: curItem.orderNumber, }).then((res) => { - console.log(56444); - console.log(res); + if (res.data.code === 200) { + virtualDel(id); + } }); } if (type === 3) { @@ -441,8 +443,9 @@ export default { questionType: "3", optionId: curItem.optionId, }).then((res) => { - console.log(56444); - console.log(res); + if (res.data.code === 200) { + virtualDel(id); + } }); } if (type === 4) { @@ -451,11 +454,16 @@ export default { questionType: "4", optionId: curItem.optionId, }).then((res) => { - console.log(56444); - console.log(res); + if (res.data.code === 200) { + virtualDel(id); + } }); } + } else { + virtualDel(); } + }; + const virtualDel = (id) => { // 前端删除 state.allFormsData.forEach((item, index) => { if (item.id === id) { diff --git a/src/views/research/components/ResearchAddSingle.vue b/src/views/research/components/ResearchAddSingle.vue index 85940ba6..e845c096 100644 --- a/src/views/research/components/ResearchAddSingle.vue +++ b/src/views/research/components/ResearchAddSingle.vue @@ -112,10 +112,15 @@ export default { questionType: "1", optionId, }).then((res) => { - console.log(56444); - console.log(res); + if (res.data.code === 200) { + virtualDel(id); + } }); + } else { + virtualDel(id); } + }; + const virtualDel = (id) => { // 前端删除 curItem.value.singleList.forEach((item, index) => { if (item.id === id) {