部分修改

This commit is contained in:
kclf
2022-12-05 01:26:17 +08:00
parent 3fd9632adc
commit 14568127bf
16 changed files with 2065 additions and 418 deletions

View File

@@ -1,6 +1,5 @@
import http from "./config";
import qs from 'qs';
import qs from "qs";
/**
* 接口传参数方式get
@@ -42,42 +41,49 @@ 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',
}
})
token: "123",
"Content-Type": "multipart/form-data",
},
});
//创建题干信息接口
export const createStemMessage = (obj) => http.post('/vote/createOptionMessage', obj)
export const createStemMessage = (obj) =>
http.post("/vote/createOptionMessage", obj);
//投票信息创建接口
export const createVote = (obj) => http.post('/vote/createVote', obj)
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 = (voteStemId) => http.post(`/vote/deleteVoteStem?voteStemId=${voteStemId}`)
export const deleteVoteStem = (voteStemId) =>
http.post(`/vote/deleteVoteStem?voteStemId=${voteStemId}`);
//删除题选项息接口
export const deleteVoteStemOption = (optionId) => http.post(`/vote/deleteVoteStemOption?optionId=${optionId}`)
export const deleteVoteStemOption = (optionId) =>
http.post(`/vote/deleteVoteStemOption?optionId=${optionId}`);
//修改投票信息接口
export const editVote = (obj) => http.post('/vote/editVote', obj)
export const editVote = (obj) => http.post("/vote/editVote", obj);
//根据题干ID获取题干信息
export const queryStemByStemId = (ballotId) => http.post(`/vote/queryStemByStemId?ballotId=${ballotId}`)
export const queryStemByStemId = (ballotId) =>
http.post(`/vote/queryStemByStemId?ballotId=${ballotId}`);
//修改题干信息接口
export const updateStemMessage = (obj) => http.post('/vote/updateStemMessage', obj);
export const updateStemMessage = (obj) =>
http.post("/vote/updateStemMessage", obj);
//上传组件
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获取投票任务
export const queryVoteDetailById = (voteID) => http.post(`/vote/queryVoteDetailById?voteId=${voteID}`)
export const queryVoteDetailById = (voteID) =>
http.post(`/vote/queryVoteDetailById?voteId=${voteID}`);
// 测试方法
// import * as api from '../../api/index'

View File

@@ -168,8 +168,7 @@ export default {
localStorage.setItem("chapterId", props.isactive);
};
const afterVisibleChange = () => {
};
const afterVisibleChange = () => {};
const showDrawer = () => {
state.visible = true;

View File

@@ -1,49 +1,76 @@
<template>
<a-drawer :visible="addvoteVisible" class="drawerStyle addvoteDrawer" width="80%" title="添加投票" placement="right"
@after-visible-change="afterVisibleChange">
<a-drawer
:visible="addvoteVisible"
class="drawerStyle addvoteDrawer"
width="80%"
title="添加投票"
placement="right"
@after-visible-change="afterVisibleChange"
>
<div class="drawerMain">
<div class="header">
<div v-if="edit" class="headerTitle">编辑投票</div>
<div v-else class="headerTitle">添加投票</div>
<img style="width: 29px; height: 29px; cursor: pointer" src="../../assets/images/basicinfo/close.png"
@click="closeDrawer" />
<div v-if="edit" class="headerTitle">编辑投票任务</div>
<div v-else class="headerTitle">添加投票任务</div>
<img
style="width: 29px; height: 29px; cursor: pointer"
src="../../assets/images/basicinfo/close.png"
@click="closeDrawer"
/>
</div>
<div class="contentMain">
<div class="main_left">
<div class="main_item">
<div class="signbox">
<div class="sign">
<img src="@/assets/images/coursewareManage/asterisk.png" alt="" />
<img
src="@/assets/images/coursewareManage/asterisk.png"
alt=""
/>
</div>
<span style="margin-right: 3px">任务名称</span>
</div>
<div class="btnbox">
<a-input v-model:value="inputV1" style="width: 424px; height: 32px" placeholder="请输入投票名称"
maxlength="20" />
<a-input
v-model:value="inputV1"
style="width: 424px; height: 32px"
placeholder="请输入投票名称"
maxlength="20"
/>
</div>
</div>
<div class="main_item">
<div class="signbox">
<div class="sign">
<img src="@/assets/images/coursewareManage/asterisk.png" alt="" />
<img
src="@/assets/images/coursewareManage/asterisk.png"
alt=""
/>
</div>
<span>创建投票</span>
</div>
<div class="btnbox">
<button class="xkbtn" @click="showDrawerCreVote">
{{ ballotId ? "编辑" : "添加" }}投票
{{ ballotId ? "编辑" : "创建" }}投票
</button>
<div v-if="ballotId > 0">
<a-tag closable color="processing" @close="log">
<span style="font-size:14px;line-height: 33px;">删除投票</span>
<span style="font-size: 14px; line-height: 33px">
删除投票
</span>
</a-tag>
</div>
<div>
<CreateVote v-model:createVoteVisible="createVoteVisible" v-model:ballotId="ballotId"
v-model:editChild="editChild" />
<CreateVote
v-model:createVoteVisible="createVoteVisible"
v-model:ballotId="ballotId"
v-model:editChild="editChild"
/>
</div>
<button class="xkbtn" :style="{ display: creVote ? 'block' : 'none' }" @click="showDrawerCreVote">
<button
class="xkbtn"
:style="{ display: creVote ? 'block' : 'none' }"
@click="showDrawerCreVote"
>
编辑投票
</button>
<div :style="{ display: creVote ? 'block' : 'none' }">
@@ -56,7 +83,11 @@
<!-- 创建投票侧弹窗 -->
<div>
<create-vote v-model:crevoteVisible="crevotevisible" @getData="getStemId" v-model:ballotId="ballotId" />
<create-vote
v-model:crevoteVisible="crevotevisible"
@getData="getStemId"
v-model:ballotId="ballotId"
/>
</div>
<!-- 创建投票侧弹窗 -->
</div>
@@ -65,7 +96,11 @@
<span style="margin-right: 3px">起止时间</span>
</div>
<div class="btnbox">
<a-range-picker style="width: 424px" v-model:value="time" :placeholder="[' 开始时间', ' 结束时间']" />
<a-range-picker
style="width: 424px"
v-model:value="time"
:placeholder="[' 开始时间', ' 结束时间']"
/>
</div>
</div>
<div class="main_item">
@@ -73,12 +108,23 @@
<span style="margin-right: 3px">基础投票数</span>
</div>
<div class="btnbox">
<a-upload @change="handleChange" :before-upload="beforeUpload" :multiple="true" :max-count="1"
action="/manageApi/vote/baseVoteupload" v-model:file-list="fileList">
<button class="xkbtn">点击上传</button></a-upload>
<div v-if="voteCount > 0"><a-tag color="processing"> <span style="font-size:14px;line-height: 33px;">{{
voteCount
}}</span></a-tag></div>
<a-upload
@change="handleChange"
:before-upload="beforeUpload"
:multiple="true"
:max-count="1"
action="/manageApi/vote/baseVoteupload"
v-model:file-list="fileList"
>
<button class="xkbtn">点击上传</button></a-upload
>
<div v-if="voteCount > 0">
<a-tag color="processing">
<span style="font-size: 14px; line-height: 33px">
{{ voteCount }}
</span>
</a-tag>
</div>
</div>
</div>
<div class="main_item" style="margin-top: -25px">
@@ -92,7 +138,12 @@
<span style="margin-right: 3px">投票说明</span>
</div>
<div class="textarea">
<a-textarea v-model:value="textV1" placeholder="请输入投票说明" allow-clear maxlength="150" />
<a-textarea
v-model:value="textV1"
placeholder="请输入投票说明"
allow-clear
maxlength="150"
/>
</div>
</div>
</div>
@@ -117,8 +168,7 @@ import { addTempTask } from "../../api/indexTaskadd";
export default {
name: "AddVote",
components: {
CreateVote
CreateVote,
},
props: {
addvoteVisible: {
@@ -145,11 +195,13 @@ export default {
type: Number,
default: 0,
},
isLevel: { // 是否是关卡页面触发
isLevel: {
// 是否是关卡页面触发
type: Number,
default: null,
},
projectTaskId: { // 要编辑的projectId
projectTaskId: {
// 要编辑的projectId
type: Number,
default: null,
},
@@ -164,9 +216,7 @@ export default {
projectTemplateId: {
type: Number,
default: null,
}
},
},
setup(props, ctx) {
const state = reactive({
@@ -190,14 +240,13 @@ export default {
fileList: [],
voteCount: null,
projectTemplateId: null,
});
const closeDrawer = () => {
state.inputV1 = "",
state.textV1 = "",
state.time = undefined,
state.basevote = "",
state.ballotId = "",
(state.inputV1 = ""),
(state.textV1 = ""),
(state.time = undefined),
(state.basevote = ""),
(state.ballotId = ""),
ctx.emit("update:addvoteVisible", false);
ctx.emit("update:edit", false);
};
@@ -207,38 +256,33 @@ export default {
}
state.projectTemplateId = props.projectTemplateId;
console.log("projectTemplateId visible====", state.projectTemplateId);
};
const showDrawerCreVote = () => {
state.createVoteVisible = true;
state.editChild = props.edit;
};
// 限制文件格式上传
const beforeUpload = (obj) => {
console.log(obj)
}
console.log(obj);
};
const handleChange = info => {
console.log(info.file.type, info.file.type.indexOf('sheet'))
if (info.file.type.indexOf('sheet') == -1) {
message.destroy()
message.error("请上传正确的文件格式")
const handleChange = (info) => {
console.log(info.file.type, info.file.type.indexOf("sheet"));
if (info.file.type.indexOf("sheet") == -1) {
message.destroy();
message.error("请上传正确的文件格式");
console.log(state.fileList)
console.log(state.fileList);
state.fileList = []
return
state.fileList = [];
return;
}
let resFileList = [...info.fileList];
resFileList.map(file => {
resFileList.map((file) => {
if (file.response) {
// Component will show file.url as link
file.url = file.response.url;
@@ -246,26 +290,23 @@ export default {
console.log("file========", file.response);
state.voteCount = file.response.data;
}
});
//fileList.value = resFileList;
};
//删除题干信息接口
const dleVoteStem = () => {
api.deleteVoteStem({ voteStemId: state.ballotId })
.then(() => {
message.success('删除题干信息成功')
})
}
api.deleteVoteStem({ voteStemId: state.ballotId }).then(() => {
message.success("删除题干信息成功");
});
};
//根据投票id获取投票信息
const queryVoteInfo = () => {
api.queryVoteDetailById(props.EditVoteId)
api
.queryVoteDetailById(props.EditVoteId)
.then((res) => {
console.log('获取投票信息成功', res);
console.log("获取投票信息成功", res);
state.inputV1 = res.data.data.voteName;
state.textV1 = res.data.data.voteExplain;
state.baseVote = res.data.data.baseVote;
@@ -277,11 +318,9 @@ export default {
];
})
.catch((err) => {
console.log('获取投票信息失败', err);
console.log("获取投票信息失败", err);
});
}
};
const updateToTask = (res) => {
console.log("props.isLevel=====", props.isLevel);
if (props.isLevel == 1) {
@@ -319,7 +358,6 @@ export default {
////message.error(`${props.edit ? '编辑' : '新增'}阶段任务失败`)
});
} else if (props.isLevel == 3) {
addTempTask({
courseId: res.data.data.voteId,
name: res.data.data.voteName,
@@ -336,7 +374,7 @@ export default {
//message.error(`${props.edit ? "编辑" : "新增"}阶段任务失败`);
});
}
}
};
//修改投票信息接口
const updateVoteInfo = () => {
if (!state.inputV1) {
@@ -364,8 +402,7 @@ export default {
ballotId: state.ballotId,
baseVote: state.basevote,
voteExplain: state.textV1,
}
};
if (props.edit) {
api
.editVote(obj)
@@ -374,12 +411,12 @@ export default {
await updateToTask(res);
closeDrawer();
message.destroy();
message.success("修改投票信息成功")
message.success("修改投票信息成功");
})
.catch(() => {
message.destroy();
message.error("修改投票信息失败")
})
message.error("修改投票信息失败");
});
} else {
api
.createVote(obj)
@@ -387,22 +424,21 @@ export default {
await updateToTask(res);
closeDrawer();
message.destroy();
message.success("创建投票信息成功")
message.success("创建投票信息成功");
})
.catch(() => {
message.destroy();
message.error("创建投票信息失败")
})
}
message.error("创建投票信息失败");
});
}
};
const queryStem = () => {
state.addStemVisible = true;
};
const closeStem = () => {
state.addStemVisible = false;
};
const log = e => {
const log = (e) => {
state.ballotId = null;
console.log(e);
};
@@ -450,8 +486,10 @@ export default {
position: absolute;
width: calc(100%);
height: 40px;
background: linear-gradient(rgba(78, 166, 255, 0.2) 0%,
rgba(78, 166, 255, 0) 100%);
background: linear-gradient(
rgba(78, 166, 255, 0.2) 0%,
rgba(78, 166, 255, 0) 100%
);
}
.del_main {

View File

@@ -0,0 +1,626 @@
<!-- 评估管理-创建评估页面 -->
<template>
<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"
/>
</div>
<div class="main_left">
<div class="main_item">
<div class="signbox">
<div class="sign">
<img src="@/assets/images/coursewareManage/asterisk.png" alt="" />
</div>
<span style="margin-right: 3px">投票名称</span>
</div>
<div class="btnbox">
<a-input
v-model:value="ballotName"
style="width: 424px; height: 32px"
placeholder="请输入任务名称"
maxlength="20"
/>
</div>
</div>
<div class="main_item">
<div class="signbox">
<div class="sign">
<img src="@/assets/images/coursewareManage/asterisk.png" alt="" />
</div>
<span>创建题干</span>
</div>
<div class="btnbox">
<button class="xkbtn" @click="handleTypes">添加题干</button>
</div>
</div>
<!-- 创建投票侧弹窗 -->
</div>
<div v-for="(item, index) in allFormsData" :key="index">
<VoteQuestion
v-model:info="information"
:item="item"
:optionId="optionId"
@delOption="delOption"
@del="handleDel"
@edits="edits"
@addOption="addOption"
/>
</div>
<div class="footer">
<div class="btn">
<a-button
type="primary"
style="
width: 100px;
height: 40px;
border-radius: 8px;
background-color: #409eff;
"
@click="handleSave"
>
保存
</a-button>
<a-button
type="primary"
ghost
style="
width: 100px;
height: 40px;
margin-left: 14px;
border-radius: 8px;
"
@click="handleAllCancel"
>
取消
</a-button>
</div>
</div>
</div>
</a-drawer>
</template>
<script>
import { reactive, toRefs } from "vue";
import { message } from "ant-design-vue";
// import { createResearch } from "../../api/indexResearch";
import VoteQuestion from "./VoteQuestion.vue";
import {
// sortBy,
traverseArr,
//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 { message } from "ant-design-vue";
export default {
name: "CreateVote",
components: {
VoteQuestion,
},
props: {
createVoteVisible: {
type: Boolean,
default: false,
},
ballotId: {
type: Number,
default: null,
},
editChild: {
type: Boolean,
default: false,
},
},
setup(props, ctx) {
const state = reactive({
ballotId: "",
ballotName: "",
allFormsData: [],
allFormsData1: [],
});
// const router = useRouter();
const afterVisibleChange = () => {
if (props.ballotId) {
getInfoDate();
} else {
handleTypes();
}
};
const closeDrawer = () => {
ctx.emit("update:createVoteVisible", false);
ctx.emit("update:ballotId", state.ballotId);
handleAllCancel();
};
// 详情
const getInfoDate = async () => {
console.log("props.editChild=====", props.editChild);
if (props.ballotId) {
console.log("props.editChild2=====", props.editChild);
let res = await api.queryStemByStemId(props.ballotId).then((res) => {
if (res.data.code === 200) {
return res.data.data;
}
});
console.log("res====", res);
state.ballotName = res.ballotId;
// let renderArr = [...res];
// sortBy(renderArr, "orderNumber"); //序号
state.allFormsData = parseData(res); //类型
state.allFormsData1 = parseData(res); //类型
console.log(state.allFormsData);
}
};
// 转换成前端格式
const parseData = (arr) => {
const resultArr = [];
state.ballotId = arr.ballotId;
state.ballotName = arr.ballotName;
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",
}).map((itm, idx) => {
itm.id = idx + 1;
return itm;
});
obj = {
voteStemId: item.voteStemId,
valueSingle: item.voteStemName,
singleList: restList,
};
resultArr.push(obj);
});
resultArr.map((itm, idx) => {
itm.id = idx + 1;
return itm;
});
return resultArr;
};
// 转换成后端格式
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",
}).map((itm, idx) => {
itm.optionOrderNum = idx + 1;
return itm;
});
restList.forEach((item) => {
item.optionId = item.optionId ? item.optionId : "";
});
obj = {
voteStemName: item.valueSingle,
optionDetailList: restList,
voteStemId: item.voteStemId,
};
resultArr.push(obj);
// }
console.log("resultArr=======", 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,
});
});
}
});*/
resultObj.voteStemDtoList = arrr;
// }
console.log("resultObj======", resultObj);
// }
return resultObj;
};
const handleTypes = () => {
let obj = {
id: state.allFormsData.length,
valueSingle: "",
singleList: [
{
id: 1,
inputVal: "",
imgVal: "",
},
{
id: 2,
inputVal: "",
imgVal: "",
},
],
};
state.allFormsData.push(obj);
state.allFormsData1.push(obj);
};
const handleDel = ({ id }) => {
console.log("1234523432434234234", id, state.allFormsData);
state.allFormsData.forEach((item, index) => {
if (item.id === id) {
console.log("oooooo", item);
state.allFormsData.splice(index, 1);
}
});
// state.allFormsData.map((item, index) => {
// item.id = index + 1;
// return item;
// });
// orderNumber: curItem.orderNumber,
};
const delOption = (data) => {
console.log("datadatadatadatadata", data, state.allFormsData);
state.allFormsData.forEach((item, index) => {
if (item.voteStemId === data.value.voteStemId) {
state.allFormsData[index].singleList.forEach((ii, nn) => {
if (ii.id == data.value.id) {
console.log(
1212121212,
state.allFormsData[index].singleList[nn],
nn
);
state.allFormsData[index].singleList.splice(nn, 1);
console.log("12", state.allFormsData);
}
});
}
});
state.allFormsData1.forEach((item, index) => {
if (item.voteStemId === data.value.voteStemId) {
state.allFormsData1[index].singleList.forEach((ii, nn) => {
if (ii.id == data.value.id) {
console.log(
1212121212,
state.allFormsData1[index].singleList[nn],
nn
);
state.allFormsData1[index].singleList.splice(nn, 1);
console.log("33", state.allFormsData1);
}
});
}
});
};
const edits = (data) => {
console.log(
"我传递过来了吗---111",
data,
data.value.id,
state.allFormsData1
);
state.allFormsData1.forEach((item, index) => {
if (item.voteStemId === data.value.voteStemId) {
item.singleList.forEach((ii, nn) => {
if (ii.id === data.value.id) {
// ii.optionName = data.value.inputVal
state.allFormsData1[index].singleList[nn].inputVal =
data.value.inputVal;
}
});
}
});
console.log("123-456-789", state.allFormsData1);
};
// 增加选项
const addOption = (data) => {
console.log(data);
state.allFormsData1.forEach((item, index) => {
if (item.voteStemId === data.value.voteStemId) {
state.allFormsData1[index].singleList = data.value.singleList;
}
});
};
const handleSave = () => {
let resultPost = {};
let filterData = parseItem(restData(state.allFormsData1, "type"));
console.log("filterData==111", filterData);
if (!state.ballotName) {
return message.warning("请输入投票名称");
}
// 校验s
// 校验
if (!checkVal(filterData)) {
return false;
}
// checkVal(filterData);
console.log(12121212);
console.log(filterData);
console.log("111111222223333----0000", state.ballotId);
if (state.ballotId) {
resultPost = {
ballotId: state.ballotId,
ballotName: state.ballotName,
...filterData,
};
/*
resultPost = deepCloneFilterString(resultPost, [
"assessmentMaxScore",
"assessmentMinScore",
]);*/
console.log(1212334);
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);
message.success("编辑成功");
closeDrawer();
}
});
} else {
resultPost = {
ballotName: state.ballotName,
...filterData,
};
/*
resultPost = deepCloneFilterString(resultPost, [
"assessmentMaxScore",
"assessmentMinScore",
]);*/
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);
message.success("创建成功");
closeDrawer();
}
});
}
};
const handleAllCancel = () => {
state.allFormsData = [];
};
const checkVal = (filterData) => {
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;
};
return {
...toRefs(state),
handleTypes,
handleSave,
handleAllCancel,
handleDel,
afterVisibleChange,
closeDrawer,
edits,
delOption,
addOption,
};
},
};
</script>
<style lang="scss">
.researchadd {
.header {
height: 73px;
border-bottom: 1px solid #e8e8e8;
display: flex;
justify-content: space-between;
align-items: center;
flex-shrink: 0;
margin-bottom: 25px;
.headerTitle {
font-size: 18px;
font-weight: 600;
color: #333333;
line-height: 25px;
margin-left: 24px;
}
}
.main_left {
margin-left: 50px;
padding-right: 30px;
flex: 1;
border-right: 1px solid #e8e8e8;
.main_item {
display: flex;
align-items: center;
margin-bottom: 32px;
.signbox {
width: 120px;
display: flex;
justify-content: end;
align-items: center;
.sign {
margin-right: 5px;
}
}
.btnbox {
display: flex;
flex: 1;
align-items: center;
.xkbtn {
cursor: pointer;
width: 130px;
height: 40px;
background: #388be1;
border-radius: 8px;
border: 0;
margin-right: 8px;
color: #fff;
margin-right: 10px;
}
.fileTigan {
display: flex;
align-items: center;
padding: 3px 5px;
background-color: rgba(42, 103, 209, 0.4);
span {
margin-right: 5px;
}
.delBox {
width: 13px;
height: 13px;
background-image: url(@/assets/images/basicinfo/ch.png);
background-size: 100% 100%;
border-radius: 50%;
}
}
}
}
.main_item2 {
display: flex;
align-items: flex-start;
margin-bottom: 32px;
.signbox {
width: 120px;
display: flex;
justify-content: end;
align-items: center;
.sign {
margin-right: 5px;
}
}
.kqszbox {
.qdqtbox {
margin-left: 56px;
}
.setbox {
display: flex;
flex-wrap: wrap;
margin-top: 10px;
margin-bottom: 24px;
.timerbox {
margin-top: 6px;
margin-right: 32px;
display: flex;
align-items: center;
flex-wrap: nowrap;
}
}
}
.btnbox2 {
display: flex;
flex-direction: column;
justify-content: flex-start;
.xkbtn {
cursor: pointer;
width: 130px;
height: 40px;
background: #388be1;
border-radius: 8px;
border: 0;
margin-right: 16px 8px 32px 0;
color: #fff;
margin-top: 16px;
margin-bottom: 60px;
}
}
}
}
}
</style>

