mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-15 05:46:45 +08:00
t
This commit is contained in:
@@ -29,9 +29,8 @@
|
||||
</div>
|
||||
<ResearchAddItem
|
||||
v-for="(item, index) in curItem.singleList"
|
||||
:key="index"
|
||||
:key="index + new Date().getTime()"
|
||||
:item="item"
|
||||
@input="input"
|
||||
@src="imgSrc"
|
||||
@delImg="delImg"
|
||||
@del="del"
|
||||
@@ -80,21 +79,8 @@ export default {
|
||||
const curItem = ref(props.item);
|
||||
const assessmentId = ref(props.assessmentId);
|
||||
|
||||
// watch(
|
||||
// () => curItem,
|
||||
// (newVal) => {
|
||||
// console.log("6765555curItemcurItem");
|
||||
// console.log(newVal);
|
||||
// },
|
||||
// { deep: true }
|
||||
// );
|
||||
|
||||
const handleTypesDel = (type) => {
|
||||
emit("del", { id: curItem.value.id, type, curItem: curItem.value });
|
||||
// if (state.typesCur.includes(types)) {
|
||||
// const arr = state.typesCur.filter((item) => item !== types);
|
||||
// state.typesCur = arr;
|
||||
// }
|
||||
};
|
||||
|
||||
const handleSingleAdd = () => {
|
||||
@@ -104,13 +90,6 @@ export default {
|
||||
imgVal: "",
|
||||
});
|
||||
};
|
||||
const input = ({ id, val }) => {
|
||||
curItem.value.singleList.forEach((item) => {
|
||||
if (item.id === id) {
|
||||
item.inputVal = val;
|
||||
}
|
||||
});
|
||||
};
|
||||
const imgSrc = ({ id, src }) => {
|
||||
curItem.value.singleList.forEach((item) => {
|
||||
if (item.id === id) {
|
||||
@@ -126,15 +105,6 @@ export default {
|
||||
});
|
||||
};
|
||||
const del = ({ id, optionId }) => {
|
||||
// 前端删除
|
||||
curItem.value.singleList.forEach((item, index) => {
|
||||
if (item.id === id) {
|
||||
curItem.value.singleList.splice(index, 1);
|
||||
}
|
||||
});
|
||||
curItem.value.singleList.map((item, index) => {
|
||||
item.id = index + 1;
|
||||
});
|
||||
// 接口删除
|
||||
if (assessmentId.value && optionId) {
|
||||
deleteChoiceQuestion({
|
||||
@@ -146,13 +116,21 @@ export default {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
// 前端删除
|
||||
curItem.value.singleList.forEach((item, index) => {
|
||||
if (item.id === id) {
|
||||
curItem.value.singleList.splice(index, 1);
|
||||
}
|
||||
});
|
||||
curItem.value.singleList.map((item, index) => {
|
||||
item.id = index + 1;
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
curItem,
|
||||
handleTypesDel,
|
||||
handleSingleAdd,
|
||||
input,
|
||||
imgSrc,
|
||||
delImg,
|
||||
del,
|
||||
|
||||
Reference in New Issue
Block a user