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