mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-15 22:06:45 +08:00
t
This commit is contained in:
@@ -47,7 +47,10 @@
|
|||||||
<!-- 创建投票侧弹窗 -->
|
<!-- 创建投票侧弹窗 -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-for="(item, index) in allFormsData" :key="index">
|
<div
|
||||||
|
v-for="(item, index) in allFormsData"
|
||||||
|
:key="index + new Date().getTime()"
|
||||||
|
>
|
||||||
<VoteQuestion :item="item" @del="handleDel" />
|
<VoteQuestion :item="item" @del="handleDel" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -252,6 +255,13 @@ export default {
|
|||||||
console.log(888888888);
|
console.log(888888888);
|
||||||
console.log(id);
|
console.log(id);
|
||||||
console.log(curItem);
|
console.log(curItem);
|
||||||
|
// 接口删除
|
||||||
|
if (curItem.voteStemId) {
|
||||||
|
api.deleteVoteStem(curItem.voteStemId).then((res) => {
|
||||||
|
console.log(56444);
|
||||||
|
console.log(res);
|
||||||
|
});
|
||||||
|
}
|
||||||
// 前端删除
|
// 前端删除
|
||||||
state.allFormsData.forEach((item, index) => {
|
state.allFormsData.forEach((item, index) => {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
@@ -264,13 +274,6 @@ export default {
|
|||||||
item.id = index + 1;
|
item.id = index + 1;
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
// 接口删除
|
|
||||||
if (curItem.voteStemId) {
|
|
||||||
api.deleteVoteStem(curItem.voteStemId).then((res) => {
|
|
||||||
console.log(56444);
|
|
||||||
console.log(res);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
|
|||||||
@@ -26,9 +26,8 @@
|
|||||||
<VoteQuestionItem
|
<VoteQuestionItem
|
||||||
v-model:info="info"
|
v-model:info="info"
|
||||||
v-for="(item, index) in curItem.optionDetailList"
|
v-for="(item, index) in curItem.optionDetailList"
|
||||||
:key="index"
|
:key="index + new Date().getTime()"
|
||||||
:item="item"
|
:item="item"
|
||||||
@input="input"
|
|
||||||
@src="imgSrc"
|
@src="imgSrc"
|
||||||
@delImg="delImg"
|
@delImg="delImg"
|
||||||
@del="del"
|
@del="del"
|
||||||
@@ -83,13 +82,6 @@ export default {
|
|||||||
imgVal: "",
|
imgVal: "",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const input = ({ id, val }) => {
|
|
||||||
curItem.value.optionDetailList.forEach((item) => {
|
|
||||||
if (item.id === id) {
|
|
||||||
item.inputVal = val;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const imgSrc = ({ id, src }) => {
|
const imgSrc = ({ id, src }) => {
|
||||||
curItem.value.optionDetailList.forEach((item) => {
|
curItem.value.optionDetailList.forEach((item) => {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
@@ -124,7 +116,6 @@ export default {
|
|||||||
curItem,
|
curItem,
|
||||||
handleTypesDel,
|
handleTypesDel,
|
||||||
handleSingleAdd,
|
handleSingleAdd,
|
||||||
input,
|
|
||||||
imgSrc,
|
imgSrc,
|
||||||
delImg,
|
delImg,
|
||||||
del,
|
del,
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
show-count
|
show-count
|
||||||
:maxlength="30"
|
:maxlength="30"
|
||||||
style="border-radius: 8px"
|
style="border-radius: 8px"
|
||||||
@change="handleInput"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -67,9 +66,6 @@ export default {
|
|||||||
hasImgName: "",
|
hasImgName: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleInput = () => {
|
|
||||||
emit("input", { id: curItem.value.id, val: curItem.value.inputVal });
|
|
||||||
};
|
|
||||||
const handleDel = () => {
|
const handleDel = () => {
|
||||||
handleCancel();
|
handleCancel();
|
||||||
emit("del", { id: curItem.value.id, optionId: curItem.value.optionId });
|
emit("del", { id: curItem.value.id, optionId: curItem.value.optionId });
|
||||||
@@ -112,7 +108,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
curItem,
|
curItem,
|
||||||
handleInput,
|
|
||||||
handleDel,
|
handleDel,
|
||||||
handleCancel,
|
handleCancel,
|
||||||
beforeUpload,
|
beforeUpload,
|
||||||
|
|||||||
@@ -17,7 +17,10 @@
|
|||||||
<div class="types" @click="handleTypes(3)">问答题</div>
|
<div class="types" @click="handleTypes(3)">问答题</div>
|
||||||
<div class="types" @click="handleTypes(4)">评分题</div>
|
<div class="types" @click="handleTypes(4)">评分题</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="(item, index) in allFormsData" :key="index">
|
<div
|
||||||
|
v-for="(item, index) in allFormsData"
|
||||||
|
:key="index + new Date().getTime()"
|
||||||
|
>
|
||||||
<ResearchAddSingle
|
<ResearchAddSingle
|
||||||
v-if="item.type === 1"
|
v-if="item.type === 1"
|
||||||
:item="item"
|
:item="item"
|
||||||
@@ -88,7 +91,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { reactive, toRefs, computed, getCurrentInstance } from "vue";
|
import { reactive, toRefs, computed } from "vue";
|
||||||
// import { message } from "ant-design-vue";
|
// import { message } from "ant-design-vue";
|
||||||
// import { createResearch } from "../../api/indexResearch";
|
// import { createResearch } from "../../api/indexResearch";
|
||||||
import ResearchAddSingle from "./components/ResearchAddSingle.vue";
|
import ResearchAddSingle from "./components/ResearchAddSingle.vue";
|
||||||
@@ -121,11 +124,6 @@ export default {
|
|||||||
ResearchAddPin,
|
ResearchAddPin,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
let { ctx: that } = getCurrentInstance();
|
|
||||||
const reload = () => {
|
|
||||||
that.$forceUpdate();
|
|
||||||
};
|
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
assessmentId: "", //编辑时候传
|
assessmentId: "", //编辑时候传
|
||||||
@@ -158,8 +156,6 @@ export default {
|
|||||||
];
|
];
|
||||||
sortBy(renderArr, "orderNumber"); //序号
|
sortBy(renderArr, "orderNumber"); //序号
|
||||||
state.allFormsData = parseData(renderArr, "questionType"); //类型
|
state.allFormsData = parseData(renderArr, "questionType"); //类型
|
||||||
console.log("state.allFormsData11111111111");
|
|
||||||
console.log(state.allFormsData);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getInfoDate();
|
getInfoDate();
|
||||||
@@ -417,27 +413,9 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDel = ({ id, type, curItem }) => {
|
const handleDel = ({ id, type, curItem }) => {
|
||||||
console.log(888888888);
|
|
||||||
console.log(id);
|
|
||||||
console.log(curItem);
|
|
||||||
// 前端删除
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
reload();
|
|
||||||
// 接口删除
|
// 接口删除
|
||||||
if (state.assessmentId && curItem.orderNumber) {
|
if (state.assessmentId && curItem.orderNumber) {
|
||||||
if (type === 1) {
|
if (type === 1) {
|
||||||
console.log(11111);
|
|
||||||
console.log(curItem);
|
|
||||||
deleteChoiceQuestion({
|
deleteChoiceQuestion({
|
||||||
assessmentId: state.assessmentId,
|
assessmentId: state.assessmentId,
|
||||||
questionType: "1",
|
questionType: "1",
|
||||||
@@ -445,12 +423,9 @@ export default {
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(56444);
|
console.log(56444);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
reload();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (type === 2) {
|
if (type === 2) {
|
||||||
console.log(11111);
|
|
||||||
console.log(curItem);
|
|
||||||
deleteChoiceQuestion({
|
deleteChoiceQuestion({
|
||||||
assessmentId: state.assessmentId,
|
assessmentId: state.assessmentId,
|
||||||
questionType: "2",
|
questionType: "2",
|
||||||
@@ -458,12 +433,9 @@ export default {
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(56444);
|
console.log(56444);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
reload();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (type === 3) {
|
if (type === 3) {
|
||||||
console.log(2222);
|
|
||||||
console.log(curItem);
|
|
||||||
deleteQuestionScAndQa({
|
deleteQuestionScAndQa({
|
||||||
assessmentId: state.assessmentId,
|
assessmentId: state.assessmentId,
|
||||||
questionType: "3",
|
questionType: "3",
|
||||||
@@ -471,12 +443,9 @@ export default {
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(56444);
|
console.log(56444);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
reload();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (type === 4) {
|
if (type === 4) {
|
||||||
console.log(2222);
|
|
||||||
console.log(curItem);
|
|
||||||
deleteQuestionScAndQa({
|
deleteQuestionScAndQa({
|
||||||
assessmentId: state.assessmentId,
|
assessmentId: state.assessmentId,
|
||||||
questionType: "4",
|
questionType: "4",
|
||||||
@@ -484,10 +453,19 @@ export default {
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(56444);
|
console.log(56444);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
reload();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 前端删除
|
||||||
|
state.allFormsData.forEach((item, index) => {
|
||||||
|
if (item.id === id) {
|
||||||
|
state.allFormsData.splice(index, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
state.allFormsData.map((item, index) => {
|
||||||
|
item.id = index + 1;
|
||||||
|
return item;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
@@ -497,8 +475,6 @@ export default {
|
|||||||
if (!checkVal(filterData)) {
|
if (!checkVal(filterData)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
console.log(12121212);
|
|
||||||
console.log(filterData);
|
|
||||||
|
|
||||||
if (state.assessmentId) {
|
if (state.assessmentId) {
|
||||||
resultPost = {
|
resultPost = {
|
||||||
@@ -511,8 +487,6 @@ export default {
|
|||||||
"assessmentMaxScore",
|
"assessmentMaxScore",
|
||||||
"assessmentMinScore",
|
"assessmentMinScore",
|
||||||
]);
|
]);
|
||||||
console.log(1212334);
|
|
||||||
console.log(resultPost);
|
|
||||||
editResearchMessage(resultPost).then((res) => {
|
editResearchMessage(resultPost).then((res) => {
|
||||||
if (res.data.code === 200) {
|
if (res.data.code === 200) {
|
||||||
message.success("编辑成功");
|
message.success("编辑成功");
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<div class="options">
|
<div class="options">
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<div class="namebox">
|
<div class="namebox">
|
||||||
<div class="inname">选项{{ item.id }}</div>
|
<div class="inname">选项{{ curItem.id }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<a-input
|
<a-input
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
show-count
|
show-count
|
||||||
:maxlength="30"
|
:maxlength="30"
|
||||||
style="border-radius: 8px"
|
style="border-radius: 8px"
|
||||||
@change="handleInput"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -20,15 +19,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="name uploadContent">
|
<div class="name uploadContent">
|
||||||
<a-upload
|
<a-upload
|
||||||
v-show="!item.imgVal"
|
v-show="!curItem.imgVal"
|
||||||
class="in uploadBtn"
|
class="in uploadBtn"
|
||||||
:show-upload-list="false"
|
:show-upload-list="false"
|
||||||
:before-upload="beforeUpload"
|
:before-upload="beforeUpload"
|
||||||
>
|
>
|
||||||
<div class="addimg">+添加图片</div>
|
<div class="addimg">+添加图片</div>
|
||||||
</a-upload>
|
</a-upload>
|
||||||
<div v-show="item.imgVal" class="picture" style="position: relative">
|
<div v-show="curItem.imgVal" class="picture" style="position: relative">
|
||||||
<img class="pictureimg" :src="item.imgVal" />
|
<img class="pictureimg" :src="curItem.imgVal" />
|
||||||
<div class="picturename" v-show="hasImgName">{{ hasImgName }}</div>
|
<div class="picturename" v-show="hasImgName">{{ hasImgName }}</div>
|
||||||
<img
|
<img
|
||||||
style="
|
style="
|
||||||
@@ -67,17 +66,18 @@ export default {
|
|||||||
hasImgName: "",
|
hasImgName: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleInput = () => {
|
|
||||||
emit("input", { id: curItem.value.id, val: curItem.value.inputVal });
|
|
||||||
};
|
|
||||||
const handleDel = () => {
|
|
||||||
handleCancel();
|
|
||||||
emit("del", { id: curItem.value.id, optionId: curItem.value.optionId });
|
|
||||||
};
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
state.hasImgName = "";
|
state.hasImgName = "";
|
||||||
emit("delImg", { id: curItem.value.id });
|
emit("delImg", { id: curItem.value.id });
|
||||||
};
|
};
|
||||||
|
const handleDel = () => {
|
||||||
|
handleCancel();
|
||||||
|
emit("del", {
|
||||||
|
id: curItem.value.id,
|
||||||
|
optionId: curItem.value.optionId,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const beforeUpload = (file) => {
|
const beforeUpload = (file) => {
|
||||||
const isJpgOrPng =
|
const isJpgOrPng =
|
||||||
file.type === "image/jpg" ||
|
file.type === "image/jpg" ||
|
||||||
@@ -99,7 +99,6 @@ export default {
|
|||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("file", file);
|
formData.append("file", file);
|
||||||
console.log(file);
|
|
||||||
fileUp(formData).then((res) => {
|
fileUp(formData).then((res) => {
|
||||||
if (res.data.code === 200) {
|
if (res.data.code === 200) {
|
||||||
state.hasImgName = file.name;
|
state.hasImgName = file.name;
|
||||||
@@ -112,7 +111,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
curItem,
|
curItem,
|
||||||
handleInput,
|
|
||||||
handleDel,
|
handleDel,
|
||||||
handleCancel,
|
handleCancel,
|
||||||
beforeUpload,
|
beforeUpload,
|
||||||
|
|||||||
@@ -29,9 +29,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<ResearchAddItem
|
<ResearchAddItem
|
||||||
v-for="(item, index) in curItem.singleList"
|
v-for="(item, index) in curItem.singleList"
|
||||||
:key="index"
|
:key="index + new Date().getTime()"
|
||||||
:item="item"
|
:item="item"
|
||||||
@input="input"
|
|
||||||
@src="imgSrc"
|
@src="imgSrc"
|
||||||
@delImg="delImg"
|
@delImg="delImg"
|
||||||
@del="del"
|
@del="del"
|
||||||
@@ -80,21 +79,8 @@ export default {
|
|||||||
const curItem = ref(props.item);
|
const curItem = ref(props.item);
|
||||||
const assessmentId = ref(props.assessmentId);
|
const assessmentId = ref(props.assessmentId);
|
||||||
|
|
||||||
// watch(
|
|
||||||
// () => curItem,
|
|
||||||
// (newVal) => {
|
|
||||||
// console.log("6765555curItemcurItem");
|
|
||||||
// console.log(newVal);
|
|
||||||
// },
|
|
||||||
// { deep: true }
|
|
||||||
// );
|
|
||||||
|
|
||||||
const handleTypesDel = (type) => {
|
const handleTypesDel = (type) => {
|
||||||
emit("del", { id: curItem.value.id, type, curItem: curItem.value });
|
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 = () => {
|
const handleSingleAdd = () => {
|
||||||
@@ -104,13 +90,6 @@ export default {
|
|||||||
imgVal: "",
|
imgVal: "",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const input = ({ id, val }) => {
|
|
||||||
curItem.value.singleList.forEach((item) => {
|
|
||||||
if (item.id === id) {
|
|
||||||
item.inputVal = val;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const imgSrc = ({ id, src }) => {
|
const imgSrc = ({ id, src }) => {
|
||||||
curItem.value.singleList.forEach((item) => {
|
curItem.value.singleList.forEach((item) => {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
@@ -126,15 +105,6 @@ export default {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
const del = ({ id, optionId }) => {
|
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) {
|
if (assessmentId.value && optionId) {
|
||||||
deleteChoiceQuestion({
|
deleteChoiceQuestion({
|
||||||
@@ -146,13 +116,21 @@ export default {
|
|||||||
console.log(res);
|
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 {
|
return {
|
||||||
curItem,
|
curItem,
|
||||||
handleTypesDel,
|
handleTypesDel,
|
||||||
handleSingleAdd,
|
handleSingleAdd,
|
||||||
input,
|
|
||||||
imgSrc,
|
imgSrc,
|
||||||
delImg,
|
delImg,
|
||||||
del,
|
del,
|
||||||
|
|||||||
Reference in New Issue
Block a user