From f233f6710f7a087c41c6bf9123763fdbb6d22b23 Mon Sep 17 00:00:00 2001
From: kclf <1195754634@qq.com>
Date: Mon, 5 Dec 2022 11:19:05 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BA=A4=E4=BA=92=E4=BF=AE?=
=?UTF-8?q?=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/vote/CreateVote.vue | 19 ++++++++-------
src/views/research/ResearchAdd.vue | 24 ++++++++++++-------
.../research/components/ResearchAddSingle.vue | 9 +++++--
3 files changed, 34 insertions(+), 18 deletions(-)
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 @@
-

+
创建题干:
@@ -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) {