View File

@@ -1,12 +1,20 @@
<!-- 评估管理-创建评估页面 -->
<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" />
<div class="headerTitle">{{ ballotId ? "编辑投票" : "创建投票" }}</div>
<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">
@@ -17,8 +25,12 @@
<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">
@@ -36,26 +48,34 @@
</div>
<div v-for="(item, index) in allFormsData" :key="index">
<VoteQuestion v-model:info="information" :item="item" :optionId="optionId" @delOption="delOption"
@del="handleDel" @edits="edits" @addOption="addOption" />
<VoteQuestion :item="item" @del="handleDel" />
</div>
<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>
@@ -70,7 +90,7 @@ import { message } from "ant-design-vue";
import VoteQuestion from "./VoteQuestion.vue";
import {
// sortBy,
sortBy,
traverseArr,
//filterCommon,
// deepCloneFilterString,
@@ -107,8 +127,6 @@ export default {
ballotId: "",
ballotName: "",
allFormsData: [],
allFormsData1: [],
});
// const router = useRouter();
const afterVisibleChange = () => {
@@ -116,9 +134,7 @@ export default {
getInfoDate();
} else {
handleTypes();
}
};
const closeDrawer = () => {
ctx.emit("update:createVoteVisible", false);
@@ -130,49 +146,39 @@ export default {
console.log("props.editChild=====", props.editChild);
if (props.ballotId) {
console.log("props.editChild2=====", props.editChild);
let res = await api
.queryStemByStemId(props.ballotId)
.then((res) => {
let res = await api.queryStemByStemId(props.ballotId).then((res) => {
if (res.data.code === 200) {
return res.data.data;
}
});
console.log("res====", res);
state.ballotName = res.ballotId;
// let renderArr = [...res];
// sortBy(renderArr, "orderNumber"); //序号
state.allFormsData = parseData(res); //类型
state.allFormsData1 = parseData(res); //类型
console.log(state.allFormsData);
state.ballotId = res.ballotId;
state.ballotName = res.ballotName;
let renderArr = [...res.voteStemVoList];
sortBy(renderArr, "orderNumber"); //序号
state.allFormsData = parseData(renderArr);
}
};
// 转换成前端格式
const parseData = (arr) => {
const resultArr = [];
state.ballotId = arr.ballotId;
state.ballotName = arr.ballotName;
console.log("arr.voteStemVoList=====", arr.voteStemVoList);
arr.voteStemVoList.forEach((item) => {
console.log("arr.voteStemVoList=====", arr);
arr.forEach((item) => {
let obj = {};
let restList = traverseArr(item.optionDetailList, {
inputVal: "optionName",
imgVal: "optionPictureAddress",
optionId: "optionId",
voteStemId: "voteStemId",
stem: "stem",
}).map((itm, idx) => {
itm.id = idx + 1;
return itm;
});
obj = {
voteStemId: item.voteStemId,
valueSingle: item.voteStemName,
singleList: restList,
orderNumber: item.orderNumber,
};
resultArr.push(obj);
});
@@ -189,34 +195,25 @@ export default {
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",
}).map((itm, idx) => {
itm.optionOrderNum = idx + 1;
return itm;
});
restList.forEach((item) => {
item.optionId = item.optionId
? item.optionId
: "";
item.optionId = item.optionId ? item.optionId : "";
});
obj = {
voteStemName: item.valueSingle,
optionDetailList: restList,
voteStemId: item.voteStemId,
singleList: restList,
orderNumber: item.orderNumber,
};
resultArr.push(obj);
// }
console.log("resultArr=======", resultArr);
});
resultArr.map((itm, idx) => {
itm.orderNumber = idx + 1;
@@ -226,40 +223,26 @@ export default {
};
// 解散传值
const parseItem = (arrr) => {
// const filterComObj = filterCommon(arr, "questionType");
const parseItem = (arrSingle) => {
console.log("arrSingle");
console.log(arrSingle);
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,
voteStemName: item.voteStemName,
orderNumber: item.orderNumber,
optionDetailList: item.singleList,
});
});
}
});*/
resultObj.voteStemDtoList = arrr;
// }
resultObj.voteStemDtoList = arr;
console.log("resultObj======", resultObj);
// }
return resultObj;
};
const handleTypes = () => {
let obj = {
id: state.allFormsData.length,
id: state.allFormsData.length + 1,
valueSingle: "",
singleList: [
{
@@ -275,107 +258,49 @@ export default {
],
};
state.allFormsData.push(obj);
state.allFormsData1.push(obj);
};
const handleDel = ({ id }) => {
console.log('1234523432434234234', id, state.allFormsData)
const handleDel = ({ id, curItem }) => {
console.log(888888888);
console.log(id);
console.log(curItem);
state.allFormsData.forEach((item, index) => {
if (item.id === id) {
console.log('oooooo', item)
state.allFormsData.splice(index, 1);
}
});
console.log(5656777777777);
console.log(state.allFormsData);
state.allFormsData.map((item, index) => {
item.id = index + 1;
return item;
});
// state.allFormsData.map((item, index) => {
// item.id = index + 1;
// return item;
// });
// orderNumber: curItem.orderNumber,
api.deleteVoteStem(curItem.voteStemId).then((res) => {
console.log(56444);
console.log(res);
});
};
const delOption = (data) => {
console.log('datadatadatadatadata', data, state.allFormsData)
state.allFormsData.forEach((item, index) => {
if (item.voteStemId === data.value.voteStemId) {
state.allFormsData[index].singleList.forEach((ii, nn) => {
if (ii.id == data.value.id) {
console.log(1212121212, state.allFormsData[index].singleList[nn], nn)
state.allFormsData[index].singleList.splice(nn, 1)
console.log('12', state.allFormsData)
}
})
}
});
state.allFormsData1.forEach((item, index) => {
if (item.voteStemId === data.value.voteStemId) {
state.allFormsData1[index].singleList.forEach((ii, nn) => {
if (ii.id == data.value.id) {
console.log(1212121212, state.allFormsData1[index].singleList[nn], nn)
state.allFormsData1[index].singleList.splice(nn, 1)
console.log('33', state.allFormsData1)
}
})
}
});
}
const edits = (data) => {
console.log('我传递过来了吗---111', data, data.value.id, state.allFormsData1)
state.allFormsData1.forEach((item, index) => {
if (item.voteStemId === data.value.voteStemId) {
item.singleList.forEach((ii, nn) => {
if (ii.id === data.value.id) {
// ii.optionName = data.value.inputVal
state.allFormsData1[index].singleList[nn].inputVal = data.value.inputVal
}
})
}
});
console.log('123-456-789', state.allFormsData1)
}
// 增加选项
const addOption = (data) => {
console.log(data)
state.allFormsData1.forEach((item, index) => {
if (item.voteStemId === data.value.voteStemId) {
state.allFormsData1[index].singleList = data.value.singleList
}
});
}
const handleSave = () => {
let resultPost = {};
let filterData = parseItem(restData(state.allFormsData));
let filterData = parseItem(restData(state.allFormsData1, "type"));
console.log("filterData==111", filterData)
if (!state.ballotName) {
return message.warning("请输入投票名称");
}
// 校验s
console.log("filterData==111", filterData);
// 校验
if (!state.ballotName) {
message.warning("请输入投票名称");
return false;
}
if (!checkVal(filterData)) {
return false;
}
// checkVal(filterData);
console.log(12121212);
console.log(filterData);
console.log('111111222223333----0000', state.ballotId)
console.log("111111222223333----0000", state.ballotId);
if (state.ballotId) {
resultPost = {
ballotId: state.ballotId,
@@ -391,7 +316,7 @@ export default {
console.log(resultPost);
api.updateStemMessage(resultPost).then((res) => {
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.state.ballotId==============", state.ballotId);
message.success("编辑成功");
@@ -408,11 +333,10 @@ export default {
"assessmentMaxScore",
"assessmentMinScore",
]);*/
console.log("=========", resultPost);
api.createStemMessage(resultPost).then((res) => {
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.state.ballotId=2s=============", state.ballotId);
message.success("创建成功");
@@ -420,7 +344,6 @@ export default {
}
});
}
};
const handleAllCancel = () => {
state.allFormsData = [];
@@ -447,7 +370,6 @@ export default {
return true;
};
return {
...toRefs(state),
handleTypes,
@@ -456,9 +378,6 @@ export default {
handleDel,
afterVisibleChange,
closeDrawer,
edits,
delOption,
addOption
};
},
};

View File

@@ -0,0 +1,522 @@
<!-- 评估管理-创建评估页面 -->
<template>
<!-- 单选题 -->
<div class="content">
<div class="tagbox">
<div class="deleteop" @click="handleTypesDel">
<div><img src="../../assets/images/projectadd/delete.png" /></div>
<div class="del_text">删除选项</div>
</div>
</div>
<div class="name">
<div class="namebox">
<img class="nameimg" src="../../assets/images/basicinfo/asterisk.png" />
<div class="inname">题干{{ item.id + 1 }}</div>
</div>
<div class="in">
<a-input
v-model:value="curItem.valueSingle"
placeholder="请输入题干名称"
show-count
:maxlength="20"
style="border-radius: 8px"
/>
</div>
</div>
<VoteQuestionItem
v-model:info="info"
v-for="(item, index) in curItem.singleList"
:key="index"
:item="item"
@input="input"
@src="imgSrc"
@delImg="delImg"
@del="del"
@edit="edit"
/>
<div class="name">
<div class="in" style="margin-left: 85px; margin-bottom: 20px">
<a-button
type="primary"
style="
width: 100px;
height: 40px;
border-radius: 8px;
background-color: #409eff;
"
@click="handleSingleAdd"
>
添加选项
</a-button>
</div>
</div>
</div>
</template>
<script>
import VoteQuestionItem from "./VoteQuestionItem.vue";
import { ref } from "vue";
import * as api from "../../api/indexVote";
export default {
name: "CreateVote",
components: {
VoteQuestionItem,
},
props: {
num: {
type: Number,
default: null,
},
item: {
type: Object,
default: () => {
return {};
},
},
},
setup(props, { emit }) {
const curItem = ref(props.item);
const handleTypesDel = () => {
console.log("删除题干======", {
id: curItem.value.id,
curItem: curItem.value,
});
api.deleteVoteStem(curItem.value.voteStemId).then(() => {
// message.success('删除题干信息成功')
emit("del", { id: curItem.value.id, curItem: curItem.value });
});
};
const handleSingleAdd = () => {
curItem.value.singleList.push({
id: curItem.value.singleList.length + 1,
inputVal: "",
imgVal: "",
});
emit("addOption", curItem);
};
const input = ({ id, val }) => {
console.log(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) {
item.imgVal = src;
}
});
};
const delImg = ({ id }) => {
curItem.value.singleList.forEach((item) => {
if (item.id === id) {
item.imgVal = "";
}
});
};
const del = ({ id, data }) => {
console.log(data);
api.deleteVoteStemOption(data.value.optionId).then(() => {
// message.success('删除题干信息成功')
emit("delOption", data);
});
curItem.value.singleList.forEach((item, index) => {
if (item.id === id) {
curItem.value.singleList.splice(index, 1);
}
});
};
const edit = (data) => {
// console.log('111111-223', data.value)
emit("edits", data);
};
return {
curItem,
handleTypesDel,
handleSingleAdd,
input,
imgSrc,
delImg,
del,
edit,
};
},
};
</script>
<style lang="scss">
.researchadd {
width: 100%;
display: flex;
flex-direction: column;
.header {
width: 100%;
display: flex;
justify-content: space-between;
.title {
color: #000000;
font-size: 18px;
//line-height: 36px;
padding-top: 30px;
padding-left: 37px;
//font-weight: 500;
}
.goback {
padding-right: 70px;
//padding-top: 37px;
position: relative;
.return {
display: inline-block;
width: 42px;
height: 42px;
margin-top: 17px;
margin-right: 10px;
background-image: url("../../assets/images/projectadd/return.png");
}
.returntext {
display: inline-block;
position: absolute;
top: 27px;
color: #4ea6ff;
font-size: 14px;
}
}
}
.addtype {
display: flex;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
margin-right: 20px;
align-items: center;
margin-left: 41px;
.addtypen {
color: #6f6f6f;
font-size: 14px;
}
.types {
cursor: pointer;
width: 80px;
height: 40px;
color: #409eff;
border: 1px solid #409eff;
border-radius: 4px;
display: flex;
justify-content: center;
align-items: center;
margin: 20px 10px;
}
.typesCur {
color: #fff;
background: #409eff;
}
}
.content {
display: flex;
flex-direction: column;
border: 1px solid rgba(0, 0, 0, 0.1);
width: 70%;
min-width: 690px;
margin-left: 38px;
margin-top: 20px;
.tagbox {
display: flex;
justify-content: right;
.tagname {
width: 90px;
height: 32px;
margin-top: 24px;
display: flex;
justify-content: center;
align-items: center;
margin-left: 134px;
background: rgba(78, 166, 255, 0.1);
border-radius: 4px;
color: rgba(64, 158, 255, 1);
font-size: 16px;
}
.deleteop {
display: flex;
justify-content: center;
align-items: center;
width: 100px;
height: 40px;
margin-top: 20px;
margin-right: 30px;
border: 1px solid #409eff;
border-radius: 8px;
cursor: pointer;
.del_text {
color: #409eff;
font-size: 14px;
margin-left: 5px;
}
}
}
.scorebox {
display: flex;
align-items: center;
margin-top: 20px;
margin-left: 70px;
.scoretext {
font-size: 14px;
color: #56a3f9;
}
.number {
display: flex;
border: 1px solid #d7e5fd;
border-radius: 5px;
margin: 0 10px;
padding: 5px;
.btn {
width: 40px;
height: 40px;
border: 1px solid #56a3f9;
border-radius: 8px;
display: flex;
justify-content: center;
align-items: center;
margin: 5px;
font-size: 14px;
font-weight: 400;
color: #56a3f9;
line-height: 24px;
cursor: pointer;
}
.curBtn {
background: #56a3f9;
color: #fff;
}
}
}
.picture {
width: 100px;
display: flex;
flex-direction: column;
margin-top: 20px;
margin-left: 133px;
.pictureimg {
width: 100px;
height: 100px;
}
.picturename {
color: #6f6f6f;
font-size: 14px;
}
}
.options {
display: flex;
}
.delete {
cursor: pointer;
margin-top: 32px;
margin-left: 107px;
// float: right;
color: #4ea6ff;
font-size: 14px;
}
.name2 {
display: flex;
align-items: flex-start;
}
.name {
width: 60%;
// background-color: lightcoral;
display: flex;
margin-top: 20px;
//align-items: center;
//height: 40px;
// border: 1px solid black;
.namebox {
width: 120px;
display: flex;
align-items: center;
justify-content: flex-end;
flex-shrink: 0;
.nameimg {
width: 10px;
height: 10px;
}
}
.inname {
color: #6f6f6f;
font-size: 14px;
margin-left: 7px;
font-weight: 700;
}
.in {
margin-left: 14px;
flex: 1;
.assess {
display: flex;
width: 226px;
height: 40px;
border: 1px solid #56a3f9;
//margin-bottom: 20px;
.assesstype {
width: 50%;
background: #56a3f9;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
}
.assesswhole {
width: 50%;
background: rgba(86, 163, 249, 0.1);
font-size: 14px;
color: #6f6f6f;
display: flex;
justify-content: center;
align-items: center;
}
.ratio {
position: absolute;
right: 10px;
top: 8px;
color: #6f6f6f;
font-size: 14px;
}
}
.addimg {
cursor: pointer;
color: rgba(78, 166, 255, 1);
font-size: 14px;
}
.text {
color: rgba(109, 117, 132, 1);
font-size: 14px;
//line-height: 24px;
}
.ant-radio-wrapper {
}
.ant-input {
border-radius: 5px;
// height: 120%;
width: 100%;
height: 35px;
}
.ant-select-selector {
border-radius: 5px;
// height: 120%;
width: 100%;
height: 40px;
}
}
.numberInp {
width: 200px;
.ant-input-number {
width: 200px;
height: 40px;
border-radius: 8px;
}
// .ant-input-number-input-wrap {
// width: 200px;
// }
}
}
}
.name2 {
display: flex;
align-items: flex-start;
}
.opinion {
display: flex;
margin-top: 30px;
.namebox {
width: 120px;
display: flex;
align-items: center;
justify-content: flex-end;
flex-shrink: 0;
}
.in {
margin-left: 14px;
width: 500px;
.ant-input-textarea-show-count {
position: relative;
height: 110px;
}
.ant-input-textarea-show-count::after {
position: absolute;
right: 10px;
bottom: 0px;
}
.ant-input {
border-radius: 8px;
}
}
}
.footer {
width: 100%;
margin-top: 31px;
margin-bottom: 14px;
.btn {
display: flex;
margin-bottom: 20px;
justify-content: center;
cursor: pointer;
}
}
.uploadContent {
display: block !important;
.uploadBtn {
margin-left: 120px !important;
}
}
}
</style>

View File

@@ -14,16 +14,37 @@
<div class="inname">题干{{ item.id }}</div>
</div>
<div class="in">
<a-input v-model:value="curItem.valueSingle" placeholder="请输入题干名称" show-count :maxlength="20"
style="border-radius: 8px" />
<a-input
v-model:value="curItem.valueSingle"
placeholder="请输入题干名称"
show-count
:maxlength="20"
style="border-radius: 8px"
/>
</div>
</div>
<VoteQuestionItem v-model:info="info" v-for="(item, index) in curItem.singleList" :key="index" :item="item"
@input="input" @src="imgSrc" @delImg="delImg" @del="del" @edit="edit" />
<VoteQuestionItem
v-model:info="info"
v-for="(item, index) in curItem.singleList"
:key="index"
:item="item"
@input="input"
@src="imgSrc"
@delImg="delImg"
@del="del"
/>
<div class="name">
<div class="in" style="margin-left: 85px; margin-bottom: 20px">
<a-button type="primary" style="width: 100px;height: 40px;border-radius: 8px;background-color: #409eff;"
@click="handleSingleAdd">
<a-button
type="primary"
style="
width: 100px;
height: 40px;
border-radius: 8px;
background-color: #409eff;
"
@click="handleSingleAdd"
>
添加选项
</a-button>
</div>
@@ -31,41 +52,28 @@
</div>
</template>
<script>
import VoteQuestionItem from "./VoteQuestionItem.vue";
import { ref } from "vue";
import VoteQuestionItem from "./VoteQuestionItem.vue";
import * as api from "../../api/indexVote";
export default {
name: "CreateVote",
components: {
VoteQuestionItem,
},
props: {
num: {
type: Number,
default: null,
},
item: {
type: Object,
default: () => {
return {};
},
},
},
setup(props, { emit }) {
const curItem = ref(props.item);
const handleTypesDel = () => {
console.log("删除题干======", { id: curItem.value.id, curItem: curItem.value });
api.deleteVoteStem(curItem.value.voteStemId)
.then(() => {
// message.success('删除题干信息成功')
emit("del", { id: curItem.value.id, curItem: curItem.value });
})
};
const handleSingleAdd = () => {
@@ -74,10 +82,8 @@ export default {
inputVal: "",
imgVal: "",
});
emit("addOption", curItem);
};
const input = ({ id, val }) => {
console.log(id, val)
curItem.value.singleList.forEach((item) => {
if (item.id === id) {
item.inputVal = val;
@@ -98,28 +104,22 @@ export default {
}
});
};
const del = ({ id, data }) => {
console.log(data)
api.deleteVoteStemOption(data.value.optionId)
.then(() => {
// message.success('删除题干信息成功')
emit("delOption", data);
})
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;
});
api.deleteVoteStemOption(optionId).then((res) => {
console.log(56444);
console.log(res);
});
};
const edit = (data) => {
// console.log('111111-223', data.value)
emit("edits", data)
}
return {
curItem,
handleTypesDel,
@@ -128,7 +128,6 @@ export default {
imgSrc,
delImg,
del,
edit
};
},
};
@@ -412,7 +411,8 @@ export default {
//line-height: 24px;
}
.ant-radio-wrapper {}
.ant-radio-wrapper {
}
.ant-input {
border-radius: 5px;

View File

@@ -0,0 +1,495 @@
<!-- 评估管理-创建评估页面 -->
<template>
<div class="itemRow">
<div class="options">
<div class="name">
<div class="namebox">
<div class="inname">选项{{ item.id }}</div>
</div>
<div class="in">
<a-input
v-model:value="curItem.inputVal"
show-count
:maxlength="30"
style="border-radius: 8px"
@change="handleInput"
/>
</div>
</div>
<div class="delete" @click="handleDel">删除</div>
</div>
<div class="name uploadContent">
<a-upload
v-show="!item.imgVal"
class="in uploadBtn"
:show-upload-list="false"
:before-upload="beforeUpload"
>
<div class="addimg">+添加图片</div>
</a-upload>
<div v-show="item.imgVal" class="picture" style="position: relative">
<img class="pictureimg" :src="item.imgVal" />
<div class="picturename" v-show="hasImgName">{{ hasImgName }}</div>
<img
style="
cursor: pointer;
width: 20px;
height: 20px;
position: absolute;
right: 0;
top: 0;
"
src="../../assets/images/basicinfo/close.png"
@click="handleCancel"
/>
</div>
</div>
</div>
</template>
<script>
import { reactive, toRefs, ref } from "vue";
import { message } from "ant-design-vue";
import { fileUp } from "../../api/indexEval";
export default {
name: "VoteQuestionItem",
props: {
item: {
type: Array,
default: () => {
return [];
},
},
},
setup(props, { emit }) {
const curItem = ref(props.item);
const state = reactive({
hasImgName: "",
});
const handleInput = (value) => {
console.log(value.target.value);
emit("edit", curItem);
emit("input", { id: curItem.value.id, val: value.target.value });
};
const handleDel = () => {
handleCancel();
emit("del", {
id: curItem.value.id,
optionId: curItem.value.optionId,
data: curItem,
});
};
const handleCancel = () => {
state.hasImgName = "";
emit("delImg", { id: curItem.value.id });
};
const beforeUpload = (file) => {
const isJpgOrPng =
file.type === "image/jpg" ||
file.type === "image/jpeg" ||
file.type === "image/png" ||
file.type === "image/svg" ||
file.type === "image/bmp" ||
file.type === "image/gif";
if (!isJpgOrPng) {
message.error("仅支持jpg、gif、png、jpeg、svg、bmp格式!");
return false;
}
let isLt1M = file.size / 10240 / 10240 <= 1;
if (!isLt1M) {
this.$message.error("图片大小超过10MB!");
return false;
}
const formData = new FormData();
formData.append("file", file);
fileUp(formData).then((res) => {
if (res.data.code === 200) {
state.hasImgName = file.name;
emit("src", { id: curItem.value.id, src: res.data.data });
}
});
return false;
};
return {
...toRefs(state),
curItem,
handleInput,
handleDel,
handleCancel,
beforeUpload,
};
},
};
</script>
<style lang="scss">
.researchadd {
width: 100%;
display: flex;
flex-direction: column;
.header {
width: 100%;
display: flex;
justify-content: space-between;
.title {
color: #000000;
font-size: 18px;
//line-height: 36px;
padding-top: 30px;
padding-left: 37px;
//font-weight: 500;
}
.goback {
padding-right: 70px;
//padding-top: 37px;
position: relative;
.return {
display: inline-block;
width: 42px;
height: 42px;
margin-top: 17px;
margin-right: 10px;
background-image: url("../../assets/images/projectadd/return.png");
}
.returntext {
display: inline-block;
position: absolute;
top: 27px;
color: #4ea6ff;
font-size: 14px;
}
}
}
.addtype {
display: flex;
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
margin-right: 20px;
align-items: center;
margin-left: 41px;
.addtypen {
color: #6f6f6f;
font-size: 14px;
}
.types {
cursor: pointer;
width: 80px;
height: 40px;
color: #409eff;
border: 1px solid #409eff;
border-radius: 4px;
display: flex;
justify-content: center;
align-items: center;
margin: 20px 10px;
}
.typesCur {
color: #fff;
background: #409eff;
}
}
.content {
display: flex;
flex-direction: column;
border: 1px solid rgba(0, 0, 0, 0.1);
width: 70%;
min-width: 690px;
margin-left: 38px;
margin-top: 20px;
.tagbox {
display: flex;
justify-content: space-between;
.tagname {
width: 90px;
height: 32px;
margin-top: 24px;
display: flex;
justify-content: center;
align-items: center;
margin-left: 134px;
background: rgba(78, 166, 255, 0.1);
border-radius: 4px;
color: rgba(64, 158, 255, 1);
font-size: 16px;
}
.deleteop {
display: flex;
justify-content: center;
align-items: center;
width: 100px;
height: 40px;
margin-top: 20px;
margin-right: 30px;
border: 1px solid #409eff;
border-radius: 8px;
cursor: pointer;
.del_text {
color: #409eff;
font-size: 14px;
margin-left: 5px;
}
}
}
.scorebox {
display: flex;
align-items: center;
margin-top: 20px;
margin-left: 70px;
.scoretext {
font-size: 14px;
color: #56a3f9;
}
.number {
display: flex;
border: 1px solid #d7e5fd;
border-radius: 5px;
margin: 0 10px;
padding: 5px;
.btn {
width: 40px;
height: 40px;
border: 1px solid #56a3f9;
border-radius: 8px;
display: flex;
justify-content: center;
align-items: center;
margin: 5px;
font-size: 14px;
font-weight: 400;
color: #56a3f9;
line-height: 24px;
cursor: pointer;
}
}
}
.picture {
width: 100px;
display: flex;
flex-direction: column;
margin-top: 20px;
margin-left: 133px;
.pictureimg {
width: 100px;
height: 100px;
}
.picturename {
color: #6f6f6f;
font-size: 14px;
}
}
.options {
display: flex;
}
.delete {
cursor: pointer;
margin-top: 32px;
margin-left: 107px;
// float: right;
color: #4ea6ff;
font-size: 14px;
}
.name2 {
display: flex;
align-items: flex-start;
}
.name {
width: 60%;
// background-color: lightcoral;
display: flex;
margin-top: 20px;
//align-items: center;
//height: 40px;
// border: 1px solid black;
.namebox {
width: 120px;
display: flex;
align-items: center;
justify-content: flex-end;
flex-shrink: 0;
.nameimg {
width: 10px;
height: 10px;
}
}
.inname {
color: #6f6f6f;
font-size: 14px;
margin-left: 7px;
font-weight: 700;
}
.in {
margin-left: 14px;
flex: 1;
.assess {
display: flex;
width: 226px;
height: 40px;
border: 1px solid #56a3f9;
//margin-bottom: 20px;
.assesstype {
width: 50%;
background: #56a3f9;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
}
.assesswhole {
width: 50%;
background: rgba(86, 163, 249, 0.1);
font-size: 14px;
color: #6f6f6f;
display: flex;
justify-content: center;
align-items: center;
}
.ratio {
position: absolute;
right: 10px;
top: 8px;
color: #6f6f6f;
font-size: 14px;
}
}
.addimg {
cursor: pointer;
color: rgba(78, 166, 255, 1);
font-size: 14px;
}
.text {
color: rgba(109, 117, 132, 1);
font-size: 14px;
//line-height: 24px;
}
.ant-radio-wrapper {
}
.ant-input {
border-radius: 5px;
// height: 120%;
width: 100%;
height: 35px;
}
.ant-select-selector {
border-radius: 5px;
// height: 120%;
width: 100%;
height: 40px;
}
}
.numberInp {
width: 200px;
.ant-input-number {
width: 200px;
height: 40px;
border-radius: 8px;
}
// .ant-input-number-input-wrap {
// width: 200px;
// }
}
}
}
.name2 {
display: flex;
align-items: flex-start;
}
.opinion {
display: flex;
margin-top: 30px;
.namebox {
width: 120px;
display: flex;
align-items: center;
justify-content: flex-end;
flex-shrink: 0;
}
.in {
margin-left: 14px;
width: 500px;
.ant-input-textarea-show-count {
position: relative;
height: 110px;
}
.ant-input-textarea-show-count::after {
position: absolute;
right: 10px;
bottom: 0px;
}
.ant-input {
border-radius: 8px;
}
}
}
.footer {
width: 100%;
margin-top: 31px;
margin-bottom: 14px;
.btn {
display: flex;
margin-bottom: 20px;
justify-content: center;
cursor: pointer;
}
}
.uploadContent {
display: block !important;
.uploadBtn {
margin-left: 120px !important;
}
}
}
</style>

View File

@@ -7,27 +7,41 @@
<div class="inname">选项{{ item.id }}</div>
</div>
<div class="in">
<a-input v-model:value="curItem.inputVal" show-count :maxlength="30" style="border-radius: 8px"
@change="handleInput" />
<a-input
v-model:value="curItem.inputVal"
show-count
:maxlength="30"
style="border-radius: 8px"
@change="handleInput"
/>
</div>
</div>
<div class="delete" @click="handleDel">删除</div>
</div>
<div class="name uploadContent">
<a-upload v-show="!item.imgVal" class="in uploadBtn" :show-upload-list="false" :before-upload="beforeUpload">
<a-upload
v-show="!item.imgVal"
class="in uploadBtn"
:show-upload-list="false"
:before-upload="beforeUpload"
>
<div class="addimg">+添加图片</div>
</a-upload>
<div v-show="item.imgVal" class="picture" style="position: relative">
<img class="pictureimg" :src="item.imgVal" />
<div class="picturename" v-show="hasImgName">{{ hasImgName }}</div>
<img style="
<img
style="
cursor: pointer;
width: 20px;
height: 20px;
position: absolute;
right: 0;
top: 0;
" src="../../assets/images/basicinfo/close.png" @click="handleCancel" />
"
src="../../assets/images/basicinfo/close.png"
@click="handleCancel"
/>
</div>
</div>
</div>
@@ -53,14 +67,12 @@ export default {
hasImgName: "",
});
const handleInput = (value) => {
console.log(value.target.value)
emit("edit", curItem)
emit("input", { id: curItem.value.id, val: value.target.value });
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, data: curItem });
emit("del", { id: curItem.value.id, optionId: curItem.value.optionId });
};
const handleCancel = () => {
state.hasImgName = "";
@@ -87,6 +99,7 @@ export default {
const formData = new FormData();
formData.append("file", file);
console.log(file);
fileUp(formData).then((res) => {
if (res.data.code === 200) {
state.hasImgName = file.name;
@@ -381,7 +394,8 @@ export default {
//line-height: 24px;
}
.ant-radio-wrapper {}
.ant-radio-wrapper {
}
.ant-input {
border-radius: 5px;

View File

@@ -1,21 +1,26 @@
<template>
<a-drawer :visible="addStemVisible"
placement="right" class="custom-class"
<a-drawer
:visible="addStemVisible"
placement="right"
class="custom-class"
@after-visible-change="afterVisibleChange"
@close="closeDrawer" width="60%">
@close="closeDrawer"
width="60%"
>
<div>
<h2 style="text-align:center;">投票查看</h2>
<h2 style="text-align: center">投票查看</h2>
<div v-for="(item, index) in form" :key="item.voteStemId">
<div class="title">{{ index + 1 }}. {{ item.voteStemName }}</div>
<a-radio-group v-model:value="item.voteStemId">
<a-radio :value="3" :style="radioStyle">
{{item.optionDetailList[0].optionName}}</a-radio>
{{ item.optionDetailList[0].optionName }}</a-radio
>
<br />
<a-radio :value="2" :style="radioStyle">
{{item.optionDetailList[1].optionName}}</a-radio>
{{ item.optionDetailList[1].optionName }}</a-radio
>
</a-radio-group>
</div>
</div>
</a-drawer>
</template>
@@ -23,7 +28,7 @@
<script>
import { reactive, toRefs, ref } from "vue";
import { message } from "ant-design-vue";
import * as api from "@/api/indexVote"
import * as api from "@/api/indexVote";
export default {
name: "queryStem",
@@ -31,56 +36,57 @@ export default {
addStemVisible: {
type: Boolean,
default: false,
}
},
},
setup(props, ctx) {
const value = ref(1);
const state = reactive({
form: [],
});
const radioStyle = reactive({
display: 'flex',
height: '30px',
lineHeight: '30px',
display: "flex",
height: "30px",
lineHeight: "30px",
});
const afterVisibleChange = (bool) => {
if (bool === true) {
getStem()
}
getStem();
}
};
const getStem = () => {
let obj = {
stemId: 0,
ballotId: 2,
}
api.queryStemByStemId(obj).then((res) => {
state.form = res.data.data
console.log(JSON.stringify(res.data)+'***');
};
api
.queryStemByStemId(obj)
.then((res) => {
state.form = res.data.data;
console.log(JSON.stringify(res.data) + "***");
message.success("投票获取成功");
console.log(res);
}).catch((err) => {
})
.catch((err) => {
message.error("投票获取失败" + err);
console.log(err);
})
}
});
};
const closeDrawer = () => {
ctx.emit("closeDrawer")
}
ctx.emit("closeDrawer");
};
return {
...toRefs(state),
afterVisibleChange,
closeDrawer,
radioStyle,
value
}
}
}
value,
};
},
};
</script>
<style>
.title {
font-size: 17px;
}
</style>

