feat:合并

This commit is contained in:
王熙东
2022-11-17 09:26:30 +08:00
parent 8d0cb128a1
commit ea5384632d
6 changed files with 418 additions and 414 deletions

View File

@@ -97,7 +97,6 @@ export default {
}); });
const closeDrawer = () => { const closeDrawer = () => {
ctx.emit("update:assessmentVisible", false); ctx.emit("update:assessmentVisible", false);
}; };
const afterVisibleChange = (bool) => { const afterVisibleChange = (bool) => {
console.log("state getAllInvistText", bool); console.log("state getAllInvistText", bool);

View File

@@ -145,6 +145,9 @@ export default {
} }
const afterVisibleChange = (bool) => { const afterVisibleChange = (bool) => {
console.log("state", bool); console.log("state", bool);
state.assessmentId=null;
state.assessmentName="";
state.assessment=null;
}; };
const updateTask =()=>{ const updateTask =()=>{

View File

@@ -17,9 +17,9 @@
</div> </div>
<div style="display: flex; flex-direction: row"> <div style="display: flex; flex-direction: row">
<a-button style="width:100px;" <a-button style="width:100px;"
@click="()=>{isOuter = 1}" @click="changeOuter(1)"
:class="[isOuter == 1? 'outer' : '' ]">系统考试</a-button> :class="[isOuter == 1? 'outer' : '' ]">系统考试</a-button>
<a-button style="width:100px;" @click="()=>{isOuter = 2}" <a-button style="width:100px;" @click="changeOuter(2)"
:class="[isOuter == 2? 'outer' : '' ]" >外部考试</a-button> :class="[isOuter == 2? 'outer' : '' ]" >外部考试</a-button>
</div> </div>
<a-form <a-form
@@ -551,6 +551,10 @@ export default {
formState.questionArrangement = ""; formState.questionArrangement = "";
} }
} }
const changeOuter = (value) => {
console.log(value)
state.isOuter = value
}
return { return {
formState, formState,
afterVisibleChange, afterVisibleChange,
@@ -569,6 +573,7 @@ export default {
rules, rules,
updateTest, updateTest,
queryTest, queryTest,
changeOuter,
...toRefs(state) ...toRefs(state)
}; };
}, },

View File

@@ -40,7 +40,7 @@
/> />
<div class="votename">创建投票</div> <div class="votename">创建投票</div>
</div> </div>
<div class="votebtn">创建投票</div> <div class="votebtn" @click="showVoteDrawer">创建投票</div>
</div> </div>
<!-- 创建投票 --> <!-- 创建投票 -->
<!-- 起止时间 --> <!-- 起止时间 -->
@@ -135,6 +135,17 @@
</div> </div>
</div> </div>
</a-drawer> </a-drawer>
<a-drawer
v-model:visible="voteDrawerShow"
class="custom-class"
title="创建投票"
placement="right"
@after-visible-change="afterVoteVisibleChange"
>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
</a-drawer>
</template> </template>
<script> <script>
import { reactive, toRefs } from "vue"; import { reactive, toRefs } from "vue";
@@ -147,7 +158,9 @@ export default {
}, },
}, },
setup(props, ctx) { setup(props, ctx) {
const state = reactive({}); const state = reactive({
voteDrawerShow:false,
});
const closeDrawer = () => { const closeDrawer = () => {
ctx.emit("update:addvoteVisible", false); ctx.emit("update:addvoteVisible", false);
}; };
@@ -160,12 +173,20 @@ export default {
state.visible = true; state.visible = true;
}; };
const showVoteDrawer = () => {
state.voteDrawerShow = true;
}
const afterVoteVisibleChange = () => {
};
return { return {
...toRefs(state), ...toRefs(state),
afterVisibleChange, afterVisibleChange,
showDrawer, showDrawer,
closeDrawer, closeDrawer,
// change, // change,
showVoteDrawer,
afterVoteVisibleChange
}; };
}, },
}; };

View File

