mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 12:26:47 +08:00
fix:修改投票信息不显示问题
This commit is contained in:
@@ -42,10 +42,10 @@ import qs from 'qs';
|
||||
// 接口-请求
|
||||
|
||||
//基础票数上传接口
|
||||
export const baseVoteupload = (obj) => http.post('/vote/baseVoteupload', obj,{
|
||||
export const baseVoteupload = (obj) => http.post('/vote/baseVoteupload', obj, {
|
||||
headers: {
|
||||
'token': '123',
|
||||
'Content-Type' : 'multipart/form-data',
|
||||
'Content-Type': 'multipart/form-data',
|
||||
|
||||
}
|
||||
})
|
||||
@@ -60,7 +60,7 @@ export const createVote = (obj) => http.post('/vote/createVote', obj)
|
||||
export const deleteVoteMessage = (obj) => http.post('/vote/deleteVoteMessage', { params: obj })
|
||||
|
||||
//删除题干信息接口
|
||||
export const deleteVoteStem = (obj) => http.post('/vote/deleteVoteStem', obj,{
|
||||
export const deleteVoteStem = (obj) => http.post('/vote/deleteVoteStem', obj, {
|
||||
headers: {
|
||||
'token': '123',
|
||||
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
|
||||
@@ -74,12 +74,7 @@ export const deleteVoteStemOption = (obj) => http.post('/vote/deleteVoteStemOpti
|
||||
export const editVote = (obj) => http.post('/vote/editVote', obj)
|
||||
|
||||
//根据题干ID获取题干信息
|
||||
export const queryStemByStemId = (obj) => http.post('/vote/queryStemByStemId', obj,{
|
||||
headers: {
|
||||
'token': '123',
|
||||
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
|
||||
}
|
||||
})
|
||||
export const queryStemByStemId = (ballotId) => http.post(`/vote/queryStemByStemId?ballotId=${ballotId}`)
|
||||
|
||||
//修改题干信息接口
|
||||
export const updateStemMessage = (obj) => http.post('/vote/updateStemMessage', obj);
|
||||
@@ -87,12 +82,7 @@ export const updateStemMessage = (obj) => http.post('/vote/updateStemMessage', o
|
||||
//上传组件
|
||||
export const fileUp = (obj) => http.post('/file/upload', obj, qs.stringify({ obj }));
|
||||
//根据题干ID获取投票任务
|
||||
export const queryVoteDetailById = (obj) => http.post('/vote/queryVoteDetailById', obj,{
|
||||
headers: {
|
||||
'token': '123',
|
||||
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
|
||||
}
|
||||
})
|
||||
export const queryVoteDetailById = (obj) => http.post('/vote/queryVoteDetailById', obj)
|
||||
|
||||
// 测试方法
|
||||
// import * as api from '../../api/index'
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
<!-- 评估管理-创建评估页面 -->
|
||||
<template>
|
||||
<a-drawer
|
||||
:visible="createVoteVisible"
|
||||
class="drawerStyle createvoteDrawer"
|
||||
width="100%"
|
||||
placement="right"
|
||||
@after-visible-change="afterVisibleChange"
|
||||
>
|
||||
<a-drawer :visible="createVoteVisible" class="drawerStyle createvoteDrawer" width="100%" placement="right"
|
||||
@after-visible-change="afterVisibleChange">
|
||||
<div class="researchadd">
|
||||
<div class="header">
|
||||
<div class="headerTitle">创建投票</div>
|
||||
<img
|
||||
style="width: 29px; height: 29px; cursor: pointer"
|
||||
src="../../assets/images/basicinfo/close.png"
|
||||
@click="closeDrawer"
|
||||
/>
|
||||
<img style="width: 29px; height: 29px; cursor: pointer" src="../../assets/images/basicinfo/close.png"
|
||||
@click="closeDrawer" />
|
||||
</div>
|
||||
<div class="main_left">
|
||||
<div class="main_item">
|
||||
@@ -25,12 +17,8 @@
|
||||
<span style="margin-right: 3px">投票名称:</span>
|
||||
</div>
|
||||
<div class="btnbox">
|
||||
<a-input
|
||||
v-model:value="ballotName"
|
||||
style="width: 424px; height: 32px"
|
||||
placeholder="请输入任务名称"
|
||||
maxlength="20"
|
||||
/>
|
||||
<a-input v-model:value="ballotName" style="width: 424px; height: 32px" placeholder="请输入任务名称"
|
||||
maxlength="20" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="main_item">
|
||||
@@ -52,29 +40,20 @@
|
||||
|
||||
<div class="footer">
|
||||
<div class="btn">
|
||||
<a-button
|
||||
type="primary"
|
||||
style="
|
||||
<a-button type="primary" style="
|
||||
width: 100px;
|
||||
height: 40px;
|
||||
border-radius: 8px;
|
||||
background-color: #409eff;
|
||||
"
|
||||
@click="handleSave"
|
||||
>
|
||||
" @click="handleSave">
|
||||
保存
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
ghost
|
||||
style="
|
||||
<a-button type="primary" ghost style="
|
||||
width: 100px;
|
||||
height: 40px;
|
||||
margin-left: 14px;
|
||||
border-radius: 8px;
|
||||
"
|
||||
@click="handleAllCancel"
|
||||
>
|
||||
" @click="handleAllCancel">
|
||||
取消
|
||||
</a-button>
|
||||
</div>
|
||||
@@ -84,21 +63,21 @@
|
||||
</template>
|
||||
<script>
|
||||
import { reactive, toRefs } from "vue";
|
||||
import { message } from "ant-design-vue";
|
||||
import { message } from "ant-design-vue";
|
||||
// import { createResearch } from "../../api/indexResearch";
|
||||
import VoteQuestion from "./VoteQuestion.vue";
|
||||
|
||||
import {
|
||||
// sortBy,
|
||||
traverseArr,
|
||||
//filterCommon,
|
||||
//filterCommon,
|
||||
// deepCloneFilterString,
|
||||
} from "../../utils/utils";
|
||||
|
||||
//import store from "@/store";
|
||||
import * as api from "@/api/indexVote";
|
||||
//import { useRouter } from "vue-router";
|
||||
import {} from "@/api/indexResearch";
|
||||
import { } from "@/api/indexResearch";
|
||||
|
||||
//import { message } from "ant-design-vue";
|
||||
|
||||
@@ -128,11 +107,11 @@ export default {
|
||||
allFormsData: [],
|
||||
|
||||
});
|
||||
// const router = useRouter();
|
||||
// const router = useRouter();
|
||||
const afterVisibleChange = () => {
|
||||
if(state.ballotId>0){
|
||||
if (props.ballotId) {
|
||||
getInfoDate();
|
||||
}else{
|
||||
} else {
|
||||
handleTypes();
|
||||
|
||||
}
|
||||
@@ -145,23 +124,23 @@ export default {
|
||||
};
|
||||
// 详情
|
||||
const getInfoDate = async () => {
|
||||
console.log("props.editChild=====",props.editChild);
|
||||
if (props.ballotId>0) {
|
||||
console.log("props.editChild2=====",props.editChild);
|
||||
console.log("props.editChild=====", props.editChild);
|
||||
if (props.ballotId) {
|
||||
console.log("props.editChild2=====", props.editChild);
|
||||
let res = await api
|
||||
.queryStemByStemId({ballotId:props.ballotId})
|
||||
.queryStemByStemId(props.ballotId)
|
||||
.then((res) => {
|
||||
if (res.data.code === 200) {
|
||||
return res.data.data;
|
||||
}
|
||||
});
|
||||
console.log("res====",res);
|
||||
console.log("res====", res);
|
||||
state.ballotName = res.ballotId;
|
||||
// let renderArr = [...res];
|
||||
// let renderArr = [...res];
|
||||
// sortBy(renderArr, "orderNumber"); //序号
|
||||
state.allFormsData = parseData(res); //类型
|
||||
|
||||
console.log( state.allFormsData);
|
||||
console.log(state.allFormsData);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -170,24 +149,24 @@ export default {
|
||||
const parseData = (arr) => {
|
||||
const resultArr = [];
|
||||
state.ballotId = arr.ballotId;
|
||||
state.ballotName =arr.ballotName;
|
||||
state.ballotName = arr.ballotName;
|
||||
|
||||
console.log("arr.voteStemVoList=====",arr.voteStemVoList);
|
||||
console.log("arr.voteStemVoList=====", arr.voteStemVoList);
|
||||
arr.voteStemVoList.forEach((item) => {
|
||||
let obj = {};
|
||||
let restList = traverseArr(item.optionDetailList, {
|
||||
inputVal: "optionName",
|
||||
imgVal: "optionPictureAddress",
|
||||
optionId: "optionId",
|
||||
voteStemId:"voteStemId",
|
||||
stem:"stem",
|
||||
voteStemId: "voteStemId",
|
||||
stem: "stem",
|
||||
}).map((itm, idx) => {
|
||||
itm.id = idx + 1;
|
||||
return itm;
|
||||
});
|
||||
|
||||
obj = {
|
||||
voteStemId:item.voteStemId,
|
||||
voteStemId: item.voteStemId,
|
||||
valueSingle: item.voteStemName,
|
||||
singleList: restList,
|
||||
};
|
||||
@@ -200,19 +179,19 @@ export default {
|
||||
return resultArr;
|
||||
};
|
||||
|
||||
// 转换成后端格式
|
||||
const restData = (arr) => {
|
||||
const resultArr = [];
|
||||
arr.forEach((item) => {
|
||||
let obj = {};
|
||||
console.log("item=======",item);
|
||||
// if (item[typeKey] === 1) {
|
||||
// 转换成后端格式
|
||||
const restData = (arr) => {
|
||||
const resultArr = [];
|
||||
arr.forEach((item) => {
|
||||
let obj = {};
|
||||
console.log("item=======", item);
|
||||
// if (item[typeKey] === 1) {
|
||||
let restList = traverseArr(item.singleList, {
|
||||
optionName: "inputVal",
|
||||
optionPictureAddress: "imgVal",
|
||||
optionId: "optionId",
|
||||
voteStemId:"voteStemId",
|
||||
stem:"stem",
|
||||
voteStemId: "voteStemId",
|
||||
stem: "stem",
|
||||
}).map((itm, idx) => {
|
||||
itm.optionOrderNum = idx + 1;
|
||||
return itm;
|
||||
@@ -227,51 +206,51 @@ export default {
|
||||
|
||||
voteStemName: item.valueSingle,
|
||||
optionDetailList: restList,
|
||||
voteStemId:item.voteStemId,
|
||||
voteStemId: item.voteStemId,
|
||||
|
||||
};
|
||||
resultArr.push(obj);
|
||||
// }
|
||||
console.log("resultArr=======",resultArr);
|
||||
// }
|
||||
console.log("resultArr=======", resultArr);
|
||||
|
||||
});
|
||||
resultArr.map((itm, idx) => {
|
||||
itm.orderNumber = idx + 1;
|
||||
return itm;
|
||||
});
|
||||
return resultArr;
|
||||
};
|
||||
});
|
||||
resultArr.map((itm, idx) => {
|
||||
itm.orderNumber = idx + 1;
|
||||
return itm;
|
||||
});
|
||||
return resultArr;
|
||||
};
|
||||
|
||||
// 解散传值
|
||||
const parseItem = (arrr) => {
|
||||
// const filterComObj = filterCommon(arr, "questionType");
|
||||
let resultObj = {};
|
||||
// for (let key in filterComObj) {
|
||||
// if (key === "1") {
|
||||
// let arrSingle = arrr
|
||||
//filterComObj[key];
|
||||
console.log("arrr======",arrr);
|
||||
/*
|
||||
let arr = [];
|
||||
arrSingle.forEach((item) => {
|
||||
console.log("item======",item);
|
||||
if (item.singleList.length) {
|
||||
item.singleList.forEach((itm) => {
|
||||
arr.push({
|
||||
...itm,
|
||||
optionName: item.optionName,
|
||||
optionOrderNum: item.optionOrderNum,
|
||||
// 解散传值
|
||||
const parseItem = (arrr) => {
|
||||
// const filterComObj = filterCommon(arr, "questionType");
|
||||
let resultObj = {};
|
||||
// for (let key in filterComObj) {
|
||||
// if (key === "1") {
|
||||
// let arrSingle = arrr
|
||||
//filterComObj[key];
|
||||
console.log("arrr======", arrr);
|
||||
/*
|
||||
let arr = [];
|
||||
arrSingle.forEach((item) => {
|
||||
console.log("item======",item);
|
||||
if (item.singleList.length) {
|
||||
item.singleList.forEach((itm) => {
|
||||
arr.push({
|
||||
...itm,
|
||||
optionName: item.optionName,
|
||||
optionOrderNum: item.optionOrderNum,
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
});*/
|
||||
resultObj.voteStemDtoList = arrr;
|
||||
// }
|
||||
console.log("resultObj======",resultObj);
|
||||
// }
|
||||
return resultObj;
|
||||
};
|
||||
});
|
||||
}
|
||||
});*/
|
||||
resultObj.voteStemDtoList = arrr;
|
||||
// }
|
||||
console.log("resultObj======", resultObj);
|
||||
// }
|
||||
return resultObj;
|
||||
};
|
||||
|
||||
|
||||
const handleTypes = () => {
|
||||
@@ -323,7 +302,7 @@ export default {
|
||||
if (!checkVal(filterData)) {
|
||||
return false;
|
||||
}
|
||||
// checkVal(filterData);
|
||||
// checkVal(filterData);
|
||||
console.log(12121212);
|
||||
console.log(filterData);
|
||||
|
||||
@@ -342,9 +321,9 @@ export default {
|
||||
console.log(resultPost);
|
||||
api.updateStemMessage(resultPost).then((res) => {
|
||||
if (res.data.code === 200) {
|
||||
state.ballotId=res.data.data.ballotId
|
||||
console.log("res.data.data==============",res.data.data);
|
||||
console.log("res.state.ballotId==============",state.ballotId);
|
||||
state.ballotId = res.data.data.ballotId
|
||||
console.log("res.data.data==============", res.data.data);
|
||||
console.log("res.state.ballotId==============", state.ballotId);
|
||||
message.success("编辑成功");
|
||||
closeDrawer();
|
||||
}
|
||||
@@ -360,12 +339,12 @@ export default {
|
||||
"assessmentMinScore",
|
||||
]);*/
|
||||
|
||||
console.log("=========",resultPost);
|
||||
console.log("=========", resultPost);
|
||||
api.createStemMessage(resultPost).then((res) => {
|
||||
if (res.data.code === 200) {
|
||||
state.ballotId=res.data.data.ballotId
|
||||
console.log("res.data.data2==============",res.data.data);
|
||||
console.log("res.state.ballotId=2s=============",state.ballotId);
|
||||
state.ballotId = res.data.data.ballotId
|
||||
console.log("res.data.data2==============", res.data.data);
|
||||
console.log("res.state.ballotId=2s=============", state.ballotId);
|
||||
message.success("创建成功");
|
||||
closeDrawer();
|
||||
}
|
||||
@@ -378,24 +357,24 @@ export default {
|
||||
};
|
||||
|
||||
const checkVal = (filterData) => {
|
||||
console.log("filterData.====",filterData);
|
||||
console.log("filterData.voteStemVoList====",filterData.voteStemDtoList);
|
||||
console.log("filterData.====", filterData);
|
||||
console.log("filterData.voteStemVoList====", filterData.voteStemDtoList);
|
||||
|
||||
if(!filterData.voteStemDtoList){
|
||||
message.error("请添加题干");
|
||||
return false;
|
||||
}
|
||||
let arr = filterData.voteStemDtoList;
|
||||
arr.forEach((item) => {
|
||||
console.log("item===",item);
|
||||
console.log("!item.voteStemName===",!item.voteStemName);
|
||||
if (!item.voteStemName) {
|
||||
console.log("item.voteStemName===",item.voteStemName);
|
||||
message.error("题干为必填 请确认",item.voteStemName);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
if (!filterData.voteStemDtoList) {
|
||||
message.error("请添加题干");
|
||||
return false;
|
||||
}
|
||||
let arr = filterData.voteStemDtoList;
|
||||
arr.forEach((item) => {
|
||||
console.log("item===", item);
|
||||
console.log("!item.voteStemName===", !item.voteStemName);
|
||||
if (!item.voteStemName) {
|
||||
console.log("item.voteStemName===", item.voteStemName);
|
||||
message.error("题干为必填 请确认", item.voteStemName);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user