View File

@@ -57,19 +57,16 @@ export function deepCloneFilterString(obj, fillterKeys) {
return obj;
}
export function sortBy(arr, ...keys) {
export function sortBy(arr, key) {
return arr.sort((x, y) => {
for (const key of keys) {
const valueX = typeof key === "function" ? key(x) : x[key];
const valueY = typeof key === "function" ? key(y) : y[key];
const valueX = parseInt(x[key]);
const valueY = parseInt(y[key]);
if (valueX > valueY) {
return 1;
}
if (valueX < valueY) {
return -1;
}
}
return 0;
});
}

View File

@@ -88,7 +88,7 @@
</div>
</template>
<script>
import { reactive, toRefs, computed } from "vue";
import { reactive, toRefs, computed, getCurrentInstance } from "vue";
// import { message } from "ant-design-vue";
// import { createResearch } from "../../api/indexResearch";
import ResearchAddSingle from "./components/ResearchAddSingle.vue";
@@ -121,6 +121,11 @@ export default {
ResearchAddPin,
},
setup() {
let { ctx: that } = getCurrentInstance();
const reload = () => {
that.$forceUpdate();
};
const router = useRouter();
const state = reactive({
assessmentId: "", //编辑时候传
@@ -153,8 +158,8 @@ export default {
];
sortBy(renderArr, "orderNumber"); //序号
state.allFormsData = parseData(renderArr, "questionType"); //类型
// console.log("state.allFormsData");
// console.log(state.allFormsData);
console.log("state.allFormsData11111111111");
console.log(state.allFormsData);
}
};
getInfoDate();
@@ -360,7 +365,7 @@ export default {
case 1:
obj = {
type,
id: state.allFormsData.length,
id: state.allFormsData.length + 1,
valueSingle: "",
singleList: [
{
@@ -374,7 +379,7 @@ export default {
case 2:
obj = {
type,
id: state.allFormsData.length,
id: state.allFormsData.length + 1,
valueMutil: "",
mutilList: [
{
@@ -388,7 +393,7 @@ export default {
case 3:
obj = {
type,
id: state.allFormsData.length,
id: state.allFormsData.length + 1,
valueAsk: "",
valueAskDesc: "",
};
@@ -396,7 +401,7 @@ export default {
case 4:
obj = {
type,
id: state.allFormsData.length,
id: state.allFormsData.length + 1,
valuePin: "",
minScore: 1,
maxScore: 10,
@@ -412,15 +417,22 @@ export default {
};
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 (type === 1) {
console.log(11111);
@@ -432,6 +444,7 @@ export default {
}).then((res) => {
console.log(56444);
console.log(res);
reload();
});
}
if (type === 2) {
@@ -444,6 +457,7 @@ export default {
}).then((res) => {
console.log(56444);
console.log(res);
reload();
});
}
if (type === 3) {
@@ -456,6 +470,7 @@ export default {
}).then((res) => {
console.log(56444);
console.log(res);
reload();
});
}
if (type === 4) {
@@ -468,6 +483,7 @@ export default {
}).then((res) => {
console.log(56444);
console.log(res);
reload();
});
}
};

View File

@@ -15,7 +15,7 @@
class="nameimg"
src="../../../assets/images/basicinfo/asterisk.png"
/>
<div class="inname">标题</div>
<div class="inname">标题{{ curItem.id }}</div>
</div>
<div class="in">
<a-input

View File

@@ -15,7 +15,7 @@
class="nameimg"
src="../../../assets/images/basicinfo/asterisk.png"
/>
<div class="inname">标题</div>
<div class="inname">标题{{ curItem.id }}</div>
</div>
<div class="in">
<a-input

View File

@@ -15,7 +15,7 @@
class="nameimg"
src="../../../assets/images/basicinfo/asterisk.png"
/>
<div class="inname">标题</div>
<div class="inname">标题{{ curItem.id }}</div>
</div>
<div class="in">
<a-input

View File

@@ -15,7 +15,7 @@
class="nameimg"
src="../../../assets/images/basicinfo/asterisk.png"
/>
<div class="inname">标题</div>
<div class="inname">标题{{ curItem.id }}</div>
</div>
<div class="in">
<a-input
@@ -80,6 +80,15 @@ 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)) {