@@ -79,7 +79,7 @@
</div> </div>
<!-- 创建投票侧弹窗 --> <!-- 创建投票侧弹窗 -->
<div> <div>
<cre-vote <create-vote
v-model:crevoteVisible="crevotevisible" v-model:crevoteVisible="crevotevisible"
@getData="getStemId" @getData="getStemId"
v-model:ballotId="ballotId" v-model:ballotId="ballotId"
@@ -136,7 +136,7 @@
</template> </template>
<script> <script>
import { reactive, toRefs} from "vue"; import { reactive, toRefs} from "vue";
import CreVote from "./CreateVote.vue"; import CreateVote from "./CreateVote.vue";
import * as api from "../../api/indexVote"; import * as api from "../../api/indexVote";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import { RouterEditTask } from "@/api/indexTask"; import { RouterEditTask } from "@/api/indexTask";
@@ -147,7 +147,7 @@ import * as apiTask from "../../api/indexTaskadd";
export default { export default {
name: "AddVote", name: "AddVote",
components: { components: {
CreVote, CreateVote,
}, },
props: { props: {
addvoteVisible: { addvoteVisible: {

View File

@@ -1,209 +1,168 @@
<!-- 评估管理-创建评估页面 --> <!-- 评估管理-创建评估页面 -->
<template> <template>
<a-drawer <a-drawer :visible="createVoteVisible" class="drawerStyle createvoteDrawer" width="100%" placement="right"
:visible="createVoteVisible" @after-visible-change="afterVisibleChange">
class="drawerStyle createvoteDrawer" <div class="researchadd">
width="80%" <div class="header">
placement="right" <div class="headerTitle">创建投票</div>
@after-visible-change="afterVisibleChange" <img style="width: 29px; height: 29px; cursor: pointer" src="../../assets/images/basicinfo/close.png"
> @click="closeDrawer" />
<div class="researchadd"> </div>
<div class="header"> <div class="main_left">
<div class="headerTitle">创建投票</div> <div class="main_item">
<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="signbox">
<div class="sign"> <div class="sign">
<img <img src="@/assets/images/coursewareManage/asterisk.png" alt="" />
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 <a-input v-model:value="voteName" style="width: 424px; height: 32px" placeholder="请输入任务名称" maxlength="20" />
v-model:value="voteName"
style="width: 424px; height: 32px"
placeholder="请输入任务名称"
maxlength="20"
/>
</div> </div>
</div>
<div class="main_item">
<div class="signbox">
<div class="sign">
<img
src="@/assets/images/coursewareManage/asterisk.png"
alt=""
/>
</div> </div>
<span>创建题干</span> <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>
<div class="btnbox"> <div v-for="(item, index) in allFormsData" :key="index">
<button <VoteQuestion :item="item" :ballotId="ballotId" @del="handleDel" />
class="xkbtn"
@click="handleTypes"
>
创建题干
</button>
</div>
</div> <!-- 创建投票侧弹窗 -->
</div>
<div v-for="(item, index) in allFormsData" :key="index">
<VoteQuestion
:item="item"
:ballotId="ballotId"
@del="handleDel"
/>
</div>
<div class="footer"> </div>
<div class="btn">
<a-button <div class="footer">
type="primary" <div class="btn">
style="width: 100px;height: 40px;border-radius: 8px; background-color: #409eff;" <a-button type="primary" style="width: 100px;height: 40px;border-radius: 8px; background-color: #409eff;"
@click="handleSave" @click="handleSave">
> 保存
保存 </a-button>
</a-button> <a-button type="primary" ghost style="width: 100px;height: 40px;margin-left: 14px;border-radius: 8px;"
<a-button @click="handleAllCancel">
type="primary" 取消
ghost </a-button>
style="width: 100px;height: 40px;margin-left: 14px;border-radius: 8px;" </div>
@click="handleAllCancel" </div>
>
取消
</a-button>
</div> </div>
</div> </a-drawer>
</div>
</a-drawer>
</template> </template>
<script> <script>
import { reactive,toRefs} from "vue"; import { reactive, toRefs } from "vue";
// import { message } from "ant-design-vue"; // import { message } from "ant-design-vue";
// import { createResearch } from "../../api/indexResearch"; // import { createResearch } from "../../api/indexResearch";
import VoteQuestion from "./VoteQuestion.vue"; import VoteQuestion from "./VoteQuestion.vue";
import { import {
// sortBy, // sortBy,
traverseArr, traverseArr,
// filterCommon, // filterCommon,
// deepCloneFilterString, // deepCloneFilterString,
} from "../../utils/utils"; } from "../../utils/utils";
//import store from "@/store"; //import store from "@/store";
import { import * as api from "@/api/indexVote";
//createOptionMessage, import {} from "@/api/indexResearch";
queryStemByStemId
}from "@/api/indexVote";
import {
} from "@/api/indexResearch";
//import { message } from "ant-design-vue"; //import { message } from "ant-design-vue";
export default { export default {
name: "CreateVote", name: "CreateVote",
components: { components: {
VoteQuestion, VoteQuestion,
},
props: {
createVoteVisible: {
type: Boolean,
default: false,
}, },
ballotId: { props: {
type: Number, createVoteVisible: {
default: null, type: Boolean,
}, default: false,
editChild: { },
type: Boolean, ballotId: {
default: false, type: Number,
}, default: null,
},
}, editChild: {
setup(props,ctx) { type: Boolean,
const state = reactive({ default: false,
ballotId: "", },
ballotName: "",
allFormsData: [],
}); },
const afterVisibleChange = (bool) => { setup(props, ctx) {
console.log("state======进来creates", bool); const state = reactive({
handleTypes(); ballotId: "",
}; ballotName: "",
const closeDrawer = () => { allFormsData: [],
ctx.emit("update:createVoteVisible", false);
});
console.log("======关闭"); const afterVisibleChange = (bool) => {
} console.log("state======进来creates", bool);
// 详情 handleTypes();
const getInfoDate = async () => { };
if (props.editChild) { const closeDrawer = () => {
//stemId 多余字段 ctx.emit("update:createVoteVisible", false);
let res = await queryStemByStemId({stemId:0,
ballotId: state.ballotId, console.log("======关闭");
}).then((res) => {
if (res.data.code === 200) {
return res.data.data;
}
});
state.ballotName = res[0].ballotId;
let renderArr = [
...res,
];
// sortBy(renderArr, "orderNumber"); //序号
state.allFormsData = parseData(renderArr); //类型
// console.log("state.allFormsData");
// console.log(state.allFormsData);
} }
}; // 详情
getInfoDate(); const getInfoDate = async () => {
if (props.editChild) {
//stemId 多余字段
let res = await api.queryStemByStemId({
stemId: 0,
ballotId: state.ballotId,
}).then((res) => {
if (res.data.code === 200) {
return res.data.data;
}
});
state.ballotName = res[0].ballotId;
let renderArr = [
...res,
];
// sortBy(renderArr, "orderNumber"); //序号
state.allFormsData = parseData(renderArr); //类型
// console.log("state.allFormsData");
// console.log(state.allFormsData);
}
};
getInfoDate();
// 转换成前端格式 // 转换成前端格式
const parseData = (arr) => { const parseData = (arr) => {
const resultArr = []; const resultArr = [];
arr.forEach((item) => { arr.forEach((item) => {
let obj = {}; let obj = {};
let restList = traverseArr(item.optionDetailList, { let restList = traverseArr(item.optionDetailList, {
inputVal: "singleOptionName", inputVal: "singleOptionName",
imgVal: "singleOptionPictureAddress", imgVal: "singleOptionPictureAddress",
optionId: "singleOptionId", optionId: "singleOptionId",
}).map((itm, idx) => { }).map((itm, idx) => {
itm.id = idx + 1;
return itm;
});
obj = {
voteStemName: item.singleStemName,
singleList: restList,
};
resultArr.push(obj);
});
resultArr.map((itm, idx) => {
itm.id = idx + 1; itm.id = idx + 1;
return itm; return itm;
}); });
return resultArr;
obj = { };
voteStemName: item.singleStemName,
singleList: restList,
};
resultArr.push(obj);
});
resultArr.map((itm, idx) => {
itm.id = idx + 1;
return itm;
});
return resultArr;
};
/** /**
// 转换成后端格式 // 转换成后端格式
const restData = (arr, typeKey) => { const restData = (arr, typeKey) => {
@@ -334,168 +293,166 @@ setup(props,ctx) {
}; };
*/ */
const handleTypes = () => { const handleTypes = () => {
let obj = { let obj = {
id: state.allFormsData.length, id: state.allFormsData.length,
valueSingle: "", valueSingle: "",
singleList: [ singleList: [
{ {
id: 1, id: 1,
inputVal: "", inputVal: "",
imgVal: "", imgVal: "",
}, },
], ],
}; };
state.allFormsData.push(obj); state.allFormsData.push(obj);
console.log("state.allFormsData=====",state.allFormsData,state.allFormsData.length); console.log("state.allFormsData=====", state.allFormsData, state.allFormsData.length);
}; };
const handleDel = ({ id, curItem }) => {
state.allFormsData.forEach((item, index) => {
if (item.id === id) {
state.allFormsData.splice(index, 1);
}
});
state.allFormsData.map((item, index) => {
item.id = index + 1;
return item;
});
console.log("curItem.orderNumber", curItem.orderNumber);
const handleDel = ({ id ,curItem}) => {
state.allFormsData.forEach((item, index) => {
if (item.id === id) {
state.allFormsData.splice(index, 1);
}
});
state.allFormsData.map((item, index) => {
item.id = index + 1;
return item;
});
console.log("curItem.orderNumber",curItem.orderNumber);
// orderNumber: curItem.orderNumber, // orderNumber: curItem.orderNumber,
};
};
const handleSave = () => { const handleSave = () => {
/** /**
let resultPost = {}; let resultPost = {};
let filterData = parseItem(restData(state.allFormsData, "type")); let filterData = parseItem(restData(state.allFormsData, "type"));
// 校验 // 校验
if (!checkVal(filterData)) { if (!checkVal(filterData)) {
return false;
}
console.log(12121212);
console.log(filterData);
if (state.ballotId) {
resultPost = {
ballotId: state.ballotId,
ballotName: state.ballotName,
...filterData,
};
resultPost = deepCloneFilterString(resultPost, [
"assessmentMaxScore",
"assessmentMinScore",
]);
console.log(1212334);
console.log(resultPost);
editResearchMessage(resultPost).then((res) => {
if (res.data.code === 200) {
message.success("编辑成功");
router.push({
path: "/researchmanage",
});
}
});
} else {
resultPost = {
ballotName: state.ballotNameNew,
assessmentMark: state.valueMore,
...filterData,
};
resultPost = deepCloneFilterString(resultPost, [
"assessmentMaxScore",
"assessmentMinScore",
]);
createOptionMessage(resultPost).then((res) => {
if (res.data.code === 200) {
message.success("创建成功");
}
});
}
*/
};
const handleAllCancel = () => {
state.allFormsData = [];
};
/**
const checkVal = (filterData) => {
// 问答
if (
filterData.assessmentEssayQuestionDtoList &&
filterData.assessmentEssayQuestionDtoList.length
) {
let arr = filterData.assessmentEssayQuestionDtoList;
for (let item of arr) {
if (!item.assessmentQaTitle) {
message.error("问答题干为必填 请确认");
return false;
}
}
}
// 多选
if (
filterData.assessmentMultipleChoiceDtoList &&
filterData.assessmentMultipleChoiceDtoList.length
) {
let arr = filterData.assessmentMultipleChoiceDtoList;
for (let item of arr) {
if (!item.multipleStemName) {
message.error("多选题干为必填 请确认");
return false;
}
}
}
// 评分
if (
filterData.assessmentScoringQuestionDtoList &&
filterData.assessmentScoringQuestionDtoList.length
) {
let CountNum = 0;
let CountArr = filterData.assessmentScoringQuestionDtoList;
for (let item of CountArr) {
if (!item.assessmentScTitle) {
message.error("评分题干为必填 请确认");
return false;
}
CountNum += Number(item["weightScale"]);
}
if (CountNum !== 100) {
message.error("当前权重设置是百分制 请重新配置");
return false; return false;
} }
} console.log(12121212);
// 单选 console.log(filterData);
if (
filterData.assessmentSingleChoiceDtoList && if (state.ballotId) {
filterData.assessmentSingleChoiceDtoList.length resultPost = {
) { ballotId: state.ballotId,
let arr = filterData.assessmentSingleChoiceDtoList; ballotName: state.ballotName,
for (let item of arr) { ...filterData,
if (!item.singleStemName) { };
message.error("单选题干为必填 请确认"); resultPost = deepCloneFilterString(resultPost, [
"assessmentMaxScore",
"assessmentMinScore",
]);
console.log(1212334);
console.log(resultPost);
editResearchMessage(resultPost).then((res) => {
if (res.data.code === 200) {
message.success("编辑成功");
router.push({
path: "/researchmanage",
});
}
});
} else {
resultPost = {
ballotName: state.ballotNameNew,
assessmentMark: state.valueMore,
...filterData,
};
resultPost = deepCloneFilterString(resultPost, [
"assessmentMaxScore",
"assessmentMinScore",
]);
createOptionMessage(resultPost).then((res) => {
if (res.data.code === 200) {
message.success("创建成功");
}
});
}
*/
};
const handleAllCancel = () => {
state.allFormsData = [];
};
/**
const checkVal = (filterData) => {
// 问答
if (
filterData.assessmentEssayQuestionDtoList &&
filterData.assessmentEssayQuestionDtoList.length
) {
let arr = filterData.assessmentEssayQuestionDtoList;
for (let item of arr) {
if (!item.assessmentQaTitle) {
message.error("问答题干为必填 请确认");
return false;
}
}
}
// 多选
if (
filterData.assessmentMultipleChoiceDtoList &&
filterData.assessmentMultipleChoiceDtoList.length
) {
let arr = filterData.assessmentMultipleChoiceDtoList;
for (let item of arr) {
if (!item.multipleStemName) {
message.error("多选题干为必填 请确认");
return false;
}
}
}
// 评分
if (
filterData.assessmentScoringQuestionDtoList &&
filterData.assessmentScoringQuestionDtoList.length
) {
let CountNum = 0;
let CountArr = filterData.assessmentScoringQuestionDtoList;
for (let item of CountArr) {
if (!item.assessmentScTitle) {
message.error("评分题干为必填 请确认");
return false;
}
CountNum += Number(item["weightScale"]);
}
if (CountNum !== 100) {
message.error("当前权重设置是百分制 请重新配置");
return false; return false;
} }
} }
} // 单选
return true; if (
}; filterData.assessmentSingleChoiceDtoList &&
*/ filterData.assessmentSingleChoiceDtoList.length
) {
let arr = filterData.assessmentSingleChoiceDtoList;
for (let item of arr) {
if (!item.singleStemName) {
message.error("单选题干为必填 请确认");
return false;
}
}
}
return true;
};
*/
return { return {
...toRefs(state), ...toRefs(state),
handleTypes, handleTypes,
handleSave, handleSave,
handleAllCancel, handleAllCancel,
handleDel, handleDel,
afterVisibleChange, afterVisibleChange,
closeDrawer, closeDrawer,
}; };
}, },
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
@@ -508,6 +465,7 @@ setup(props,ctx) {
align-items: center; align-items: center;
flex-shrink: 0; flex-shrink: 0;
margin-bottom: 25px; margin-bottom: 25px;
.headerTitle { .headerTitle {
font-size: 18px; font-size: 18px;
font-weight: 600; font-weight: 600;
@@ -516,105 +474,123 @@ setup(props,ctx) {
margin-left: 24px; margin-left: 24px;
} }
} }
.main_left { .main_left {
padding-right: 30px; margin-left: 50px;
flex: 1; padding-right: 30px;
border-right: 1px solid #e8e8e8; flex: 1;
.main_item { border-right: 1px solid #e8e8e8;
.main_item {
display: flex;
align-items: center;
margin-bottom: 32px;
.signbox {
width: 120px;
display: flex; display: flex;
justify-content: end;
align-items: center; align-items: center;
margin-bottom: 32px;
.signbox { .sign {
width: 120px; 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; display: flex;
justify-content: end;
align-items: center; align-items: center;
.sign { padding: 3px 5px;
background-color: rgba(42, 103, 209, 0.4);
span {
margin-right: 5px; margin-right: 5px;
} }
}
.btnbox { .delBox {
display: flex; width: 13px;
flex: 1; height: 13px;
align-items: center; background-image: url(@/assets/images/basicinfo/ch.png);
.xkbtn { background-size: 100% 100%;
cursor: pointer; border-radius: 50%;
width: 130px;
height: 40px;
background: #388be1;
border-radius: 8px;
border: 0;
margin-right: 8px;
color: #fff;
margin-right: 10px;
} }
.fileTigan { }
}
}
.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; display: flex;
align-items: center; align-items: center;
padding: 3px 5px; flex-wrap: nowrap;
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 {
.btnbox2 {
display: flex; display: flex;
align-items: flex-start; flex-direction: column;
margin-bottom: 32px; justify-content: flex-start;
.signbox {
width: 120px; .xkbtn {
display: flex; cursor: pointer;
justify-content: end; width: 130px;
align-items: center; height: 40px;
.sign { background: #388be1;
margin-right: 5px; border-radius: 8px;
} border: 0;
} margin-right: 16px 8px 32px 0;
.kqszbox { color: #fff;
.qdqtbox { margin-top: 16px;
margin-left: 56px; margin-bottom: 60px;
}
.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;
}
} }
} }
}
} }
} }