mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 12:26:47 +08:00
部分修改
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import http from "./config";
|
import http from "./config";
|
||||||
import qs from 'qs';
|
import qs from "qs";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口传参数方式(get)
|
* 接口传参数方式(get)
|
||||||
@@ -42,42 +41,49 @@ import qs from 'qs';
|
|||||||
// 接口-请求
|
// 接口-请求
|
||||||
|
|
||||||
//基础票数上传接口
|
//基础票数上传接口
|
||||||
export const baseVoteupload = (obj) => http.post('/vote/baseVoteupload', obj, {
|
export const baseVoteupload = (obj) =>
|
||||||
headers: {
|
http.post("/vote/baseVoteupload", obj, {
|
||||||
'token': '123',
|
headers: {
|
||||||
'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获取题干信息
|
//根据题干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获取投票任务
|
//根据题干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'
|
// import * as api from '../../api/index'
|
||||||
|
|||||||
@@ -168,8 +168,7 @@ export default {
|
|||||||
localStorage.setItem("chapterId", props.isactive);
|
localStorage.setItem("chapterId", props.isactive);
|
||||||
};
|
};
|
||||||
|
|
||||||
const afterVisibleChange = () => {
|
const afterVisibleChange = () => {};
|
||||||
};
|
|
||||||
|
|
||||||
const showDrawer = () => {
|
const showDrawer = () => {
|
||||||
state.visible = true;
|
state.visible = true;
|
||||||
|
|||||||
@@ -1,49 +1,76 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-drawer :visible="addvoteVisible" class="drawerStyle addvoteDrawer" width="80%" title="添加投票" placement="right"
|
<a-drawer
|
||||||
@after-visible-change="afterVisibleChange">
|
:visible="addvoteVisible"
|
||||||
|
class="drawerStyle addvoteDrawer"
|
||||||
|
width="80%"
|
||||||
|
title="添加投票"
|
||||||
|
placement="right"
|
||||||
|
@after-visible-change="afterVisibleChange"
|
||||||
|
>
|
||||||
<div class="drawerMain">
|
<div class="drawerMain">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div v-if="edit" class="headerTitle">编辑投票</div>
|
<div v-if="edit" class="headerTitle">编辑投票任务</div>
|
||||||
<div v-else class="headerTitle">添加投票</div>
|
<div v-else class="headerTitle">添加投票任务</div>
|
||||||
<img style="width: 29px; height: 29px; cursor: pointer" src="../../assets/images/basicinfo/close.png"
|
<img
|
||||||
@click="closeDrawer" />
|
style="width: 29px; height: 29px; cursor: pointer"
|
||||||
|
src="../../assets/images/basicinfo/close.png"
|
||||||
|
@click="closeDrawer"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="contentMain">
|
<div class="contentMain">
|
||||||
<div class="main_left">
|
<div class="main_left">
|
||||||
<div class="main_item">
|
<div class="main_item">
|
||||||
<div class="signbox">
|
<div class="signbox">
|
||||||
<div class="sign">
|
<div class="sign">
|
||||||
<img src="@/assets/images/coursewareManage/asterisk.png" alt="" />
|
<img
|
||||||
|
src="@/assets/images/coursewareManage/asterisk.png"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span style="margin-right: 3px">任务名称:</span>
|
<span style="margin-right: 3px">任务名称:</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-input v-model:value="inputV1" style="width: 424px; height: 32px" placeholder="请输入投票名称"
|
<a-input
|
||||||
maxlength="20" />
|
v-model:value="inputV1"
|
||||||
|
style="width: 424px; height: 32px"
|
||||||
|
placeholder="请输入投票名称"
|
||||||
|
maxlength="20"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="main_item">
|
<div class="main_item">
|
||||||
<div class="signbox">
|
<div class="signbox">
|
||||||
<div class="sign">
|
<div class="sign">
|
||||||
<img src="@/assets/images/coursewareManage/asterisk.png" alt="" />
|
<img
|
||||||
|
src="@/assets/images/coursewareManage/asterisk.png"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span>创建投票:</span>
|
<span>创建投票:</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<button class="xkbtn" @click="showDrawerCreVote">
|
<button class="xkbtn" @click="showDrawerCreVote">
|
||||||
{{ ballotId ? "编辑" : "添加" }}投票
|
{{ ballotId ? "编辑" : "创建" }}投票
|
||||||
|
|
||||||
</button>
|
</button>
|
||||||
<div v-if="ballotId > 0">
|
<div v-if="ballotId > 0">
|
||||||
<a-tag closable color="processing" @close="log">
|
<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>
|
</a-tag>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<CreateVote v-model:createVoteVisible="createVoteVisible" v-model:ballotId="ballotId"
|
<CreateVote
|
||||||
v-model:editChild="editChild" />
|
v-model:createVoteVisible="createVoteVisible"
|
||||||
|
v-model:ballotId="ballotId"
|
||||||
|
v-model:editChild="editChild"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button class="xkbtn" :style="{ display: creVote ? 'block' : 'none' }" @click="showDrawerCreVote">
|
<button
|
||||||
|
class="xkbtn"
|
||||||
|
:style="{ display: creVote ? 'block' : 'none' }"
|
||||||
|
@click="showDrawerCreVote"
|
||||||
|
>
|
||||||
编辑投票
|
编辑投票
|
||||||
</button>
|
</button>
|
||||||
<div :style="{ display: creVote ? 'block' : 'none' }">
|
<div :style="{ display: creVote ? 'block' : 'none' }">
|
||||||
@@ -56,7 +83,11 @@
|
|||||||
|
|
||||||
<!-- 创建投票侧弹窗 -->
|
<!-- 创建投票侧弹窗 -->
|
||||||
<div>
|
<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>
|
||||||
<!-- 创建投票侧弹窗 -->
|
<!-- 创建投票侧弹窗 -->
|
||||||
</div>
|
</div>
|
||||||
@@ -65,7 +96,11 @@
|
|||||||
<span style="margin-right: 3px">起止时间:</span>
|
<span style="margin-right: 3px">起止时间:</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<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>
|
</div>
|
||||||
<div class="main_item">
|
<div class="main_item">
|
||||||
@@ -73,12 +108,23 @@
|
|||||||
<span style="margin-right: 3px">基础投票数:</span>
|
<span style="margin-right: 3px">基础投票数:</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-upload @change="handleChange" :before-upload="beforeUpload" :multiple="true" :max-count="1"
|
<a-upload
|
||||||
action="/manageApi/vote/baseVoteupload" v-model:file-list="fileList">
|
@change="handleChange"
|
||||||
<button class="xkbtn">点击上传</button></a-upload>
|
:before-upload="beforeUpload"
|
||||||
<div v-if="voteCount > 0"><a-tag color="processing"> <span style="font-size:14px;line-height: 33px;">{{
|
:multiple="true"
|
||||||
voteCount
|
:max-count="1"
|
||||||
}}票</span></a-tag></div>
|
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>
|
</div>
|
||||||
<div class="main_item" style="margin-top: -25px">
|
<div class="main_item" style="margin-top: -25px">
|
||||||
@@ -92,7 +138,12 @@
|
|||||||
<span style="margin-right: 3px">投票说明:</span>
|
<span style="margin-right: 3px">投票说明:</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="textarea">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -117,8 +168,7 @@ import { addTempTask } from "../../api/indexTaskadd";
|
|||||||
export default {
|
export default {
|
||||||
name: "AddVote",
|
name: "AddVote",
|
||||||
components: {
|
components: {
|
||||||
CreateVote
|
CreateVote,
|
||||||
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
addvoteVisible: {
|
addvoteVisible: {
|
||||||
@@ -145,11 +195,13 @@ export default {
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
isLevel: { // 是否是关卡页面触发
|
isLevel: {
|
||||||
|
// 是否是关卡页面触发
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
projectTaskId: { // 要编辑的projectId
|
projectTaskId: {
|
||||||
|
// 要编辑的projectId
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
@@ -164,9 +216,7 @@ export default {
|
|||||||
projectTemplateId: {
|
projectTemplateId: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
}
|
},
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
@@ -182,7 +232,7 @@ export default {
|
|||||||
EditVoteId: "",
|
EditVoteId: "",
|
||||||
voteStemName: "",
|
voteStemName: "",
|
||||||
ballotName: "",
|
ballotName: "",
|
||||||
editStem: false, //编辑状态
|
editStem: false, //编辑状态
|
||||||
ballotId: 0, //题干id
|
ballotId: 0, //题干id
|
||||||
optionId: "", //删除,修改选项id
|
optionId: "", //删除,修改选项id
|
||||||
addStemVisible: false, //
|
addStemVisible: false, //
|
||||||
@@ -190,14 +240,13 @@ export default {
|
|||||||
fileList: [],
|
fileList: [],
|
||||||
voteCount: null,
|
voteCount: null,
|
||||||
projectTemplateId: null,
|
projectTemplateId: null,
|
||||||
|
|
||||||
});
|
});
|
||||||
const closeDrawer = () => {
|
const closeDrawer = () => {
|
||||||
state.inputV1 = "",
|
(state.inputV1 = ""),
|
||||||
state.textV1 = "",
|
(state.textV1 = ""),
|
||||||
state.time = undefined,
|
(state.time = undefined),
|
||||||
state.basevote = "",
|
(state.basevote = ""),
|
||||||
state.ballotId = "",
|
(state.ballotId = ""),
|
||||||
ctx.emit("update:addvoteVisible", false);
|
ctx.emit("update:addvoteVisible", false);
|
||||||
ctx.emit("update:edit", false);
|
ctx.emit("update:edit", false);
|
||||||
};
|
};
|
||||||
@@ -207,38 +256,33 @@ export default {
|
|||||||
}
|
}
|
||||||
state.projectTemplateId = props.projectTemplateId;
|
state.projectTemplateId = props.projectTemplateId;
|
||||||
console.log("projectTemplateId visible====", state.projectTemplateId);
|
console.log("projectTemplateId visible====", state.projectTemplateId);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const showDrawerCreVote = () => {
|
const showDrawerCreVote = () => {
|
||||||
state.createVoteVisible = true;
|
state.createVoteVisible = true;
|
||||||
state.editChild = props.edit;
|
state.editChild = props.edit;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 限制文件格式上传
|
// 限制文件格式上传
|
||||||
const beforeUpload = (obj) => {
|
const beforeUpload = (obj) => {
|
||||||
console.log(obj)
|
console.log(obj);
|
||||||
}
|
};
|
||||||
|
|
||||||
const handleChange = info => {
|
const handleChange = (info) => {
|
||||||
console.log(info.file.type, info.file.type.indexOf('sheet'))
|
console.log(info.file.type, info.file.type.indexOf("sheet"));
|
||||||
if (info.file.type.indexOf('sheet') == -1) {
|
if (info.file.type.indexOf("sheet") == -1) {
|
||||||
message.destroy()
|
message.destroy();
|
||||||
message.error("请上传正确的文件格式")
|
message.error("请上传正确的文件格式");
|
||||||
|
|
||||||
console.log(state.fileList)
|
console.log(state.fileList);
|
||||||
|
|
||||||
state.fileList = []
|
state.fileList = [];
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let resFileList = [...info.fileList];
|
let resFileList = [...info.fileList];
|
||||||
|
|
||||||
|
resFileList.map((file) => {
|
||||||
resFileList.map(file => {
|
|
||||||
if (file.response) {
|
if (file.response) {
|
||||||
// Component will show file.url as link
|
// Component will show file.url as link
|
||||||
file.url = file.response.url;
|
file.url = file.response.url;
|
||||||
@@ -246,26 +290,23 @@ export default {
|
|||||||
console.log("file========", file.response);
|
console.log("file========", file.response);
|
||||||
state.voteCount = file.response.data;
|
state.voteCount = file.response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
//fileList.value = resFileList;
|
//fileList.value = resFileList;
|
||||||
};
|
};
|
||||||
|
|
||||||
//删除题干信息接口
|
//删除题干信息接口
|
||||||
const dleVoteStem = () => {
|
const dleVoteStem = () => {
|
||||||
api.deleteVoteStem({ voteStemId: state.ballotId })
|
api.deleteVoteStem({ voteStemId: state.ballotId }).then(() => {
|
||||||
.then(() => {
|
message.success("删除题干信息成功");
|
||||||
message.success('删除题干信息成功')
|
});
|
||||||
|
};
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//根据投票id获取投票信息
|
//根据投票id获取投票信息
|
||||||
const queryVoteInfo = () => {
|
const queryVoteInfo = () => {
|
||||||
|
api
|
||||||
api.queryVoteDetailById(props.EditVoteId)
|
.queryVoteDetailById(props.EditVoteId)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log('获取投票信息成功', res);
|
console.log("获取投票信息成功", res);
|
||||||
state.inputV1 = res.data.data.voteName;
|
state.inputV1 = res.data.data.voteName;
|
||||||
state.textV1 = res.data.data.voteExplain;
|
state.textV1 = res.data.data.voteExplain;
|
||||||
state.baseVote = res.data.data.baseVote;
|
state.baseVote = res.data.data.baseVote;
|
||||||
@@ -277,11 +318,9 @@ export default {
|
|||||||
];
|
];
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log('获取投票信息失败', err);
|
console.log("获取投票信息失败", err);
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
}
|
|
||||||
const updateToTask = (res) => {
|
const updateToTask = (res) => {
|
||||||
console.log("props.isLevel=====", props.isLevel);
|
console.log("props.isLevel=====", props.isLevel);
|
||||||
if (props.isLevel == 1) {
|
if (props.isLevel == 1) {
|
||||||
@@ -319,7 +358,6 @@ export default {
|
|||||||
////message.error(`${props.edit ? '编辑' : '新增'}阶段任务失败`)
|
////message.error(`${props.edit ? '编辑' : '新增'}阶段任务失败`)
|
||||||
});
|
});
|
||||||
} else if (props.isLevel == 3) {
|
} else if (props.isLevel == 3) {
|
||||||
|
|
||||||
addTempTask({
|
addTempTask({
|
||||||
courseId: res.data.data.voteId,
|
courseId: res.data.data.voteId,
|
||||||
name: res.data.data.voteName,
|
name: res.data.data.voteName,
|
||||||
@@ -336,7 +374,7 @@ export default {
|
|||||||
//message.error(`${props.edit ? "编辑" : "新增"}阶段任务失败`);
|
//message.error(`${props.edit ? "编辑" : "新增"}阶段任务失败`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
//修改投票信息接口
|
//修改投票信息接口
|
||||||
const updateVoteInfo = () => {
|
const updateVoteInfo = () => {
|
||||||
if (!state.inputV1) {
|
if (!state.inputV1) {
|
||||||
@@ -364,8 +402,7 @@ export default {
|
|||||||
ballotId: state.ballotId,
|
ballotId: state.ballotId,
|
||||||
baseVote: state.basevote,
|
baseVote: state.basevote,
|
||||||
voteExplain: state.textV1,
|
voteExplain: state.textV1,
|
||||||
|
};
|
||||||
}
|
|
||||||
if (props.edit) {
|
if (props.edit) {
|
||||||
api
|
api
|
||||||
.editVote(obj)
|
.editVote(obj)
|
||||||
@@ -374,12 +411,12 @@ export default {
|
|||||||
await updateToTask(res);
|
await updateToTask(res);
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
message.destroy();
|
message.destroy();
|
||||||
message.success("修改投票信息成功")
|
message.success("修改投票信息成功");
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
message.destroy();
|
message.destroy();
|
||||||
message.error("修改投票信息失败")
|
message.error("修改投票信息失败");
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
api
|
api
|
||||||
.createVote(obj)
|
.createVote(obj)
|
||||||
@@ -387,22 +424,21 @@ export default {
|
|||||||
await updateToTask(res);
|
await updateToTask(res);
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
message.destroy();
|
message.destroy();
|
||||||
message.success("创建投票信息成功")
|
message.success("创建投票信息成功");
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
message.destroy();
|
message.destroy();
|
||||||
message.error("创建投票信息失败")
|
message.error("创建投票信息失败");
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
|
||||||
const queryStem = () => {
|
const queryStem = () => {
|
||||||
state.addStemVisible = true;
|
state.addStemVisible = true;
|
||||||
};
|
};
|
||||||
const closeStem = () => {
|
const closeStem = () => {
|
||||||
state.addStemVisible = false;
|
state.addStemVisible = false;
|
||||||
};
|
};
|
||||||
const log = e => {
|
const log = (e) => {
|
||||||
state.ballotId = null;
|
state.ballotId = null;
|
||||||
console.log(e);
|
console.log(e);
|
||||||
};
|
};
|
||||||
@@ -450,8 +486,10 @@ export default {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
width: calc(100%);
|
width: calc(100%);
|
||||||
height: 40px;
|
height: 40px;
|
||||||
background: linear-gradient(rgba(78, 166, 255, 0.2) 0%,
|
background: linear-gradient(
|
||||||
rgba(78, 166, 255, 0) 100%);
|
rgba(78, 166, 255, 0.2) 0%,
|
||||||
|
rgba(78, 166, 255, 0) 100%
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
.del_main {
|
.del_main {
|
||||||
|
|||||||
626
src/components/vote/CreateVote copy.vue
Normal file
626
src/components/vote/CreateVote copy.vue
Normal 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>
|
||||||
@@ -1,12 +1,20 @@
|
|||||||
<!-- 评估管理-创建评估页面 -->
|
<!-- 评估管理-创建评估页面 -->
|
||||||
<template>
|
<template>
|
||||||
<a-drawer :visible="createVoteVisible" class="drawerStyle createvoteDrawer" width="100%" placement="right"
|
<a-drawer
|
||||||
@after-visible-change="afterVisibleChange">
|
:visible="createVoteVisible"
|
||||||
|
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">{{ ballotId ? "编辑投票" : "创建投票" }}</div>
|
||||||
<img style="width: 29px; height: 29px; cursor: pointer" src="../../assets/images/basicinfo/close.png"
|
<img
|
||||||
@click="closeDrawer" />
|
style="width: 29px; height: 29px; cursor: pointer"
|
||||||
|
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">
|
||||||
@@ -17,8 +25,12 @@
|
|||||||
<span style="margin-right: 3px">投票名称:</span>
|
<span style="margin-right: 3px">投票名称:</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-input v-model:value="ballotName" style="width: 424px; height: 32px" placeholder="请输入任务名称"
|
<a-input
|
||||||
maxlength="20" />
|
v-model:value="ballotName"
|
||||||
|
style="width: 424px; height: 32px"
|
||||||
|
placeholder="请输入任务名称"
|
||||||
|
maxlength="20"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="main_item">
|
<div class="main_item">
|
||||||
@@ -36,26 +48,34 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-for="(item, index) in allFormsData" :key="index">
|
<div v-for="(item, index) in allFormsData" :key="index">
|
||||||
<VoteQuestion v-model:info="information" :item="item" :optionId="optionId" @delOption="delOption"
|
<VoteQuestion :item="item" @del="handleDel" />
|
||||||
@del="handleDel" @edits="edits" @addOption="addOption" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
<a-button type="primary" style="
|
<a-button
|
||||||
|
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 type="primary" ghost style="
|
<a-button
|
||||||
|
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>
|
||||||
@@ -70,7 +90,7 @@ import { message } from "ant-design-vue";
|
|||||||
import VoteQuestion from "./VoteQuestion.vue";
|
import VoteQuestion from "./VoteQuestion.vue";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
// sortBy,
|
sortBy,
|
||||||
traverseArr,
|
traverseArr,
|
||||||
//filterCommon,
|
//filterCommon,
|
||||||
// deepCloneFilterString,
|
// deepCloneFilterString,
|
||||||
@@ -79,7 +99,7 @@ import {
|
|||||||
//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";
|
||||||
|
|
||||||
@@ -107,8 +127,6 @@ export default {
|
|||||||
ballotId: "",
|
ballotId: "",
|
||||||
ballotName: "",
|
ballotName: "",
|
||||||
allFormsData: [],
|
allFormsData: [],
|
||||||
allFormsData1: [],
|
|
||||||
|
|
||||||
});
|
});
|
||||||
// const router = useRouter();
|
// const router = useRouter();
|
||||||
const afterVisibleChange = () => {
|
const afterVisibleChange = () => {
|
||||||
@@ -116,9 +134,7 @@ export default {
|
|||||||
getInfoDate();
|
getInfoDate();
|
||||||
} else {
|
} else {
|
||||||
handleTypes();
|
handleTypes();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
const closeDrawer = () => {
|
const closeDrawer = () => {
|
||||||
ctx.emit("update:createVoteVisible", false);
|
ctx.emit("update:createVoteVisible", false);
|
||||||
@@ -130,49 +146,39 @@ export default {
|
|||||||
console.log("props.editChild=====", props.editChild);
|
console.log("props.editChild=====", props.editChild);
|
||||||
if (props.ballotId) {
|
if (props.ballotId) {
|
||||||
console.log("props.editChild2=====", props.editChild);
|
console.log("props.editChild2=====", props.editChild);
|
||||||
let res = await api
|
let res = await api.queryStemByStemId(props.ballotId).then((res) => {
|
||||||
.queryStemByStemId(props.ballotId)
|
if (res.data.code === 200) {
|
||||||
.then((res) => {
|
return res.data.data;
|
||||||
if (res.data.code === 200) {
|
}
|
||||||
return res.data.data;
|
});
|
||||||
}
|
state.ballotId = res.ballotId;
|
||||||
});
|
state.ballotName = res.ballotName;
|
||||||
console.log("res====", res);
|
let renderArr = [...res.voteStemVoList];
|
||||||
state.ballotName = res.ballotId;
|
sortBy(renderArr, "orderNumber"); //序号
|
||||||
// let renderArr = [...res];
|
state.allFormsData = parseData(renderArr);
|
||||||
// sortBy(renderArr, "orderNumber"); //序号
|
|
||||||
state.allFormsData = parseData(res); //类型
|
|
||||||
state.allFormsData1 = parseData(res); //类型
|
|
||||||
|
|
||||||
console.log(state.allFormsData);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 转换成前端格式
|
// 转换成前端格式
|
||||||
const parseData = (arr) => {
|
const parseData = (arr) => {
|
||||||
const resultArr = [];
|
const resultArr = [];
|
||||||
state.ballotId = arr.ballotId;
|
|
||||||
state.ballotName = arr.ballotName;
|
|
||||||
|
|
||||||
console.log("arr.voteStemVoList=====", arr.voteStemVoList);
|
console.log("arr.voteStemVoList=====", arr);
|
||||||
arr.voteStemVoList.forEach((item) => {
|
arr.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",
|
|
||||||
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,
|
|
||||||
valueSingle: item.voteStemName,
|
valueSingle: item.voteStemName,
|
||||||
singleList: restList,
|
singleList: restList,
|
||||||
|
orderNumber: item.orderNumber,
|
||||||
};
|
};
|
||||||
resultArr.push(obj);
|
resultArr.push(obj);
|
||||||
});
|
});
|
||||||
@@ -189,34 +195,25 @@ export default {
|
|||||||
arr.forEach((item) => {
|
arr.forEach((item) => {
|
||||||
let obj = {};
|
let obj = {};
|
||||||
console.log("item=======", item);
|
console.log("item=======", item);
|
||||||
// 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",
|
|
||||||
stem: "stem",
|
|
||||||
}).map((itm, idx) => {
|
}).map((itm, idx) => {
|
||||||
itm.optionOrderNum = idx + 1;
|
itm.optionOrderNum = idx + 1;
|
||||||
return itm;
|
return itm;
|
||||||
});
|
});
|
||||||
restList.forEach((item) => {
|
restList.forEach((item) => {
|
||||||
item.optionId = item.optionId
|
item.optionId = item.optionId ? item.optionId : "";
|
||||||
? item.optionId
|
|
||||||
: "";
|
|
||||||
});
|
});
|
||||||
|
|
||||||
obj = {
|
obj = {
|
||||||
|
|
||||||
voteStemName: item.valueSingle,
|
voteStemName: item.valueSingle,
|
||||||
optionDetailList: restList,
|
singleList: restList,
|
||||||
voteStemId: item.voteStemId,
|
orderNumber: item.orderNumber,
|
||||||
|
|
||||||
};
|
};
|
||||||
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;
|
||||||
@@ -226,40 +223,26 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 解散传值
|
// 解散传值
|
||||||
const parseItem = (arrr) => {
|
const parseItem = (arrSingle) => {
|
||||||
// const filterComObj = filterCommon(arr, "questionType");
|
console.log("arrSingle");
|
||||||
|
console.log(arrSingle);
|
||||||
let resultObj = {};
|
let resultObj = {};
|
||||||
// for (let key in filterComObj) {
|
|
||||||
// if (key === "1") {
|
|
||||||
// let arrSingle = arrr
|
|
||||||
//filterComObj[key];
|
|
||||||
console.log("arrr======", arrr);
|
|
||||||
/*
|
|
||||||
let arr = [];
|
let arr = [];
|
||||||
arrSingle.forEach((item) => {
|
arrSingle.forEach((item) => {
|
||||||
console.log("item======",item);
|
arr.push({
|
||||||
if (item.singleList.length) {
|
voteStemName: item.voteStemName,
|
||||||
item.singleList.forEach((itm) => {
|
orderNumber: item.orderNumber,
|
||||||
arr.push({
|
optionDetailList: item.singleList,
|
||||||
...itm,
|
});
|
||||||
optionName: item.optionName,
|
});
|
||||||
optionOrderNum: item.optionOrderNum,
|
resultObj.voteStemDtoList = arr;
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
resultObj.voteStemDtoList = arrr;
|
|
||||||
// }
|
|
||||||
console.log("resultObj======", resultObj);
|
console.log("resultObj======", resultObj);
|
||||||
// }
|
|
||||||
return resultObj;
|
return resultObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const handleTypes = () => {
|
const handleTypes = () => {
|
||||||
let obj = {
|
let obj = {
|
||||||
id: state.allFormsData.length,
|
id: state.allFormsData.length + 1,
|
||||||
valueSingle: "",
|
valueSingle: "",
|
||||||
singleList: [
|
singleList: [
|
||||||
{
|
{
|
||||||
@@ -275,107 +258,49 @@ export default {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
state.allFormsData.push(obj);
|
state.allFormsData.push(obj);
|
||||||
state.allFormsData1.push(obj);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDel = ({ id }) => {
|
const handleDel = ({ id, curItem }) => {
|
||||||
console.log('1234523432434234234', id, state.allFormsData)
|
console.log(888888888);
|
||||||
|
console.log(id);
|
||||||
|
console.log(curItem);
|
||||||
|
|
||||||
state.allFormsData.forEach((item, index) => {
|
state.allFormsData.forEach((item, index) => {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
console.log('oooooo', item)
|
|
||||||
state.allFormsData.splice(index, 1);
|
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) => {
|
api.deleteVoteStem(curItem.voteStemId).then((res) => {
|
||||||
// item.id = index + 1;
|
console.log(56444);
|
||||||
// return item;
|
console.log(res);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// 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 = () => {
|
const handleSave = () => {
|
||||||
|
|
||||||
|
|
||||||
let resultPost = {};
|
let resultPost = {};
|
||||||
|
let filterData = parseItem(restData(state.allFormsData));
|
||||||
|
|
||||||
let filterData = parseItem(restData(state.allFormsData1, "type"));
|
console.log("filterData==111", filterData);
|
||||||
|
|
||||||
console.log("filterData==111", filterData)
|
|
||||||
|
|
||||||
if (!state.ballotName) {
|
|
||||||
return message.warning("请输入投票名称");
|
|
||||||
}
|
|
||||||
// 校验s
|
|
||||||
|
|
||||||
// 校验
|
// 校验
|
||||||
|
if (!state.ballotName) {
|
||||||
|
message.warning("请输入投票名称");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!checkVal(filterData)) {
|
if (!checkVal(filterData)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// checkVal(filterData);
|
|
||||||
console.log(12121212);
|
console.log(12121212);
|
||||||
console.log(filterData);
|
console.log(filterData);
|
||||||
console.log('111111222223333----0000', state.ballotId)
|
console.log("111111222223333----0000", state.ballotId);
|
||||||
|
|
||||||
if (state.ballotId) {
|
if (state.ballotId) {
|
||||||
resultPost = {
|
resultPost = {
|
||||||
ballotId: state.ballotId,
|
ballotId: state.ballotId,
|
||||||
@@ -391,7 +316,7 @@ 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("编辑成功");
|
||||||
@@ -408,11 +333,10 @@ export default {
|
|||||||
"assessmentMaxScore",
|
"assessmentMaxScore",
|
||||||
"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("创建成功");
|
||||||
@@ -420,7 +344,6 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
const handleAllCancel = () => {
|
const handleAllCancel = () => {
|
||||||
state.allFormsData = [];
|
state.allFormsData = [];
|
||||||
@@ -447,7 +370,6 @@ export default {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
handleTypes,
|
handleTypes,
|
||||||
@@ -456,9 +378,6 @@ export default {
|
|||||||
handleDel,
|
handleDel,
|
||||||
afterVisibleChange,
|
afterVisibleChange,
|
||||||
closeDrawer,
|
closeDrawer,
|
||||||
edits,
|
|
||||||
delOption,
|
|
||||||
addOption
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
522
src/components/vote/VoteQuestion copy.vue
Normal file
522
src/components/vote/VoteQuestion copy.vue
Normal 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>
|
||||||
@@ -14,16 +14,37 @@
|
|||||||
<div class="inname">题干{{ item.id }}</div>
|
<div class="inname">题干{{ item.id }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<a-input v-model:value="curItem.valueSingle" placeholder="请输入题干名称" show-count :maxlength="20"
|
<a-input
|
||||||
style="border-radius: 8px" />
|
v-model:value="curItem.valueSingle"
|
||||||
|
placeholder="请输入题干名称"
|
||||||
|
show-count
|
||||||
|
:maxlength="20"
|
||||||
|
style="border-radius: 8px"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<VoteQuestionItem v-model:info="info" v-for="(item, index) in curItem.singleList" :key="index" :item="item"
|
<VoteQuestionItem
|
||||||
@input="input" @src="imgSrc" @delImg="delImg" @del="del" @edit="edit" />
|
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="name">
|
||||||
<div class="in" style="margin-left: 85px; margin-bottom: 20px">
|
<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;"
|
<a-button
|
||||||
@click="handleSingleAdd">
|
type="primary"
|
||||||
|
style="
|
||||||
|
width: 100px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background-color: #409eff;
|
||||||
|
"
|
||||||
|
@click="handleSingleAdd"
|
||||||
|
>
|
||||||
添加选项
|
添加选项
|
||||||
</a-button>
|
</a-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -31,41 +52,28 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import VoteQuestionItem from "./VoteQuestionItem.vue";
|
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
import VoteQuestionItem from "./VoteQuestionItem.vue";
|
||||||
import * as api from "../../api/indexVote";
|
import * as api from "../../api/indexVote";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CreateVote",
|
name: "CreateVote",
|
||||||
components: {
|
components: {
|
||||||
VoteQuestionItem,
|
VoteQuestionItem,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
num: {
|
|
||||||
type: Number,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
item: {
|
item: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const curItem = ref(props.item);
|
const curItem = ref(props.item);
|
||||||
|
|
||||||
const handleTypesDel = () => {
|
const handleTypesDel = () => {
|
||||||
|
emit("del", { id: curItem.value.id, curItem: curItem.value });
|
||||||
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 = () => {
|
const handleSingleAdd = () => {
|
||||||
@@ -74,10 +82,8 @@ export default {
|
|||||||
inputVal: "",
|
inputVal: "",
|
||||||
imgVal: "",
|
imgVal: "",
|
||||||
});
|
});
|
||||||
emit("addOption", curItem);
|
|
||||||
};
|
};
|
||||||
const input = ({ id, val }) => {
|
const input = ({ id, val }) => {
|
||||||
console.log(id, val)
|
|
||||||
curItem.value.singleList.forEach((item) => {
|
curItem.value.singleList.forEach((item) => {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
item.inputVal = val;
|
item.inputVal = val;
|
||||||
@@ -98,28 +104,22 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const del = ({ id, data }) => {
|
const del = ({ id, optionId }) => {
|
||||||
console.log(data)
|
|
||||||
api.deleteVoteStemOption(data.value.optionId)
|
|
||||||
.then(() => {
|
|
||||||
// message.success('删除题干信息成功')
|
|
||||||
emit("delOption", data);
|
|
||||||
})
|
|
||||||
curItem.value.singleList.forEach((item, index) => {
|
curItem.value.singleList.forEach((item, index) => {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
curItem.value.singleList.splice(index, 1);
|
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 {
|
return {
|
||||||
curItem,
|
curItem,
|
||||||
handleTypesDel,
|
handleTypesDel,
|
||||||
@@ -128,7 +128,6 @@ export default {
|
|||||||
imgSrc,
|
imgSrc,
|
||||||
delImg,
|
delImg,
|
||||||
del,
|
del,
|
||||||
edit
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -412,7 +411,8 @@ export default {
|
|||||||
//line-height: 24px;
|
//line-height: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-radio-wrapper {}
|
.ant-radio-wrapper {
|
||||||
|
}
|
||||||
|
|
||||||
.ant-input {
|
.ant-input {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
|||||||
495
src/components/vote/VoteQuestionItem copy.vue
Normal file
495
src/components/vote/VoteQuestionItem copy.vue
Normal 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>
|
||||||
@@ -7,27 +7,41 @@
|
|||||||
<div class="inname">选项{{ item.id }}</div>
|
<div class="inname">选项{{ item.id }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<a-input v-model:value="curItem.inputVal" show-count :maxlength="30" style="border-radius: 8px"
|
<a-input
|
||||||
@change="handleInput" />
|
v-model:value="curItem.inputVal"
|
||||||
|
show-count
|
||||||
|
:maxlength="30"
|
||||||
|
style="border-radius: 8px"
|
||||||
|
@change="handleInput"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="delete" @click="handleDel">删除</div>
|
<div class="delete" @click="handleDel">删除</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="name uploadContent">
|
<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>
|
<div class="addimg">+添加图片</div>
|
||||||
</a-upload>
|
</a-upload>
|
||||||
<div v-show="item.imgVal" class="picture" style="position: relative">
|
<div v-show="item.imgVal" class="picture" style="position: relative">
|
||||||
<img class="pictureimg" :src="item.imgVal" />
|
<img class="pictureimg" :src="item.imgVal" />
|
||||||
<div class="picturename" v-show="hasImgName">{{ hasImgName }}</div>
|
<div class="picturename" v-show="hasImgName">{{ hasImgName }}</div>
|
||||||
<img style="
|
<img
|
||||||
|
style="
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
" src="../../assets/images/basicinfo/close.png" @click="handleCancel" />
|
"
|
||||||
|
src="../../assets/images/basicinfo/close.png"
|
||||||
|
@click="handleCancel"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -53,14 +67,12 @@ export default {
|
|||||||
hasImgName: "",
|
hasImgName: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleInput = (value) => {
|
const handleInput = () => {
|
||||||
console.log(value.target.value)
|
emit("input", { id: curItem.value.id, val: curItem.value.inputVal });
|
||||||
emit("edit", curItem)
|
|
||||||
emit("input", { id: curItem.value.id, val: value.target.value });
|
|
||||||
};
|
};
|
||||||
const handleDel = () => {
|
const handleDel = () => {
|
||||||
handleCancel();
|
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 = () => {
|
const handleCancel = () => {
|
||||||
state.hasImgName = "";
|
state.hasImgName = "";
|
||||||
@@ -87,6 +99,7 @@ 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;
|
||||||
@@ -381,7 +394,8 @@ export default {
|
|||||||
//line-height: 24px;
|
//line-height: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-radio-wrapper {}
|
.ant-radio-wrapper {
|
||||||
|
}
|
||||||
|
|
||||||
.ant-input {
|
.ant-input {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
|||||||
@@ -1,86 +1,92 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-drawer :visible="addStemVisible"
|
<a-drawer
|
||||||
placement="right" class="custom-class"
|
:visible="addStemVisible"
|
||||||
@after-visible-change="afterVisibleChange"
|
placement="right"
|
||||||
@close="closeDrawer" width="60%">
|
class="custom-class"
|
||||||
<div>
|
@after-visible-change="afterVisibleChange"
|
||||||
<h2 style="text-align:center;">投票查看</h2>
|
@close="closeDrawer"
|
||||||
<div v-for="(item,index) in form" :key="item.voteStemId">
|
width="60%"
|
||||||
<div class="title">{{index+1}}. {{item.voteStemName}}</div>
|
>
|
||||||
<a-radio-group v-model:value="item.voteStemId">
|
<div>
|
||||||
<a-radio :value="3" :style="radioStyle">
|
<h2 style="text-align: center">投票查看</h2>
|
||||||
{{item.optionDetailList[0].optionName}}</a-radio>
|
<div v-for="(item, index) in form" :key="item.voteStemId">
|
||||||
<br />
|
<div class="title">{{ index + 1 }}. {{ item.voteStemName }}</div>
|
||||||
<a-radio :value="2" :style="radioStyle">
|
<a-radio-group v-model:value="item.voteStemId">
|
||||||
{{item.optionDetailList[1].optionName}}</a-radio>
|
<a-radio :value="3" :style="radioStyle">
|
||||||
</a-radio-group>
|
{{ item.optionDetailList[0].optionName }}</a-radio
|
||||||
</div>
|
>
|
||||||
|
<br />
|
||||||
</div>
|
<a-radio :value="2" :style="radioStyle">
|
||||||
</a-drawer>
|
{{ item.optionDetailList[1].optionName }}</a-radio
|
||||||
|
>
|
||||||
|
</a-radio-group>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { reactive, toRefs,ref } from "vue";
|
import { reactive, toRefs, ref } from "vue";
|
||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import * as api from "@/api/indexVote"
|
import * as api from "@/api/indexVote";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "queryStem",
|
name: "queryStem",
|
||||||
props: {
|
props: {
|
||||||
addStemVisible:{
|
addStemVisible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
setup(props,ctx) {
|
},
|
||||||
const value = ref(1);
|
setup(props, ctx) {
|
||||||
const state = reactive({
|
const value = ref(1);
|
||||||
form:[],
|
const state = reactive({
|
||||||
|
form: [],
|
||||||
});
|
|
||||||
const radioStyle = reactive({
|
|
||||||
display: 'flex',
|
|
||||||
height: '30px',
|
|
||||||
lineHeight: '30px',
|
|
||||||
});
|
});
|
||||||
const afterVisibleChange = (bool) => {
|
const radioStyle = reactive({
|
||||||
if(bool === true) {
|
display: "flex",
|
||||||
getStem()
|
height: "30px",
|
||||||
}
|
lineHeight: "30px",
|
||||||
}
|
});
|
||||||
const getStem = () => {
|
const afterVisibleChange = (bool) => {
|
||||||
let obj = {
|
if (bool === true) {
|
||||||
stemId:0,
|
getStem();
|
||||||
ballotId:2,
|
}
|
||||||
}
|
};
|
||||||
api.queryStemByStemId(obj).then((res) => {
|
const getStem = () => {
|
||||||
state.form = res.data.data
|
let obj = {
|
||||||
console.log(JSON.stringify(res.data)+'***');
|
stemId: 0,
|
||||||
message.success("投票获取成功");
|
ballotId: 2,
|
||||||
console.log(res);
|
};
|
||||||
}).catch((err) => {
|
api
|
||||||
message.error("投票获取失败"+err);
|
.queryStemByStemId(obj)
|
||||||
console.log(err);
|
.then((res) => {
|
||||||
})
|
state.form = res.data.data;
|
||||||
}
|
console.log(JSON.stringify(res.data) + "***");
|
||||||
const closeDrawer = () => {
|
message.success("投票获取成功");
|
||||||
ctx.emit("closeDrawer")
|
console.log(res);
|
||||||
}
|
})
|
||||||
return {
|
.catch((err) => {
|
||||||
...toRefs(state),
|
message.error("投票获取失败" + err);
|
||||||
afterVisibleChange,
|
console.log(err);
|
||||||
closeDrawer,
|
});
|
||||||
radioStyle,
|
};
|
||||||
value
|
const closeDrawer = () => {
|
||||||
}
|
ctx.emit("closeDrawer");
|
||||||
}
|
};
|
||||||
}
|
return {
|
||||||
|
...toRefs(state),
|
||||||
|
afterVisibleChange,
|
||||||
|
closeDrawer,
|
||||||
|
radioStyle,
|
||||||
|
value,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.title {
|
.title {
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@@ -57,19 +57,16 @@ export function deepCloneFilterString(obj, fillterKeys) {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sortBy(arr, ...keys) {
|
export function sortBy(arr, key) {
|
||||||
return arr.sort((x, y) => {
|
return arr.sort((x, y) => {
|
||||||
for (const key of keys) {
|
const valueX = parseInt(x[key]);
|
||||||
const valueX = typeof key === "function" ? key(x) : x[key];
|
const valueY = parseInt(y[key]);
|
||||||
const valueY = typeof key === "function" ? key(y) : y[key];
|
if (valueX > valueY) {
|
||||||
if (valueX > valueY) {
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
if (valueX < valueY) {
|
||||||
if (valueX < valueY) {
|
return -1;
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { reactive, toRefs, computed } from "vue";
|
import { reactive, toRefs, computed, getCurrentInstance } 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,6 +121,11 @@ 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: "", //编辑时候传
|
||||||
@@ -153,8 +158,8 @@ export default {
|
|||||||
];
|
];
|
||||||
sortBy(renderArr, "orderNumber"); //序号
|
sortBy(renderArr, "orderNumber"); //序号
|
||||||
state.allFormsData = parseData(renderArr, "questionType"); //类型
|
state.allFormsData = parseData(renderArr, "questionType"); //类型
|
||||||
// console.log("state.allFormsData");
|
console.log("state.allFormsData11111111111");
|
||||||
// console.log(state.allFormsData);
|
console.log(state.allFormsData);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getInfoDate();
|
getInfoDate();
|
||||||
@@ -360,7 +365,7 @@ export default {
|
|||||||
case 1:
|
case 1:
|
||||||
obj = {
|
obj = {
|
||||||
type,
|
type,
|
||||||
id: state.allFormsData.length,
|
id: state.allFormsData.length + 1,
|
||||||
valueSingle: "",
|
valueSingle: "",
|
||||||
singleList: [
|
singleList: [
|
||||||
{
|
{
|
||||||
@@ -374,7 +379,7 @@ export default {
|
|||||||
case 2:
|
case 2:
|
||||||
obj = {
|
obj = {
|
||||||
type,
|
type,
|
||||||
id: state.allFormsData.length,
|
id: state.allFormsData.length + 1,
|
||||||
valueMutil: "",
|
valueMutil: "",
|
||||||
mutilList: [
|
mutilList: [
|
||||||
{
|
{
|
||||||
@@ -388,7 +393,7 @@ export default {
|
|||||||
case 3:
|
case 3:
|
||||||
obj = {
|
obj = {
|
||||||
type,
|
type,
|
||||||
id: state.allFormsData.length,
|
id: state.allFormsData.length + 1,
|
||||||
valueAsk: "",
|
valueAsk: "",
|
||||||
valueAskDesc: "",
|
valueAskDesc: "",
|
||||||
};
|
};
|
||||||
@@ -396,7 +401,7 @@ export default {
|
|||||||
case 4:
|
case 4:
|
||||||
obj = {
|
obj = {
|
||||||
type,
|
type,
|
||||||
id: state.allFormsData.length,
|
id: state.allFormsData.length + 1,
|
||||||
valuePin: "",
|
valuePin: "",
|
||||||
minScore: 1,
|
minScore: 1,
|
||||||
maxScore: 10,
|
maxScore: 10,
|
||||||
@@ -412,15 +417,22 @@ 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) => {
|
state.allFormsData.forEach((item, index) => {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
state.allFormsData.splice(index, 1);
|
state.allFormsData.splice(index, 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
console.log(5656777777777);
|
||||||
|
console.log(state.allFormsData);
|
||||||
state.allFormsData.map((item, index) => {
|
state.allFormsData.map((item, index) => {
|
||||||
item.id = index + 1;
|
item.id = index + 1;
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
|
reload();
|
||||||
|
|
||||||
if (type === 1) {
|
if (type === 1) {
|
||||||
console.log(11111);
|
console.log(11111);
|
||||||
@@ -432,6 +444,7 @@ 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) {
|
||||||
@@ -444,6 +457,7 @@ 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) {
|
||||||
@@ -456,6 +470,7 @@ 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) {
|
||||||
@@ -468,6 +483,7 @@ export default {
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(56444);
|
console.log(56444);
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
reload();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
class="nameimg"
|
class="nameimg"
|
||||||
src="../../../assets/images/basicinfo/asterisk.png"
|
src="../../../assets/images/basicinfo/asterisk.png"
|
||||||
/>
|
/>
|
||||||
<div class="inname">标题</div>
|
<div class="inname">标题{{ curItem.id }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<a-input
|
<a-input
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
class="nameimg"
|
class="nameimg"
|
||||||
src="../../../assets/images/basicinfo/asterisk.png"
|
src="../../../assets/images/basicinfo/asterisk.png"
|
||||||
/>
|
/>
|
||||||
<div class="inname">标题</div>
|
<div class="inname">标题{{ curItem.id }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<a-input
|
<a-input
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
class="nameimg"
|
class="nameimg"
|
||||||
src="../../../assets/images/basicinfo/asterisk.png"
|
src="../../../assets/images/basicinfo/asterisk.png"
|
||||||
/>
|
/>
|
||||||
<div class="inname">标题</div>
|
<div class="inname">标题{{ curItem.id }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<a-input
|
<a-input
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
class="nameimg"
|
class="nameimg"
|
||||||
src="../../../assets/images/basicinfo/asterisk.png"
|
src="../../../assets/images/basicinfo/asterisk.png"
|
||||||
/>
|
/>
|
||||||
<div class="inname">标题</div>
|
<div class="inname">标题{{ curItem.id }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<a-input
|
<a-input
|
||||||
@@ -80,6 +80,15 @@ 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)) {
|
// if (state.typesCur.includes(types)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user