mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 02:46:45 +08:00
补删除简单和评分修复bug
This commit is contained in:
@@ -414,7 +414,7 @@ export default {
|
||||
|
||||
const handleDel = ({ id, type, curItem }) => {
|
||||
// 接口删除
|
||||
if (state.assessmentId && curItem.orderNumber) {
|
||||
if (state.assessmentId && (curItem.orderNumber || curItem.optionId)) {
|
||||
if (type === 1) {
|
||||
deleteChoiceQuestion({
|
||||
assessmentId: state.assessmentId,
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
v-for="(item, index) in curItem.mutilList"
|
||||
:key="index"
|
||||
:item="item"
|
||||
@input="inputMutil"
|
||||
@src="imgSrcMutil"
|
||||
@delImg="delImgMutil"
|
||||
@del="delMutil"
|
||||
@@ -95,13 +94,6 @@ export default {
|
||||
imgVal: "",
|
||||
});
|
||||
};
|
||||
const inputMutil = ({ id, val }) => {
|
||||
curItem.value.mutilList.forEach((item) => {
|
||||
if (item.id === id) {
|
||||
item.inputVal = val;
|
||||
}
|
||||
});
|
||||
};
|
||||
const imgSrcMutil = ({ id, src }) => {
|
||||
curItem.value.mutilList.forEach((item) => {
|
||||
if (item.id === id) {
|
||||
@@ -117,6 +109,23 @@ export default {
|
||||
});
|
||||
};
|
||||
const delMutil = ({ id, optionId }) => {
|
||||
// 接口删除
|
||||
if (assessmentId.value && optionId) {
|
||||
deleteChoiceQuestion({
|
||||
assessmentId: assessmentId.value,
|
||||
questionType: "2",
|
||||
optionId,
|
||||
}).then((res) => {
|
||||
if (res.data.code === 200) {
|
||||
virtualDel(id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
virtualDel(id);
|
||||
}
|
||||
};
|
||||
const virtualDel = (id) => {
|
||||
// 前端删除
|
||||
curItem.value.mutilList.forEach((item, index) => {
|
||||
if (item.id === id) {
|
||||
curItem.value.mutilList.splice(index, 1);
|
||||
@@ -125,22 +134,12 @@ export default {
|
||||
curItem.value.mutilList.map((item, index) => {
|
||||
item.id = index + 1;
|
||||
});
|
||||
|
||||
deleteChoiceQuestion({
|
||||
assessmentId: assessmentId.value,
|
||||
questionType: "2",
|
||||
optionId,
|
||||
}).then((res) => {
|
||||
console.log(56444);
|
||||
console.log(res);
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
curItem,
|
||||
handleTypesDel,
|
||||
handleMutilAdd,
|
||||
inputMutil,
|
||||
imgSrcMutil,
|
||||
delImgMutil,
|
||||
delMutil,
|
||||
|
||||
Reference in New Issue
Block a user