mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 04:16:47 +08:00
任务抽屉样式修改
This commit is contained in:
347
src/components/drawers/ AssessmentList.vue
Normal file
347
src/components/drawers/ AssessmentList.vue
Normal file
@@ -0,0 +1,347 @@
|
|||||||
|
<template>
|
||||||
|
<a-drawer
|
||||||
|
:visible="assessmentVisible"
|
||||||
|
class="drawerStyle addinvistDrawer"
|
||||||
|
width="70%"
|
||||||
|
title="添加评估"
|
||||||
|
placement="right"
|
||||||
|
@after-visible-change="afterVisibleChange"
|
||||||
|
>
|
||||||
|
<div class="drawerMain">
|
||||||
|
<div class="header">
|
||||||
|
<div v-if="edit" class="headerTitle">编辑评估</div>
|
||||||
|
<div v-else class="headerTitle">添加评估</div>
|
||||||
|
<img
|
||||||
|
style="width: 29px; height: 29px; cursor: pointer"
|
||||||
|
src="../../assets/images/basicinfo/close.png"
|
||||||
|
@click="closeDrawer"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="contentMain">
|
||||||
|
<div class="main_left">
|
||||||
|
<div class="main_item">
|
||||||
|
<div class="fi_input">
|
||||||
|
<a-input
|
||||||
|
v-model:value="inputV1"
|
||||||
|
style="width: 424px; height: 40px"
|
||||||
|
placeholder="请输入评估名称"
|
||||||
|
maxlength="20"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="btns" @click="getAllInvistText">
|
||||||
|
<div class="search"></div>
|
||||||
|
<div class="btnText">搜索</div>
|
||||||
|
</div>
|
||||||
|
<div class="btnsn" @click="resetInvist">
|
||||||
|
<div class="search"></div>
|
||||||
|
<div class="btnText">重置</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="main_item2">
|
||||||
|
<a-table
|
||||||
|
style="border: 1px solid #f2f6fe"
|
||||||
|
:columns="tableDataFunc()"
|
||||||
|
:data-source="tableData"
|
||||||
|
:loading="tableDataTotal === -1 ? true : false"
|
||||||
|
expandRowByClick="true"
|
||||||
|
@expand="expandTable"
|
||||||
|
:pagination="false"
|
||||||
|
:row-selection="rowSelection"
|
||||||
|
filterMultiple:false
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="pa">
|
||||||
|
<a-pagination
|
||||||
|
showSizeChanger="true"
|
||||||
|
showQuickJumper="true"
|
||||||
|
hideOnSinglePage="true"
|
||||||
|
:pageSize="pageSize"
|
||||||
|
:current="currentPage"
|
||||||
|
:total="tableDataTotal"
|
||||||
|
class="pagination"
|
||||||
|
@change="handelChangePage"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</a-drawer>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { reactive, toRefs} from "vue";
|
||||||
|
import * as api from "../../api/indexInvist.js";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
export default {
|
||||||
|
name: "AssessmentList",
|
||||||
|
// components: {
|
||||||
|
// },
|
||||||
|
props: {
|
||||||
|
assessmentVisible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
setup(props, ctx) {
|
||||||
|
const state = reactive({
|
||||||
|
assessmentVisible:false,
|
||||||
|
assessment:null,
|
||||||
|
inputV1:"",
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
tableDataTotal: 0,
|
||||||
|
tableData: [],
|
||||||
|
selectedRowKeys:[],
|
||||||
|
});
|
||||||
|
const closeDrawer = () => {
|
||||||
|
ctx.emit("update:assessmentVisible", false);
|
||||||
|
|
||||||
|
};
|
||||||
|
const afterVisibleChange = (bool) => {
|
||||||
|
console.log("state getAllInvistText", bool);
|
||||||
|
if(props.assessmentVisible){
|
||||||
|
getAllInvistText();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
const tableDataFunc = () => {
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: "名称",
|
||||||
|
dataIndex: "name",
|
||||||
|
// width: "30%",
|
||||||
|
key: "name",
|
||||||
|
width: "150px",
|
||||||
|
align: "left",
|
||||||
|
className: "classify",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "题数",
|
||||||
|
dataIndex: "num",
|
||||||
|
key: "num",
|
||||||
|
width: "80px",
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "创建人",
|
||||||
|
dataIndex: "creator",
|
||||||
|
key: "creator",
|
||||||
|
width: "150px",
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "创建时间",
|
||||||
|
dataIndex: "time",
|
||||||
|
key: "time",
|
||||||
|
width: "200px",
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return columns;
|
||||||
|
};
|
||||||
|
const rowSelection = {
|
||||||
|
type: "radio",
|
||||||
|
onSelect:(selectedRows,)=>{
|
||||||
|
state.assessment = selectedRows;
|
||||||
|
console.log("selectedRows=======",state.assessment);
|
||||||
|
ctx.emit("checkedAss", state.assessment);
|
||||||
|
state.selectedRowKeys = [],
|
||||||
|
closeDrawer();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
const handelChangePage = (page, pageSize) => {
|
||||||
|
state.currentPage = page;
|
||||||
|
state.pageSize = pageSize;
|
||||||
|
getAllInvistText();
|
||||||
|
};
|
||||||
|
const getTableDate = (tableData) => {
|
||||||
|
let data = tableData;
|
||||||
|
let array = [];
|
||||||
|
data.map((value, index) => {
|
||||||
|
let obj = {
|
||||||
|
key: index,
|
||||||
|
assessmentId:value.assessmentId,
|
||||||
|
num: value.essayQuestionVoList.length,
|
||||||
|
name: value.assessmentName ? value.assessmentName : "-",
|
||||||
|
creator: value.createUser ? value.createUser : "-",
|
||||||
|
time: dayjs(value.createTime).format("YYYY-MM-DD"),
|
||||||
|
};
|
||||||
|
array.push(obj);
|
||||||
|
});
|
||||||
|
state.selectedRowKeys = [],
|
||||||
|
state.tableData = array;
|
||||||
|
};
|
||||||
|
//获取全部评估信息接口
|
||||||
|
const getAllInvistText = () => {
|
||||||
|
api
|
||||||
|
.queryAssessmentDetailList({
|
||||||
|
assessmentName:state.inputV1,
|
||||||
|
pageNo: state.currentPage,
|
||||||
|
pageSize: state.pageSize,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
let arr = res.data.data.rows;
|
||||||
|
if (res.status === 200) {
|
||||||
|
// console.log("获取全部评估信息", res.data.data);
|
||||||
|
getTableDate(arr);
|
||||||
|
state.tableDataTotal = Number(res.data.data.total);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log("获取全部评估信息接口失败", err);
|
||||||
|
// state.createLoading = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//重置评估信息
|
||||||
|
const resetInvist = () => {
|
||||||
|
state.inputV1 = "";
|
||||||
|
getAllInvistText();
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
...toRefs(state),
|
||||||
|
afterVisibleChange,
|
||||||
|
closeDrawer,
|
||||||
|
tableDataFunc,
|
||||||
|
rowSelection,
|
||||||
|
getAllInvistText,
|
||||||
|
resetInvist,
|
||||||
|
handelChangePage,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.ant-table-striped :deep(.table-striped) td {
|
||||||
|
background-color: #fafafa !important;
|
||||||
|
}
|
||||||
|
.addinvistDrawer {
|
||||||
|
.drawerMain {
|
||||||
|
.header {
|
||||||
|
height: 73px;
|
||||||
|
border-bottom: 1px solid #e8e8e8;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
.headerTitle {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 25px;
|
||||||
|
margin-left: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.contentMain {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
.main_left {
|
||||||
|
padding-right: 30px;
|
||||||
|
margin-top:32px;
|
||||||
|
.main_item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
.fi_input {
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
.btns {
|
||||||
|
margin-right: 20px;
|
||||||
|
padding: 0px 26px 0px 26px;
|
||||||
|
height: 38px;
|
||||||
|
background: #409eff;
|
||||||
|
border-radius: 8px;
|
||||||
|
//border: 1px solid rgba(64, 158, 255, 1);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-right: 14px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
.search {
|
||||||
|
width: 15px;
|
||||||
|
height: 17px;
|
||||||
|
background-image: url("../../assets/images/courseManage/search0.png");
|
||||||
|
background-size: 100% 100%;
|
||||||
|
}
|
||||||
|
.btnText {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #ffffff;
|
||||||
|
line-height: 36px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btnsn {
|
||||||
|
padding: 0px 26px 0px 26px;
|
||||||
|
height: 38px;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid rgba(64, 158, 255, 1);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-right: 14px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
.search {
|
||||||
|
width: 16px;
|
||||||
|
height: 18px;
|
||||||
|
background-image: url("../../assets/images/courseManage/reset1.png");
|
||||||
|
background-size: 100% 100%;
|
||||||
|
}
|
||||||
|
.btnText {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #409eff;
|
||||||
|
line-height: 36px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.main_item2 {
|
||||||
|
.pa {
|
||||||
|
width: 100%;
|
||||||
|
margin: 15px auto;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.main_btns {
|
||||||
|
height: 72px;
|
||||||
|
width: 100%;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.16);
|
||||||
|
.btn1 {
|
||||||
|
width: 100px;
|
||||||
|
height: 40px;
|
||||||
|
border: 1px solid #4ea6ff;
|
||||||
|
border-radius: 8px;
|
||||||
|
color: #4ea6ff;
|
||||||
|
background-color: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.btn2 {
|
||||||
|
cursor: pointer;
|
||||||
|
width: 100px;
|
||||||
|
height: 40px;
|
||||||
|
background: #4ea6ff;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 0;
|
||||||
|
margin-left: 15px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -503,6 +503,7 @@ export default {
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
.main_left {
|
.main_left {
|
||||||
|
margin-top:32px;
|
||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
border-right: 1px solid #e8e8e8;
|
border-right: 1px solid #e8e8e8;
|
||||||
|
|||||||
@@ -227,6 +227,7 @@
|
|||||||
}
|
}
|
||||||
.contentMain {
|
.contentMain {
|
||||||
.main_items {
|
.main_items {
|
||||||
|
margin-top:32px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
|
|||||||
@@ -294,6 +294,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
.main_left {
|
.main_left {
|
||||||
|
margin-top:32px;
|
||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
border-right: 1px solid #e8e8e8;
|
border-right: 1px solid #e8e8e8;
|
||||||
|
|||||||
@@ -316,6 +316,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
.main_left {
|
.main_left {
|
||||||
|
margin-top:32px;
|
||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
border-right: 1px solid #e8e8e8;
|
border-right: 1px solid #e8e8e8;
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ export default {
|
|||||||
// };
|
// };
|
||||||
const handleFinish = (values) => {
|
const handleFinish = (values) => {
|
||||||
console.log(values);
|
console.log(values);
|
||||||
updateWork(props.workId);
|
updteHomeWork();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFinishFailed = (errors) => {
|
const handleFinishFailed = (errors) => {
|
||||||
@@ -288,77 +288,40 @@ export default {
|
|||||||
console.log("state", bool);
|
console.log("state", bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateWork = () => {
|
|
||||||
state.addLoading = true;
|
|
||||||
if (props.edit) {
|
|
||||||
// 编辑任务
|
|
||||||
myUpdateWorkTaskUsing();
|
|
||||||
} else {
|
|
||||||
// 创建任务
|
|
||||||
console.log("创建任务***************");
|
|
||||||
myCreateWorkTask();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 新增任务
|
// 新增任务
|
||||||
const myCreateWorkTask = () => {
|
const updteHomeWork = () => {
|
||||||
let obj = {
|
let obj = {
|
||||||
createTime: "",
|
|
||||||
createUser: 0,
|
|
||||||
submitEndTime: dayjs(formState.choosedTime[1]).format("YYYY-MM-DD"),
|
submitEndTime: dayjs(formState.choosedTime[1]).format("YYYY-MM-DD"),
|
||||||
submitStartTime: dayjs(formState.choosedTime[0]).format("YYYY-MM-DD"),
|
submitStartTime: dayjs(formState.choosedTime[0]).format("YYYY-MM-DD"),
|
||||||
updateTime: "",
|
|
||||||
updateUser: 0,
|
|
||||||
workEnclosureAddress: "",
|
workEnclosureAddress: "",
|
||||||
workFlag: "",
|
workId: props.edit?props.EditWorkId:0,
|
||||||
workId: 0,
|
|
||||||
workName: formState.workName,
|
workName: formState.workName,
|
||||||
workRequirement: formState.workRequirement,
|
workRequirement: formState.workRequirement,
|
||||||
workTag: "",
|
|
||||||
};
|
};
|
||||||
createWorkTask(obj)
|
if(props.edit){
|
||||||
|
updateWorkTaskUsing(obj)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (props.isLevel) {
|
updateTask(res);
|
||||||
// 如果是关卡页面进入 ---------------------------------
|
closeDrawer();
|
||||||
myRouterEditTask(res.data.data.workId);
|
|
||||||
} else {
|
|
||||||
myProjectEditTask(res.data.data.workId);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
message.error(`添加失败${err}`);
|
message.error(`添加失败${err}`);
|
||||||
});
|
});
|
||||||
};
|
|
||||||
// 编辑任务
|
|
||||||
const myUpdateWorkTaskUsing = () => {
|
|
||||||
let editObj = {
|
|
||||||
createTime: "",
|
|
||||||
createUser: 0,
|
|
||||||
submitEndTime: dayjs(formState.choosedTime[1]).format("YYYY-MM-DD"),
|
|
||||||
submitStartTime: dayjs(formState.choosedTime[0]).format("YYYY-MM-DD"),
|
|
||||||
updateTime: "",
|
|
||||||
updateUser: 0,
|
|
||||||
workEnclosureAddress: "",
|
|
||||||
workFlag: "",
|
|
||||||
workId: props.EditWorkId,
|
|
||||||
workName: formState.workName,
|
|
||||||
workRequirement: formState.workRequirement,
|
|
||||||
workTag: "",
|
|
||||||
};
|
|
||||||
updateWorkTaskUsing(editObj)
|
|
||||||
.then((res) => {
|
|
||||||
console.log(res);
|
|
||||||
if (props.isLevel) {
|
|
||||||
// 如果是关卡页面进入 ---------------------------------
|
|
||||||
myRouterEditTask(res.data.data.workId);
|
|
||||||
}else{
|
}else{
|
||||||
myProjectEditTask(res.data.data.workId);
|
createWorkTask(obj)
|
||||||
}
|
.then((res) => {
|
||||||
|
updateTask(res);
|
||||||
|
closeDrawer();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
message.error(`编辑失败${err}`);
|
message.error(`添加失败${err}`);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 查询任务
|
// 查询任务
|
||||||
const queryWork = () => {
|
const queryWork = () => {
|
||||||
state.addLoading = true;
|
state.addLoading = true;
|
||||||
@@ -381,56 +344,48 @@ export default {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 新增编辑或新增项目任务
|
// 新增编辑或新增项目任务
|
||||||
const myProjectEditTask = (workId) => {
|
const updateTask = (res) => {
|
||||||
let editObj = {
|
if(props.isLevel){
|
||||||
courseId: workId,
|
|
||||||
duration: 60,
|
|
||||||
flag: true,
|
|
||||||
name: formState.workName,
|
|
||||||
projectId: props.projectId,
|
|
||||||
projectTaskId: props.projectTaskId || 0,
|
|
||||||
stageId: props.chooseStageId,
|
|
||||||
type: 4,
|
|
||||||
};
|
|
||||||
ProjectEditTask(editObj)
|
|
||||||
.then((res) => {
|
|
||||||
console.log(` 编辑项目成功的打印 ${res}`);
|
|
||||||
message.success(`${props.edit ? "编辑" : "新增"}阶段任务成功`);
|
|
||||||
ctx.emit("changeData", false);
|
|
||||||
state.addLoading = false;
|
|
||||||
closeDrawer();
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
message.error(`${props.edit ? "编辑" : "新增"}阶段任务失败`);
|
|
||||||
console.log(` 编辑项目失败的打印 ${err}`);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
// 新增编辑或新增关卡任务
|
|
||||||
const myRouterEditTask = (testId) => {
|
|
||||||
let editObj1 = {
|
let editObj1 = {
|
||||||
chapterId: props.isactive,
|
chapterId: props.isactive,
|
||||||
courseId: testId,
|
courseId: res.data.data.workId,
|
||||||
duration: 30,
|
name: res.data.data.workName,
|
||||||
flag: true,
|
|
||||||
name: formState.workName,
|
|
||||||
routerId: props.routerId,
|
routerId: props.routerId,
|
||||||
routerTaskId: props.routerTaskId || 0,
|
routerTaskId: props.routerTaskId || 0,
|
||||||
type: 4,
|
type: 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
RouterEditTask(editObj1)
|
RouterEditTask(editObj1)
|
||||||
.then((res) => {
|
.then(() => {
|
||||||
console.log(` 编辑关卡成功的打印 ${res}`);
|
|
||||||
message.success(`${props.edit ? "编辑" : "新增"}关卡任务成功`);
|
message.success(`${props.edit ? "编辑" : "新增"}关卡任务成功`);
|
||||||
ctx.emit("changeData", false);
|
ctx.emit("changeData", false);
|
||||||
state.addLoading = false;
|
state.addLoading = false;
|
||||||
closeDrawer();
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(() => {
|
||||||
message.error(`${props.edit ? "编辑" : "新增"}关卡任务失败`);
|
message.error(`${props.edit ? "编辑" : "新增"}关卡任务失败`);
|
||||||
console.log(` 编辑关卡失败的打印 ${err}`);
|
|
||||||
});
|
});
|
||||||
|
}else{
|
||||||
|
let editObj = {
|
||||||
|
courseId: res.data.data.workId,
|
||||||
|
name:res.data.data.workName,
|
||||||
|
projectId: props.edit?props.projectId:0,
|
||||||
|
projectTaskId: props.projectTaskId || 0,
|
||||||
|
stageId: props.chooseStageId,
|
||||||
|
type: 4,
|
||||||
};
|
};
|
||||||
|
ProjectEditTask(editObj)
|
||||||
|
.then(() => {
|
||||||
|
message.success(`${props.edit ? "编辑" : "新增"}阶段任务成功`);
|
||||||
|
ctx.emit("changeData", false);
|
||||||
|
state.addLoading = false;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
message.error(`${props.edit ? "编辑" : "新增"}阶段任务失败`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
afterVisibleChange,
|
afterVisibleChange,
|
||||||
@@ -446,7 +401,6 @@ export default {
|
|||||||
formRef,
|
formRef,
|
||||||
// layout,
|
// layout,
|
||||||
rules,
|
rules,
|
||||||
updateWork,
|
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -484,6 +438,7 @@ export default {
|
|||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
border-right: 1px solid #e8e8e8;
|
border-right: 1px solid #e8e8e8;
|
||||||
|
margin-top:32px;
|
||||||
|
|
||||||
.main_item {
|
.main_item {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -18,71 +18,60 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="contentMain">
|
<div class="contentMain">
|
||||||
|
<div class="main">
|
||||||
<div class="main_left">
|
<div class="main_left">
|
||||||
|
<div class="main_notice">
|
||||||
|
<div class="mntc_left">
|
||||||
|
<div class="notice_icon"></div>
|
||||||
|
<div v-if="assessment==null">
|
||||||
|
<span class="title">已选择 <span class ="data">0</span> 条</span>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<span class="title">已选择 <span class ="data">1</span> 条;</span>
|
||||||
|
<span class="title">名称: <span class ="data">{{assessment.name}}</span> </span>
|
||||||
|
<span class="title">题数: <span class ="data">{{assessment.num}}</span> </span>
|
||||||
|
<span class="title">创建人: <span class ="data">{{assessment.creator}}</span> </span>
|
||||||
|
<span class="title">创建时间: <span class ="data">{{assessment.time}}</span> </span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
<div class="main_item">
|
<div class="main_item">
|
||||||
<div class="fi_input">
|
<div class="fi_input">
|
||||||
<a-input
|
|
||||||
v-model:value="inputV1"
|
|
||||||
style="width: 424px; height: 40px"
|
|
||||||
placeholder="请输入评估名称"
|
|
||||||
maxlength="20"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="btns" @click="getAllInvistText">
|
|
||||||
<div class="search"></div>
|
|
||||||
<div class="btnText">搜索</div>
|
|
||||||
</div>
|
|
||||||
<div class="btnsn" @click="resetInvist">
|
|
||||||
<div class="search"></div>
|
|
||||||
<div class="btnText">重置</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="main_item2">
|
|
||||||
<a-table
|
|
||||||
style="border: 1px solid #f2f6fe"
|
|
||||||
:columns="tableDataFunc()"
|
|
||||||
:data-source="tableData"
|
|
||||||
:loading="tableDataTotal === -1 ? true : false"
|
|
||||||
expandRowByClick="true"
|
|
||||||
@expand="expandTable"
|
|
||||||
:pagination="false"
|
|
||||||
:row-selection="rowSelection"
|
|
||||||
filterMultiple:false
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div class="pa">
|
<div class="btns" @click="checkAssDrawer">
|
||||||
<a-pagination
|
<div class="search"></div>
|
||||||
showSizeChanger="true"
|
<div class="btnText">选择评估</div>
|
||||||
showQuickJumper="true"
|
<div class="main_item2">
|
||||||
hideOnSinglePage="true"
|
<AssessmentList
|
||||||
:pageSize="pageSize"
|
v-model:assessmentVisible="assessmentVisible"
|
||||||
:current="currentPage"
|
@checkedAss="getCheckedAss"/>
|
||||||
:total="tableDataTotal"
|
|
||||||
class="pagination"
|
|
||||||
@change="handelChangePage"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="main_btns">
|
<div class="main_btns">
|
||||||
<button class="btn1" @click="closeDrawer">取消</button>
|
<button class="btn1" @click="closeDrawer">取消</button>
|
||||||
<button class="btn2" @click="updateTask">确定</button>
|
<button class="btn2" @click="updateTask">确定</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { reactive, toRefs, onMounted } from "vue";
|
import { reactive, toRefs} from "vue";
|
||||||
import * as api from "../../api/indexInvist.js";
|
|
||||||
import * as apiTask from "../../api/indexTaskadd";
|
import * as apiTask from "../../api/indexTaskadd";
|
||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import dayjs from "dayjs";
|
import AssessmentList from "./ AssessmentList.vue";
|
||||||
import { RouterEditTask } from "@/api/indexTask";
|
import { RouterEditTask } from "@/api/indexTask";
|
||||||
export default {
|
export default {
|
||||||
name: "AddInvist",
|
name: "AddInvist",
|
||||||
// components: {
|
components: {
|
||||||
// },
|
AssessmentList,
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
addinvistVisible: {
|
addinvistVisible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -134,118 +123,36 @@ export default {
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
tableDataTotal: 0,
|
tableDataTotal: 0,
|
||||||
tableData: [
|
tableData: [
|
||||||
|
|
||||||
],
|
],
|
||||||
assessmentId:null,
|
assessmentId:null,
|
||||||
assessmentName:"",
|
assessmentName:"",
|
||||||
|
assessment:null,
|
||||||
|
assessmentVisible:false,
|
||||||
|
|
||||||
});
|
});
|
||||||
|
const getCheckedAss = (ass) =>{
|
||||||
|
state.assessment = ass
|
||||||
|
console.log("checed===",state.assessment);
|
||||||
|
}
|
||||||
const closeDrawer = () => {
|
const closeDrawer = () => {
|
||||||
ctx.emit("update:addinvistVisible", false);
|
ctx.emit("update:addinvistVisible", false);
|
||||||
ctx.emit("update:edit", false);
|
ctx.emit("update:edit", false);
|
||||||
state.inputV1 = "";
|
state.inputV1 = "";
|
||||||
};
|
};
|
||||||
|
const checkAssDrawer =() =>{
|
||||||
|
state.assessmentVisible = true;
|
||||||
|
}
|
||||||
const afterVisibleChange = (bool) => {
|
const afterVisibleChange = (bool) => {
|
||||||
console.log("state", bool);
|
console.log("state", bool);
|
||||||
};
|
};
|
||||||
const tableDataFunc = () => {
|
|
||||||
const columns = [
|
|
||||||
{
|
|
||||||
title: "名称",
|
|
||||||
dataIndex: "name",
|
|
||||||
// width: "30%",
|
|
||||||
key: "name",
|
|
||||||
width: "150px",
|
|
||||||
align: "left",
|
|
||||||
className: "classify",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "题数",
|
|
||||||
dataIndex: "num",
|
|
||||||
key: "num",
|
|
||||||
width: "80px",
|
|
||||||
align: "center",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "创建人",
|
|
||||||
dataIndex: "creator",
|
|
||||||
key: "creator",
|
|
||||||
width: "150px",
|
|
||||||
align: "center",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "创建时间",
|
|
||||||
dataIndex: "time",
|
|
||||||
key: "time",
|
|
||||||
width: "200px",
|
|
||||||
align: "center",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
return columns;
|
|
||||||
};
|
|
||||||
const rowSelection = {
|
|
||||||
type: "radio",
|
|
||||||
onSelect: (selectedRows, selected, selectedRowKeys) => {
|
|
||||||
console.log(
|
|
||||||
"selectedRowKeys",selectedRowKeys,"selectedRows",selectedRows, "selected",selected );
|
|
||||||
console.log(selectedRows.assessmentId);
|
|
||||||
state.assessmentId =selectedRows.assessmentId;
|
|
||||||
state.assessmentName = selectedRows.name;
|
|
||||||
},
|
|
||||||
|
|
||||||
};
|
|
||||||
const handelChangePage = (page, pageSize) => {
|
|
||||||
state.currentPage = page;
|
|
||||||
state.pageSize = pageSize;
|
|
||||||
getAllInvistText();
|
|
||||||
};
|
|
||||||
const getTableDate = (tableData) => {
|
|
||||||
let data = tableData;
|
|
||||||
let array = [];
|
|
||||||
data.map((value, index) => {
|
|
||||||
let obj = {
|
|
||||||
key: index,
|
|
||||||
assessmentId:value.assessmentId,
|
|
||||||
num: value.essayQuestionVoList.length,
|
|
||||||
name: value.assessmentName ? value.assessmentName : "-",
|
|
||||||
creator: value.createUser ? value.createUser : "-",
|
|
||||||
time: dayjs(value.createTime).format("YYYY-MM-DD"),
|
|
||||||
};
|
|
||||||
array.push(obj);
|
|
||||||
});
|
|
||||||
state.tableData = array;
|
|
||||||
};
|
|
||||||
//获取全部评估信息接口
|
|
||||||
const getAllInvistText = () => {
|
|
||||||
|
|
||||||
api
|
|
||||||
.queryAssessmentDetailList({
|
|
||||||
assessmentName:state.inputV1,
|
|
||||||
pageNo: state.currentPage,
|
|
||||||
pageSize: state.pageSize,
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
let arr = res.data.data.rows;
|
|
||||||
if (res.status === 200) {
|
|
||||||
// console.log("获取全部评估信息", res.data.data);
|
|
||||||
getTableDate(arr);
|
|
||||||
state.tableDataTotal = Number(res.data.data.total);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log("获取全部评估信息接口失败", err);
|
|
||||||
// state.createLoading = false;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const updateTask =()=>{
|
const updateTask =()=>{
|
||||||
console.log("jinlaile=================",state.assessmentName)
|
console.log("jinlaile=================",state.assessment.assessmentName)
|
||||||
if(props.isLevel){
|
if(props.isLevel){
|
||||||
RouterEditTask({
|
RouterEditTask({
|
||||||
chapterId: props.isactive,
|
chapterId: props.isactive,
|
||||||
courseId: state.assessmentId,
|
courseId: state.assessment.assessmentId,
|
||||||
name: state.assessmentName,
|
name: state.assessment.assessmentName,
|
||||||
routerId: props.routerId,
|
routerId: props.routerId,
|
||||||
routerTaskId: props.routerTaskId || 0,
|
routerTaskId: props.routerTaskId || 0,
|
||||||
type: 11,
|
type: 11,
|
||||||
@@ -264,8 +171,8 @@ export default {
|
|||||||
console.log("=========projectTaskId",props.projectTaskId);
|
console.log("=========projectTaskId",props.projectTaskId);
|
||||||
apiTask
|
apiTask
|
||||||
.addTask({
|
.addTask({
|
||||||
courseId: state.assessmentId,
|
courseId: state.assessment.assessmentId,
|
||||||
name: state.assessmentName,
|
name: state.assessment.assessmentName,
|
||||||
projectId: props.projectId,
|
projectId: props.projectId,
|
||||||
projectTaskId: props.projectTaskId || 0,
|
projectTaskId: props.projectTaskId || 0,
|
||||||
stageId: props.chooseStageId,
|
stageId: props.chooseStageId,
|
||||||
@@ -282,25 +189,15 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//重置评估信息
|
|
||||||
const resetInvist = () => {
|
|
||||||
state.inputV1 = "";
|
|
||||||
getAllInvistText();
|
|
||||||
};
|
|
||||||
onMounted(() => {
|
|
||||||
// createInvist();
|
|
||||||
getAllInvistText();
|
|
||||||
});
|
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
afterVisibleChange,
|
afterVisibleChange,
|
||||||
closeDrawer,
|
closeDrawer,
|
||||||
tableDataFunc,
|
|
||||||
rowSelection,
|
|
||||||
getAllInvistText,
|
|
||||||
updateTask,
|
updateTask,
|
||||||
resetInvist,
|
AssessmentList,
|
||||||
handelChangePage,
|
checkAssDrawer,
|
||||||
|
getCheckedAss,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -328,14 +225,18 @@ export default {
|
|||||||
.contentMain {
|
.contentMain {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
.main{
|
||||||
|
width:100%;
|
||||||
.main_left {
|
.main_left {
|
||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
|
margin-top:32px;
|
||||||
.main_item {
|
.main_item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 32px;
|
margin-bottom: 64px;
|
||||||
.fi_input {
|
.fi_input {
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
|
|
||||||
}
|
}
|
||||||
.btns {
|
.btns {
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
@@ -391,19 +292,45 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.main_item2 {
|
.main_notice {
|
||||||
.pa {
|
|
||||||
width: 100%;
|
|
||||||
margin: 15px auto;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
height: 40px;
|
||||||
|
background-color: #e9f6fe;
|
||||||
|
.mntc_left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.title{
|
||||||
|
color: rgba(0, 0, 0, 0.65);
|
||||||
|
margin-right: 17px
|
||||||
|
}
|
||||||
|
.data{
|
||||||
|
color: #388be1
|
||||||
|
}
|
||||||
|
.notice_icon {
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
margin-right: 9px;
|
||||||
|
margin-left: 9px;
|
||||||
|
background-image: url(@/assets/images/coursewareManage/gan.png);
|
||||||
|
background-size: 100% 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.mntc_right {
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
.main_btns {
|
.main_btns {
|
||||||
height: 72px;
|
height: 72px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin-top: 180px;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -698,6 +698,7 @@ export default {
|
|||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
border-right: 1px solid #e8e8e8;
|
border-right: 1px solid #e8e8e8;
|
||||||
|
margin-top:32px;
|
||||||
.main_item {
|
.main_item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -134,10 +134,7 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
EditWorkId: { // 要编辑的workId
|
|
||||||
type: Number,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
projectTaskId: { // 要编辑的projectId
|
projectTaskId: { // 要编辑的projectId
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
@@ -315,6 +312,7 @@ export default {
|
|||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
border-right: 1px solid #e8e8e8;
|
border-right: 1px solid #e8e8e8;
|
||||||
|
margin-top:32px;
|
||||||
.main_item {
|
.main_item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -207,22 +207,7 @@ import {createExamination,queryExaminationDetailById,updateExamination} from "@/
|
|||||||
import { ProjectEditTask, RouterEditTask } from "@/api/indexTask"
|
import { ProjectEditTask, RouterEditTask } from "@/api/indexTask"
|
||||||
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
const rowSelection = ref({
|
|
||||||
checkStrictly: false,
|
|
||||||
onChange: (selectedRowKeys, selectedRows) => {
|
|
||||||
console.log(
|
|
||||||
`selectedRowKeys: ${selectedRowKeys}`,
|
|
||||||
"selectedRows: ",
|
|
||||||
selectedRows
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onSelect: (record, selected, selectedRows) => {
|
|
||||||
console.log(record, selected, selectedRows);
|
|
||||||
},
|
|
||||||
onSelectAll: (selected, selectedRows, changeRows) => {
|
|
||||||
console.log(selected, selectedRows, changeRows);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
export default {
|
export default {
|
||||||
name: "AddTest",
|
name: "AddTest",
|
||||||
// components: {
|
// components: {
|
||||||
@@ -460,118 +445,51 @@ export default {
|
|||||||
}
|
}
|
||||||
const updateTest = () => {
|
const updateTest = () => {
|
||||||
state.addLoading = true;
|
state.addLoading = true;
|
||||||
if(props.edit) { // 编辑任务
|
|
||||||
myUpdateExamination()
|
|
||||||
}else { // 创建任务
|
|
||||||
myCreateExamination()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const myUpdateExamination = () => {
|
|
||||||
let obj = {
|
let obj = {
|
||||||
"createTime": "",
|
|
||||||
"createUser": 0,
|
|
||||||
"examinationDuration": formState.examinationDuration,
|
"examinationDuration": formState.examinationDuration,
|
||||||
"examinationEndTime": dayjs(formState.choosedTime[1]).format("YYYY-MM-DD"),
|
"examinationEndTime": dayjs(formState.choosedTime[1]).format("YYYY-MM-DD"),
|
||||||
"examinationExplain": formState.examinationExplain,
|
"examinationExplain": formState.examinationExplain,
|
||||||
"examinationFlag": "",
|
"examinationId": props.edit?props.EditTestId : 0,
|
||||||
"examinationId": props.EditTestId,
|
|
||||||
"examinationLimit": formState.examinationLimit,
|
"examinationLimit": formState.examinationLimit,
|
||||||
"examinationName": formState.examinationName,
|
"examinationName": formState.examinationName,
|
||||||
"examinationPaperId": 0,
|
"examinationPaperId": 0,
|
||||||
"examinationPaperName": formState.choosedTest,
|
"examinationPaperName": formState.choosedTest,
|
||||||
"examinationStartTime": dayjs(formState.choosedTime[0]).format("YYYY-MM-DD"),
|
"examinationStartTime": dayjs(formState.choosedTime[0]).format("YYYY-MM-DD"),
|
||||||
"examinationTag": "",
|
|
||||||
"passLine": formState.passLine,
|
"passLine": formState.passLine,
|
||||||
"questionArrangement": formState.questionArrangement,
|
"questionArrangement": formState.questionArrangement,
|
||||||
"scoringModel": formState.scoringModel,
|
"scoringModel": formState.scoringModel,
|
||||||
"showAnalysis": formState.showAnalysis,
|
"showAnalysis": formState.showAnalysis,
|
||||||
"showAnswers": formState.showAnswers,
|
"showAnswers": formState.showAnswers,
|
||||||
"updateTime": "",
|
|
||||||
"updateUser": 0
|
|
||||||
}
|
|
||||||
updateExamination(obj).then((res)=>{
|
|
||||||
console.log(res);
|
|
||||||
// 如果是关卡页面进入 ---------------------------------
|
|
||||||
if(props.isLevel) {
|
|
||||||
myRouterEditTask(res.data.data.examinationId)
|
|
||||||
}else {
|
|
||||||
myProjectEditTask(res.data.data.examinationId)
|
|
||||||
}
|
}
|
||||||
|
if(props.edit) { // 编辑任务
|
||||||
|
updateExamination(obj)
|
||||||
|
.then((res)=>{
|
||||||
|
updateTask(res);
|
||||||
|
closeDrawer();
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
message.error(`编辑失败`)
|
message.error(`编辑失败`)
|
||||||
})
|
});
|
||||||
|
}else { // 创建任务
|
||||||
}
|
createExamination(obj)
|
||||||
const myCreateExamination = () => {
|
.then((res)=>{
|
||||||
let obj = {
|
updateTask(res);
|
||||||
"createTime": "",
|
|
||||||
"createUser": 0,
|
|
||||||
"examinationDuration": formState.examinationDuration,
|
|
||||||
"examinationEndTime": dayjs(formState.choosedTime[1]).format("YYYY-MM-DD"),
|
|
||||||
"examinationExplain": formState.examinationExplain,
|
|
||||||
"examinationFlag": "",
|
|
||||||
"examinationId": 0,
|
|
||||||
"examinationLimit": formState.examinationLimit,
|
|
||||||
"examinationName": formState.examinationName,
|
|
||||||
"examinationPaperId": 0,
|
|
||||||
"examinationPaperName": formState.choosedTest,
|
|
||||||
"examinationStartTime": dayjs(formState.choosedTime[0]).format("YYYY-MM-DD"),
|
|
||||||
"examinationTag": "",
|
|
||||||
"passLine": formState.passLine,
|
|
||||||
"questionArrangement": formState.questionArrangement,
|
|
||||||
"scoringModel": formState.scoringModel,
|
|
||||||
"showAnalysis": formState.showAnalysis,
|
|
||||||
"showAnswers": formState.showAnswers,
|
|
||||||
"updateTime": "",
|
|
||||||
"updateUser": 0
|
|
||||||
}
|
|
||||||
createExamination(obj).then((res)=>{
|
|
||||||
if(props.isLevel) {
|
|
||||||
myRouterEditTask(res.data.data.examinationId)
|
|
||||||
}else {
|
|
||||||
myProjectEditTask(res.data.data.examinationId)
|
|
||||||
}
|
|
||||||
}).catch((err)=>{
|
|
||||||
message.error(`添加失败${err}`)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const myProjectEditTask = (testId) => {
|
|
||||||
let editObj = {
|
|
||||||
"courseId": testId,
|
|
||||||
"duration": 50,
|
|
||||||
"flag": true,
|
|
||||||
"name": formState.examinationName,
|
|
||||||
"projectId": props.projectId,
|
|
||||||
"projectTaskId": props.projectTaskId || null,
|
|
||||||
"stageId": props.chooseStageId,
|
|
||||||
"type": 5
|
|
||||||
}
|
|
||||||
// 新增编辑或新增项目
|
|
||||||
ProjectEditTask(editObj).then(res => {
|
|
||||||
console.log(` 编辑项目成功的打印 ${res}`);
|
|
||||||
message.success(`${props.EditTestId? '编辑' : '新增'}阶段任务成功`)
|
|
||||||
ctx.emit("changeData", false);
|
|
||||||
state.addLoading = false;
|
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
}).catch(err => {
|
}).catch(()=>{
|
||||||
message.error(`${props.EditTestId? '编辑' : '新增'}阶段任务失败`)
|
message.error(`编辑失败`)
|
||||||
console.log(` 编辑项目失败的打印 ${err}`);
|
});
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const myRouterEditTask = (testId) => {
|
const updateTask = (res) => {
|
||||||
|
if(props.isLevel){
|
||||||
let editObj1 = {
|
let editObj1 = {
|
||||||
"chapterId": props.isactive,
|
"chapterId": props.isactive,
|
||||||
"courseId": testId,
|
"courseId": res.data.data.examinationId,
|
||||||
"duration": 30,
|
"name": res.data.data.examinationName,
|
||||||
"flag": true,
|
|
||||||
"name": formState.examinationName,
|
|
||||||
"routerId": props.routerId,
|
"routerId": props.routerId,
|
||||||
"routerTaskId": props.routerTaskId || 0,
|
"routerTaskId": props.routerTaskId || 0,
|
||||||
"type": 5
|
"type": 5
|
||||||
}
|
}
|
||||||
|
|
||||||
RouterEditTask(editObj1).then(res => {
|
RouterEditTask(editObj1).then(res => {
|
||||||
console.log(` 编辑关卡成功的打印 ${res}`);
|
console.log(` 编辑关卡成功的打印 ${res}`);
|
||||||
message.success(`${props.edit ? '编辑' : '新增'}关卡任务成功`)
|
message.success(`${props.edit ? '编辑' : '新增'}关卡任务成功`)
|
||||||
@@ -581,7 +499,26 @@ export default {
|
|||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
message.error(`${props.edit ? '编辑' : '新增'}关卡任务失败`)
|
message.error(`${props.edit ? '编辑' : '新增'}关卡任务失败`)
|
||||||
console.log(` 编辑关卡失败的打印 ${err}`);
|
console.log(` 编辑关卡失败的打印 ${err}`);
|
||||||
})
|
});
|
||||||
|
}else{
|
||||||
|
let editObj = {
|
||||||
|
"courseId": res.data.data.examinationId,
|
||||||
|
"duration": 0,
|
||||||
|
"name": res.data.data.examinationName,
|
||||||
|
"projectId": props.projectId,
|
||||||
|
"projectTaskId": props.projectTaskId || 0,
|
||||||
|
"stageId": props.chooseStageId,
|
||||||
|
"type": 5
|
||||||
|
}
|
||||||
|
// 新增编辑或新增项目
|
||||||
|
ProjectEditTask(editObj).then(() => {
|
||||||
|
message.success(`${props.EditTestId? '编辑' : '新增'}阶段任务成功`)
|
||||||
|
ctx.emit("changeData", false);
|
||||||
|
}).catch(() => {
|
||||||
|
message.error(`${props.EditTestId? '编辑' : '新增'}阶段任务失败`)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const cloradio1 = (value) => {
|
const cloradio1 = (value) => {
|
||||||
@@ -608,7 +545,6 @@ export default {
|
|||||||
formState,
|
formState,
|
||||||
afterVisibleChange,
|
afterVisibleChange,
|
||||||
closeDrawer,
|
closeDrawer,
|
||||||
rowSelection,
|
|
||||||
cloradio1,
|
cloradio1,
|
||||||
cloradio2,
|
cloradio2,
|
||||||
cloradio3,
|
cloradio3,
|
||||||
|
|||||||
@@ -75,8 +75,7 @@
|
|||||||
<cre-vote
|
<cre-vote
|
||||||
v-model:crevoteVisible="crevotevisible"
|
v-model:crevoteVisible="crevotevisible"
|
||||||
@getData="getStemId"
|
@getData="getStemId"
|
||||||
v-model:voteStemId="voteStemId"
|
v-model:ballotId="ballotId"
|
||||||
v-model:editStem="editStem"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 创建投票侧弹窗 -->
|
<!-- 创建投票侧弹窗 -->
|
||||||
@@ -122,42 +121,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="main_btns">
|
<div class="main_btns">
|
||||||
<button class="btn1">取消</button>
|
<button class="btn1" @click="closeDrawer()">取消</button>
|
||||||
<button class="btn2" @click="creoredi()">确定</button>
|
<button class="btn2" @click="updateVoteInfo()">确定</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { reactive, toRefs, ref } from "vue";
|
import { reactive, toRefs} from "vue";
|
||||||
import CreVote from "../../components/drawers/CreVote.vue";
|
import CreVote from "./CreVote.vue";
|
||||||
import * as api from "../../api/indexVote";
|
import * as api from "../../api/indexVote";
|
||||||
import * as apitaskadd from "../../api/indexTaskadd";
|
|
||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import { toDate } from "../../api/method";
|
|
||||||
import { RouterEditTask } from "@/api/indexTask";
|
import { RouterEditTask } from "@/api/indexTask";
|
||||||
const options1 = ref([
|
import dayjs from "dayjs";
|
||||||
{
|
import * as apiTask from "../../api/indexTaskadd";
|
||||||
value: "value1",
|
|
||||||
label: "请选择状态",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
const rowSelection = ref({
|
|
||||||
checkStrictly: false,
|
|
||||||
onChange: (selectedRowKeys, selectedRows) => {
|
|
||||||
console.log(
|
|
||||||
`selectedRowKeys: ${selectedRowKeys}`,
|
|
||||||
"selectedRows: ",
|
|
||||||
selectedRows
|
|
||||||
);
|
|
||||||
},
|
|
||||||
onSelect: (record, selected, selectedRows) => {
|
|
||||||
console.log(record, selected, selectedRows);
|
|
||||||
},
|
|
||||||
onSelectAll: (selected, selectedRows, changeRows) => {
|
|
||||||
console.log(selected, selectedRows, changeRows);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "AddVote",
|
name: "AddVote",
|
||||||
@@ -173,9 +151,9 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
learn: {
|
voteId: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0,
|
default: null,
|
||||||
},
|
},
|
||||||
projectId: {
|
projectId: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@@ -185,83 +163,71 @@ export default {
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
voteId: {
|
routerTaskId: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
isLevel: { // 是否是关卡页面触发
|
||||||
|
type: Boolean,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
projectTaskId: { // 要编辑的projectId
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
ballotId: {
|
routerId: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
isactive: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
inputV1: "",
|
inputV1: "",
|
||||||
textV1: "",
|
textV1: "",
|
||||||
creVote: false,
|
|
||||||
crevotevisible: false,
|
crevotevisible: false,
|
||||||
time: undefined,
|
time: undefined,
|
||||||
|
startTime:"",
|
||||||
|
endTime:"",
|
||||||
basevote: "",
|
basevote: "",
|
||||||
endTimes: "",
|
|
||||||
startTimes: "",
|
|
||||||
ascriptionId: "",
|
ascriptionId: "",
|
||||||
voteStemId: null,
|
voteStemId: null,
|
||||||
voteId:"",
|
voteId:"",
|
||||||
voteStemName:"",
|
voteStemName:"",
|
||||||
ballotName: "",
|
ballotName: "",
|
||||||
editStem: false, //编辑状态
|
editStem: false, //编辑状态
|
||||||
ballotId: "", //题干id
|
ballotId: 0, //题干id
|
||||||
optionId: "", //删除,修改选项id
|
optionId: "", //删除,修改选项id
|
||||||
});
|
});
|
||||||
const closeDrawer = () => {
|
const closeDrawer = () => {
|
||||||
state.inputV1 = "",
|
state.inputV1 = "",
|
||||||
state.textV1 = "",
|
state.textV1 = "",
|
||||||
state.startTimes = "",
|
|
||||||
state.time = undefined,
|
state.time = undefined,
|
||||||
state.endTimes = "",
|
|
||||||
state.basevote = "",
|
state.basevote = "",
|
||||||
ctx.emit("update:addvoteVisible", false);
|
ctx.emit("update:addvoteVisible", false);
|
||||||
ctx.emit("update:edit", false);
|
ctx.emit("update:edit", false);
|
||||||
};
|
};
|
||||||
const afterVisibleChange = (bool) => {
|
const afterVisibleChange = (bool) => {
|
||||||
console.log("state", bool);
|
console.log("state", bool);
|
||||||
// if (props.edit == true) {
|
queryVoteInfo();
|
||||||
// queryVoteText()
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
const showDrawerCreVote = () => {
|
const showDrawerCreVote = () => {
|
||||||
state.crevotevisible = true;
|
state.crevotevisible = true;
|
||||||
if (state.creVote == true) {
|
|
||||||
state.editStem = true
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
const getStemId = (data) => {
|
const getStemId = (data) => {
|
||||||
state.ballotName = data.ballotName;
|
state.ballotName = data.ballotName;
|
||||||
state.voteStemName = data.voteStemName;
|
state.ballotId =data.ballotId;
|
||||||
state.voteStemId = Number(data.voteStemId);
|
|
||||||
state.ballotId = Number(data.ballotId)
|
|
||||||
state.creVote = data.creVote;
|
|
||||||
console.log('state.voteStemId', state.voteStemId);
|
|
||||||
console.log('state.voteStemId', state.creVote);
|
|
||||||
}
|
}
|
||||||
//暂时没用 之前给子用传参来着
|
|
||||||
// const changeVData = (data) => {
|
|
||||||
// console.log("111", data);
|
|
||||||
// state.creVote = data.creVote;
|
|
||||||
// state.ascriptionId = data.ascriptionId;
|
|
||||||
// state.voteStemId = data.voteStemId;
|
|
||||||
// state.voteStemName = data.voteStemName;
|
|
||||||
// console.log("222", state.creVote);
|
|
||||||
// console.log("333", state.ascriptionId);
|
|
||||||
// };
|
|
||||||
const delBox = () => {
|
const delBox = () => {
|
||||||
state.creVote = false;
|
state.creVote = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateTableData = (data) => {
|
|
||||||
console.log(data, 'data');
|
|
||||||
}
|
|
||||||
|
|
||||||
//删除题干信息接口
|
//删除题干信息接口
|
||||||
const dleVoteStem = () => {
|
const dleVoteStem = () => {
|
||||||
let objdelstem = {
|
let objdelstem = {
|
||||||
@@ -275,17 +241,68 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//新建还是编辑方法
|
//根据投票id获取投票信息
|
||||||
const creoredi = () => {
|
const queryVoteInfo = ()=>{
|
||||||
if (props.eidt == false) {
|
/**
|
||||||
createVoteText()
|
let obj = {
|
||||||
|
voteId:props.voteId
|
||||||
}
|
}
|
||||||
else {
|
.queryVoteText(obj)
|
||||||
changeVoteText()
|
.then((res)=>{
|
||||||
|
console.log('获取投票信息成功',res);
|
||||||
|
state.inputV1 = res.data.data.voteName
|
||||||
|
state.time = [dayjs(res.data.data.voteEndTime).format("YYYY-MM-DD"), dayjs(res.data.data.voteEndTime).format("YYYY-MM-DD")]
|
||||||
|
state.textV1 = res.data.data.voteExplain
|
||||||
|
state.baseVote = res.data.data.baseVote
|
||||||
|
state.ascriptionId = res.data.data.ascriptionId
|
||||||
|
state.ballotId = res.data.data.ballotId
|
||||||
|
})
|
||||||
|
.catch((err)=>{
|
||||||
|
console.log('获取投票信息失败',err);
|
||||||
|
})
|
||||||
|
**/
|
||||||
|
|
||||||
|
}
|
||||||
|
const updateToTask =(res)=>{
|
||||||
|
if(props.isLevel){
|
||||||
|
RouterEditTask({
|
||||||
|
chapterId: props.isactive,
|
||||||
|
courseId: res.data.data.voteId,
|
||||||
|
name: res.data.data.voteName,
|
||||||
|
routerId: props.routerId,
|
||||||
|
routerTaskId: props.routerTaskId || 0,
|
||||||
|
type: 12,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res, 11111);
|
||||||
|
message.success(`${props.edit ? '编辑' : '新增'}关卡任务成功`)
|
||||||
|
ctx.emit("changeData", false);
|
||||||
|
state.addLoading = false;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err, 1111);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
apiTask
|
||||||
|
.addTask({
|
||||||
|
courseId:res.data.data.voteId,
|
||||||
|
name: res.data.data.voteName,
|
||||||
|
projectId: props.projectId,
|
||||||
|
projectTaskId: props.projectTaskId || 0,
|
||||||
|
stageId: props.chooseStageId,
|
||||||
|
type: 12,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log("调用项目添加接口后111", res.data, 11111);
|
||||||
|
ctx.emit("changeData", false);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err, 111111);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//创建投票信息
|
//修改投票信息接口
|
||||||
const createVoteText = () => {
|
const updateVoteInfo = () => {
|
||||||
if (!state.inputV1) {
|
if (!state.inputV1) {
|
||||||
message.destroy();
|
message.destroy();
|
||||||
return message.info("请输入投票名称");
|
return message.info("请输入投票名称");
|
||||||
@@ -294,137 +311,47 @@ export default {
|
|||||||
if (state.basevote == "") {
|
if (state.basevote == "") {
|
||||||
state.basevote = 1;
|
state.basevote = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state.time != undefined){
|
if(state.time != undefined){
|
||||||
state.endTimes = toDate(
|
state.startTime = dayjs(state.time[0]).format("YYYY-MM-DD");
|
||||||
new Date(state.time[0].$d).getTime() / 1000,
|
state.endTime = dayjs(state.time[1]).format("YYYY-MM-DD");
|
||||||
"Y-M-D"
|
|
||||||
);
|
|
||||||
state.startTimes = toDate(
|
|
||||||
new Date(state.time[1].$d).getTime() / 1000,
|
|
||||||
"Y-M-D"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let obj = {
|
let obj = {
|
||||||
|
voteId: props.edit?state.voteId : 0,
|
||||||
|
voteName: state.inputV1,
|
||||||
|
voteStartTime: state.startTime,
|
||||||
|
voteEndTime: state.endTime,
|
||||||
ballotId: state.ballotId,
|
ballotId: state.ballotId,
|
||||||
baseVote: state.basevote,
|
baseVote: state.basevote,
|
||||||
createTime: "",
|
|
||||||
createUser: 0,
|
|
||||||
updateTime: "",
|
|
||||||
updateUser: 0,
|
|
||||||
voteEndTime: state.endTimes,
|
|
||||||
voteExplain: state.textV1,
|
voteExplain: state.textV1,
|
||||||
voteFlag: "",
|
createUser:0,
|
||||||
voteId: 0,
|
updateUser:0,
|
||||||
voteName: state.inputV1,
|
voteTag:"",
|
||||||
voteStartTime: state.startTimes,
|
|
||||||
voteTag: ""
|
|
||||||
|
|
||||||
};
|
|
||||||
api
|
|
||||||
.createVote(obj)
|
|
||||||
.then((res) => {
|
|
||||||
console.log("创建成功123", res);
|
|
||||||
message.success("创建成功");
|
|
||||||
let changeVoteId = {
|
|
||||||
voteId: res.data.data.voteId,
|
|
||||||
ballotId: state.ballotId,
|
|
||||||
}
|
}
|
||||||
ctx.emit("getData", changeVoteId);
|
if(props.edit){
|
||||||
|
api
|
||||||
|
.editVote(obj)
|
||||||
|
.then((res) => {
|
||||||
|
updateToTask(res);
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
if (props.learn == 0)
|
|
||||||
//添加到项目任务列表
|
|
||||||
apitaskadd
|
|
||||||
.addTask({
|
|
||||||
courseId: 0,
|
|
||||||
duration: 0,
|
|
||||||
flag: true,
|
|
||||||
name: obj.voteName,
|
|
||||||
projectId: props.projectId,
|
|
||||||
projectTaskId: 0,
|
|
||||||
stageId: props.chooseStageId,
|
|
||||||
type: 12,
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
console.log("调用项目添加接口后", res.data);
|
|
||||||
//自定义事件给父组件传值
|
|
||||||
ctx.emit("changeData", false);
|
|
||||||
//重新获取任务列表
|
|
||||||
// apiTask.getTask({ projectId: 28 });
|
|
||||||
// router.push("/taskadd");
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
else {
|
|
||||||
let editObj1 = {
|
|
||||||
chapterId: 36,
|
|
||||||
courseId: 0,
|
|
||||||
duration: 0,
|
|
||||||
flag: true,
|
|
||||||
name: obj.voteName,
|
|
||||||
routerId: 92,
|
|
||||||
routerTaskId: 0,
|
|
||||||
type: 12,
|
|
||||||
};
|
|
||||||
RouterEditTask(editObj1);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log("创建失败", err);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//根据投票id获取投票信息
|
|
||||||
// const queryVoteText = ()=>{
|
|
||||||
// let objqurvt = {
|
|
||||||
// voteStemId:state.voteStemId
|
|
||||||
// //没有接口 个人认为应该是这个id
|
|
||||||
// }
|
|
||||||
// api
|
|
||||||
// //目前没接口 大概写的
|
|
||||||
// .queryVoteText(objqurvt)
|
|
||||||
// .then((res)=>{
|
|
||||||
// console.log('获取投票信息成功',res);
|
|
||||||
// state.inputV1 = res.data.data.voteName
|
|
||||||
// state.endTimes = res.data.data.voteEndTime
|
|
||||||
// state.startTimes = res.data.data.voteStartTime
|
|
||||||
// state.textV1 = res.data.data.voteExplain
|
|
||||||
// state.baseVote = res.data.data.baseVote
|
|
||||||
// state.ascriptionId = res.data.data.ascriptionId
|
|
||||||
// state.ballotId = res.data.data.ballotId
|
|
||||||
// })
|
|
||||||
// .catch((err)=>{
|
|
||||||
// console.log('获取投票信息失败',err);
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
//修改投票信息接口
|
|
||||||
const changeVoteText = () => {
|
|
||||||
let objcvt = {
|
|
||||||
ballotId: state.ballotId,
|
|
||||||
baseVote: state.basevote,
|
|
||||||
createTime: "",
|
|
||||||
createUser: 0,
|
|
||||||
updateTime: "",
|
|
||||||
updateUser: 0,
|
|
||||||
voteEndTime: state.endTimes,
|
|
||||||
voteExplain: state.textV1,
|
|
||||||
voteFlag: "",
|
|
||||||
voteId: state.voteId,
|
|
||||||
voteName: state.inputV1,
|
|
||||||
voteStartTime: state.startTimes,
|
|
||||||
voteTag: ""
|
|
||||||
}
|
|
||||||
api
|
|
||||||
.editVote(objcvt)
|
|
||||||
.then((res) => {
|
|
||||||
console.log('修改投票信息成功', res);
|
console.log('修改投票信息成功', res);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log('修改投票信息失败', err);
|
console.log('修改投票信息失败', err);
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
api
|
||||||
|
.createVote(obj)
|
||||||
|
.then((res) => {
|
||||||
|
updateToTask(res);
|
||||||
|
closeDrawer();
|
||||||
|
console.log('创建投票信息成功', res);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log('创建投票信息失败', err);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
@@ -432,16 +359,11 @@ export default {
|
|||||||
afterVisibleChange,
|
afterVisibleChange,
|
||||||
closeDrawer,
|
closeDrawer,
|
||||||
getStemId,
|
getStemId,
|
||||||
// changeVData,
|
queryVoteInfo,
|
||||||
rowSelection,
|
|
||||||
options1,
|
|
||||||
dleVoteStem,
|
dleVoteStem,
|
||||||
creoredi,
|
updateVoteInfo,
|
||||||
createVoteText,
|
|
||||||
changeVoteText,
|
|
||||||
delBox,
|
delBox,
|
||||||
// queryVoteText,
|
|
||||||
updateTableData,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -474,6 +396,7 @@ export default {
|
|||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
border-right: 1px solid #e8e8e8;
|
border-right: 1px solid #e8e8e8;
|
||||||
|
margin-top: 32px;
|
||||||
.main_item {
|
.main_item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -123,9 +123,9 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
editStem: {
|
ballotId: {
|
||||||
type: Boolean,
|
type: Number,
|
||||||
default: false,
|
default: null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
@@ -204,13 +204,13 @@ export default {
|
|||||||
};
|
};
|
||||||
const afterVisibleChange = (bool) => {
|
const afterVisibleChange = (bool) => {
|
||||||
console.log("state", bool);
|
console.log("state", bool);
|
||||||
if (props.editStem == true) {
|
if (props.ballotId != 0) {
|
||||||
queryStemText()
|
queryStemText()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//创建题干还是编辑题干
|
//创建题干还是编辑题干
|
||||||
const creoredi = () => {
|
const creoredi = () => {
|
||||||
if (props.eidtStem == false) {
|
if (props.ballotId) {
|
||||||
createQueTit()
|
createQueTit()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -320,13 +320,11 @@ export default {
|
|||||||
}
|
}
|
||||||
//根据id获取题干信息
|
//根据id获取题干信息
|
||||||
const queryStemText = () => {
|
const queryStemText = () => {
|
||||||
let objqurst = {
|
|
||||||
stemId: 1,
|
|
||||||
ballotId: "",
|
|
||||||
}
|
|
||||||
api
|
api
|
||||||
.queryStemByStemId(objqurst)
|
.queryStemByStemId({ballotId:props.ballotId})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
||||||
|
|
||||||
console.log('获取题干信息成功', res);
|
console.log('获取题干信息成功', res);
|
||||||
state.inputV1 = res.data.data.voteName
|
state.inputV1 = res.data.data.voteName
|
||||||
})
|
})
|
||||||
@@ -436,6 +434,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 32px;
|
margin-bottom: 32px;
|
||||||
|
margin-top: 32px;;
|
||||||
.signbox {
|
.signbox {
|
||||||
width: 120px;
|
width: 120px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
>
|
>
|
||||||
<div class="drawerMain">
|
<div class="drawerMain">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="headerTitle">添加投票任务</div>
|
<div v-if="edit" class="headerTitle">编辑投票</div>
|
||||||
|
<div v-else class="headerTitle">添加投票</div>
|
||||||
<img
|
<img
|
||||||
style="width: 29px; height: 29px; cursor: pointer"
|
style="width: 29px; height: 29px; cursor: pointer"
|
||||||
src="../../assets/images/basicinfo/close.png"
|
src="../../assets/images/basicinfo/close.png"
|
||||||
@@ -32,7 +33,7 @@
|
|||||||
<a-input
|
<a-input
|
||||||
v-model:value="inputV1"
|
v-model:value="inputV1"
|
||||||
style="width: 424px; height: 32px"
|
style="width: 424px; height: 32px"
|
||||||
placeholder="请输入任务名称"
|
placeholder="请输入投票名称"
|
||||||
maxlength="20"
|
maxlength="20"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -51,29 +52,37 @@
|
|||||||
<button
|
<button
|
||||||
class="xkbtn"
|
class="xkbtn"
|
||||||
:style="{ display: creVote ? 'none' : 'block' }"
|
:style="{ display: creVote ? 'none' : 'block' }"
|
||||||
@click="showDrawerCreateVote"
|
@click="showDrawerCreVote"
|
||||||
>
|
>
|
||||||
创建投票
|
创建投票
|
||||||
</button>
|
</button>
|
||||||
|
<div>
|
||||||
|
<CreateVote
|
||||||
|
v-model:createVoteVisible="createVoteVisible"
|
||||||
|
v-model:ballotId="ballotId"
|
||||||
|
v-model:editChild="editChild"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<button
|
<button
|
||||||
class="xkbtn"
|
class="xkbtn"
|
||||||
:style="{ display: creVote ? 'block' : 'none' }"
|
:style="{ display: creVote ? 'block' : 'none' }"
|
||||||
@click="showDrawerCreateVote"
|
@click="showDrawerCreVote"
|
||||||
>
|
>
|
||||||
编辑投票
|
编辑投票
|
||||||
</button>
|
</button>
|
||||||
<div :style="{ display: creVote ? 'block' : 'none' }">
|
<div :style="{ display: creVote ? 'block' : 'none' }">
|
||||||
<div class="fileTigan">
|
<div class="fileTigan">
|
||||||
<span style="color: #388be1">{{voteStemName}}</span>
|
<span style="color: #388be1">{{ballotName}}</span>
|
||||||
<div class="delBox" @click="delBox()"></div>
|
<div class="delBox" @click="dleVoteStem()"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 创建投票侧弹窗 -->
|
<!-- 创建投票侧弹窗 -->
|
||||||
<div>
|
<div>
|
||||||
<CreateVote
|
<cre-vote
|
||||||
v-model:createVoteVisible="createVoteVisible"
|
v-model:crevoteVisible="crevotevisible"
|
||||||
|
@getData="getStemId"
|
||||||
|
v-model:ballotId="ballotId"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 创建投票侧弹窗 -->
|
<!-- 创建投票侧弹窗 -->
|
||||||
@@ -85,7 +94,6 @@
|
|||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-range-picker
|
<a-range-picker
|
||||||
style="width: 424px"
|
style="width: 424px"
|
||||||
v-model:value="time"
|
|
||||||
:placeholder="[' 开始时间', ' 结束时间']"
|
:placeholder="[' 开始时间', ' 结束时间']"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -120,38 +128,38 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="main_btns">
|
<div class="main_btns">
|
||||||
<button class="btn1">取消</button>
|
<button class="btn1" @click="closeDrawer()">取消</button>
|
||||||
<button class="btn2" @click="createVoteText()">确定</button>
|
<button class="btn2" @click="updateVoteInfo()">确定</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { reactive, toRefs} from "vue";
|
import { reactive, toRefs} from "vue";
|
||||||
import CreateVote from "./CreateVote.vue";
|
import CreVote from "./CreateVote.vue";
|
||||||
import * as api from "../../api/indexVote";
|
import * as api from "../../api/indexVote";
|
||||||
import * as apitaskadd from "../../api/indexTaskadd";
|
|
||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import { toDate } from "../../api/method";
|
|
||||||
import { RouterEditTask } from "@/api/indexTask";
|
import { RouterEditTask } from "@/api/indexTask";
|
||||||
import dayjs from 'dayjs';
|
import dayjs from "dayjs";
|
||||||
|
import * as apiTask from "../../api/indexTaskadd";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "AddVote",
|
name: "AddVote",
|
||||||
components: {
|
components: {
|
||||||
CreateVote,
|
CreVote,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
addvoteVisible: {
|
addvoteVisible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
EditVoteId:{
|
edit: {
|
||||||
type: Number,
|
|
||||||
default: 0,
|
|
||||||
},
|
|
||||||
edit: { // 是否为编辑
|
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
voteId: {
|
||||||
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
projectId: {
|
projectId: {
|
||||||
@@ -183,35 +191,54 @@ export default {
|
|||||||
default: null,
|
default: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
voteName: "",
|
inputV1: "",
|
||||||
voteExplain: "",
|
textV1: "",
|
||||||
createVoteVisible: false,
|
createVoteVisible: false,
|
||||||
time: undefined,
|
time: undefined,
|
||||||
|
startTime:"",
|
||||||
|
endTime:"",
|
||||||
basevote: "",
|
basevote: "",
|
||||||
ascriptionId: "",
|
ascriptionId: "",
|
||||||
|
voteStemId: null,
|
||||||
|
voteId:"",
|
||||||
|
voteStemName:"",
|
||||||
|
ballotName: "",
|
||||||
|
editStem: false, //编辑状态
|
||||||
|
ballotId: 0, //题干id
|
||||||
|
optionId: "", //删除,修改选项id
|
||||||
|
editChild:false,
|
||||||
});
|
});
|
||||||
const closeDrawer = () => {
|
const closeDrawer = () => {
|
||||||
|
state.inputV1 = "",
|
||||||
|
state.textV1 = "",
|
||||||
|
state.time = undefined,
|
||||||
|
state.basevote = "",
|
||||||
ctx.emit("update:addvoteVisible", false);
|
ctx.emit("update:addvoteVisible", false);
|
||||||
ctx.emit("update:edit", false);
|
ctx.emit("update:edit", false);
|
||||||
};
|
};
|
||||||
const afterVisibleChange = (bool) => {
|
const afterVisibleChange = (bool) => {
|
||||||
console.log("state", bool);
|
console.log("state", bool);
|
||||||
|
queryVoteInfo();
|
||||||
};
|
};
|
||||||
const showDrawerCreateVote = () => {
|
const showDrawerCreVote = () => {
|
||||||
state.createVoteVisible = true;
|
state.createVoteVisible = true;
|
||||||
console.log("进来了====");
|
state.editChild = props.edit;
|
||||||
};
|
console.log("=======前")
|
||||||
const changeVData = (data) => {
|
|
||||||
state.ascriptionId = data.ascriptionId;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
const getStemId = (data) => {
|
||||||
|
state.ballotName = data.ballotName;
|
||||||
|
state.ballotId =data.ballotId;
|
||||||
|
}
|
||||||
|
|
||||||
const delBox = () => {
|
const delBox = () => {
|
||||||
dleVoteStem()
|
state.creVote = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
//删除题干信息接口
|
//删除题干信息接口
|
||||||
const dleVoteStem = () => {
|
const dleVoteStem = () => {
|
||||||
let objdelstem = {
|
let objdelstem = {
|
||||||
@@ -221,11 +248,53 @@ export default {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log('删除题干信息成功', res)
|
console.log('删除题干信息成功', res)
|
||||||
message.success('删除题干信息成功')
|
message.success('删除题干信息成功')
|
||||||
|
delBox()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const updteVote = (res) =>{
|
|
||||||
if (props.isLevel)
|
//根据投票id获取投票信息
|
||||||
apitaskadd
|
const queryVoteInfo = ()=>{
|
||||||
|
/**
|
||||||
|
let obj = {
|
||||||
|
voteId:props.voteId
|
||||||
|
}
|
||||||
|
.queryVoteText(obj)
|
||||||
|
.then((res)=>{
|
||||||
|
console.log('获取投票信息成功',res);
|
||||||
|
state.inputV1 = res.data.data.voteName
|
||||||
|
state.time = [dayjs(res.data.data.voteEndTime).format("YYYY-MM-DD"), dayjs(res.data.data.voteEndTime).format("YYYY-MM-DD")]
|
||||||
|
state.textV1 = res.data.data.voteExplain
|
||||||
|
state.baseVote = res.data.data.baseVote
|
||||||
|
state.ascriptionId = res.data.data.ascriptionId
|
||||||
|
state.ballotId = res.data.data.ballotId
|
||||||
|
})
|
||||||
|
.catch((err)=>{
|
||||||
|
console.log('获取投票信息失败',err);
|
||||||
|
})
|
||||||
|
**/
|
||||||
|
|
||||||
|
}
|
||||||
|
const updateToTask =(res)=>{
|
||||||
|
if(props.isLevel){
|
||||||
|
RouterEditTask({
|
||||||
|
chapterId: props.isactive,
|
||||||
|
courseId: res.data.data.voteId,
|
||||||
|
name: res.data.data.voteName,
|
||||||
|
routerId: props.routerId,
|
||||||
|
routerTaskId: props.routerTaskId || 0,
|
||||||
|
type: 12,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res, 11111);
|
||||||
|
message.success(`${props.edit ? '编辑' : '新增'}关卡任务成功`)
|
||||||
|
ctx.emit("changeData", false);
|
||||||
|
state.addLoading = false;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err, 1111);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
apiTask
|
||||||
.addTask({
|
.addTask({
|
||||||
courseId:res.data.data.voteId,
|
courseId:res.data.data.voteId,
|
||||||
name: res.data.data.voteName,
|
name: res.data.data.voteName,
|
||||||
@@ -235,92 +304,77 @@ export default {
|
|||||||
type: 12,
|
type: 12,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log("调用项目添加接口后", res.data);
|
console.log("调用项目添加接口后111", res.data, 11111);
|
||||||
ctx.emit("changeData", false);
|
ctx.emit("changeData", false);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(err);
|
console.log(err, 111111);
|
||||||
});
|
|
||||||
else {
|
|
||||||
RouterEditTask({
|
|
||||||
chapterId: props.isactive,
|
|
||||||
courseId: res.data.data.voteId,
|
|
||||||
name: res.data.data.voteName,
|
|
||||||
routerId: props.routerId,
|
|
||||||
routerTaskId: props.routerTaskId,
|
|
||||||
type: 12,
|
|
||||||
}) .then((res) => {
|
|
||||||
console.log("调用项目添加接口后", res.data);
|
|
||||||
ctx.emit("changeData", false);
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(err);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//创建投票信息
|
//修改投票信息接口
|
||||||
const createVoteText = () => {
|
const updateVoteInfo = () => {
|
||||||
if (!state.voteName) {
|
if (!state.inputV1) {
|
||||||
message.destroy();
|
message.destroy();
|
||||||
return message.info("请输入投票名称");
|
return message.info("请输入投票名称");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.basevote == "") {
|
if (state.basevote == "") {
|
||||||
state.basevote = 1;
|
state.basevote = 1;
|
||||||
}
|
}
|
||||||
if(state.time != undefined){
|
if(state.time != undefined){
|
||||||
state.time[0] = toDate(
|
state.startTime = dayjs(state.time[0]).format("YYYY-MM-DD");
|
||||||
new Date(state.time[0].$d).getTime() / 1000,
|
state.endTime = dayjs(state.time[1]).format("YYYY-MM-DD");
|
||||||
"Y-M-D"
|
|
||||||
);
|
|
||||||
state.time[1] = toDate(
|
|
||||||
new Date(state.time[1].$d).getTime() / 1000,
|
|
||||||
"Y-M-D"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let obj = {
|
let obj = {
|
||||||
ascriptionId: state.ascriptionId,
|
voteId: props.edit?state.voteId : 0,
|
||||||
|
voteName: state.inputV1,
|
||||||
|
voteStartTime: state.startTime,
|
||||||
|
voteEndTime: state.endTime,
|
||||||
|
ballotId: state.ballotId,
|
||||||
baseVote: state.basevote,
|
baseVote: state.basevote,
|
||||||
voteEndTime: dayjs(state.time[1]).format("YYYY-MM-DD"),
|
voteExplain: state.textV1,
|
||||||
voteExplain: state.voteExplain,
|
createUser:0,
|
||||||
voteName: state.voteName,
|
updateUser:0,
|
||||||
voteStartTime: dayjs(state.time[0]).format("YYYY-MM-DD"),
|
voteTag:"",
|
||||||
};
|
}
|
||||||
if(props.edit){
|
if(props.edit){
|
||||||
api
|
api
|
||||||
.editVote(obj)
|
.editVote(obj)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log("创建成功123", res);
|
updateToTask(res);
|
||||||
message.success("创建成功");
|
|
||||||
updteVote(res);
|
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
|
console.log('修改投票信息成功', res);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log("创建失败", err);
|
console.log('修改投票信息失败', err);
|
||||||
});
|
})
|
||||||
}else{
|
}else{
|
||||||
api
|
api
|
||||||
.createVote(obj)
|
.createVote(obj)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
updteVote(res);
|
updateToTask(res);
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
|
console.log('创建投票信息成功', res);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log("创建失败", err);
|
console.log('创建投票信息失败', err);
|
||||||
});
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
showDrawerCreateVote,
|
showDrawerCreVote,
|
||||||
afterVisibleChange,
|
afterVisibleChange,
|
||||||
closeDrawer,
|
closeDrawer,
|
||||||
changeVData,
|
getStemId,
|
||||||
|
queryVoteInfo,
|
||||||
dleVoteStem,
|
dleVoteStem,
|
||||||
createVoteText,
|
updateVoteInfo,
|
||||||
delBox,
|
delBox,
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -353,6 +407,7 @@ export default {
|
|||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
border-right: 1px solid #e8e8e8;
|
border-right: 1px solid #e8e8e8;
|
||||||
|
margin-top: 32px;
|
||||||
.main_item {
|
.main_item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
<div v-for="(item, index) in allFormsData" :key="index">
|
<div v-for="(item, index) in allFormsData" :key="index">
|
||||||
<VoteQuestion
|
<VoteQuestion
|
||||||
:item="item"
|
:item="item"
|
||||||
:assessmentId="assessmentId"
|
:ballotId="ballotId"
|
||||||
@del="handleDel"
|
@del="handleDel"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
@@ -95,21 +95,26 @@ import { reactive,toRefs} from "vue";
|
|||||||
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 { useRouter } from "vue-router";
|
|
||||||
//import store from "@/store";
|
//import store from "@/store";
|
||||||
import {
|
import {
|
||||||
queryResearchDetailById,
|
//createOptionMessage,
|
||||||
editResearchMessage,
|
queryStemByStemId
|
||||||
createResearch,
|
}from "@/api/indexVote";
|
||||||
|
import {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} from "@/api/indexResearch";
|
} from "@/api/indexResearch";
|
||||||
import { message } from "ant-design-vue";
|
//import { message } from "ant-design-vue";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CreateVote",
|
name: "CreateVote",
|
||||||
@@ -122,12 +127,20 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
ballotId: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
editChild: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
setup(props,ctx) {
|
setup(props,ctx) {
|
||||||
const router = useRouter();
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
createVoteVisible:false,
|
ballotId: "",
|
||||||
|
ballotName: "",
|
||||||
allFormsData: [],
|
allFormsData: [],
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -142,26 +155,21 @@ export default {
|
|||||||
}
|
}
|
||||||
// 详情
|
// 详情
|
||||||
const getInfoDate = async () => {
|
const getInfoDate = async () => {
|
||||||
let id = router.currentRoute.value.params.id;
|
if (props.editChild) {
|
||||||
if (id) {
|
//stemId 多余字段
|
||||||
state.assessmentId = id;
|
let res = await queryStemByStemId({stemId:0,
|
||||||
let res = await queryResearchDetailById({
|
ballotId: state.ballotId,
|
||||||
assessmentId: state.assessmentId,
|
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.data.code === 200) {
|
if (res.data.code === 200) {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
state.assessmentName = res.assessmentName;
|
state.ballotName = res[0].ballotId;
|
||||||
state.valueMore = res.assessmentMark;
|
|
||||||
let renderArr = [
|
let renderArr = [
|
||||||
...res.singleStemVoList,
|
...res,
|
||||||
...res.multipleStemVoList,
|
|
||||||
...res.essayQuestionVoList,
|
|
||||||
...res.scoringQuestionVoList,
|
|
||||||
];
|
];
|
||||||
sortBy(renderArr, "orderNumber"); //序号
|
// sortBy(renderArr, "orderNumber"); //序号
|
||||||
state.allFormsData = parseData(renderArr, "questionType"); //类型
|
state.allFormsData = parseData(renderArr); //类型
|
||||||
// console.log("state.allFormsData");
|
// console.log("state.allFormsData");
|
||||||
// console.log(state.allFormsData);
|
// console.log(state.allFormsData);
|
||||||
}
|
}
|
||||||
@@ -169,13 +177,11 @@ export default {
|
|||||||
getInfoDate();
|
getInfoDate();
|
||||||
|
|
||||||
// 转换成前端格式
|
// 转换成前端格式
|
||||||
const parseData = (arr, typeKey) => {
|
const parseData = (arr) => {
|
||||||
const resultArr = [];
|
const resultArr = [];
|
||||||
arr.forEach((item) => {
|
arr.forEach((item) => {
|
||||||
let key = Number(item[typeKey]);
|
|
||||||
let obj = {};
|
let obj = {};
|
||||||
if (key === 1) {
|
let restList = traverseArr(item.optionDetailList, {
|
||||||
let restList = traverseArr(item.assessmentSingleChoiceVoList, {
|
|
||||||
inputVal: "singleOptionName",
|
inputVal: "singleOptionName",
|
||||||
imgVal: "singleOptionPictureAddress",
|
imgVal: "singleOptionPictureAddress",
|
||||||
optionId: "singleOptionId",
|
optionId: "singleOptionId",
|
||||||
@@ -185,51 +191,12 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
obj = {
|
obj = {
|
||||||
type: key,
|
voteStemName: item.singleStemName,
|
||||||
valueSingle: item.singleStemName,
|
|
||||||
singleList: restList,
|
singleList: restList,
|
||||||
orderNumber: item.orderNumber,
|
|
||||||
};
|
};
|
||||||
resultArr.push(obj);
|
resultArr.push(obj);
|
||||||
}
|
|
||||||
if (key === 2) {
|
|
||||||
let restList = traverseArr(item.multipleChoiceVoList, {
|
|
||||||
inputVal: "multipleOptionName",
|
|
||||||
imgVal: "multipleOptionPictureAddress",
|
|
||||||
optionId: "multipleOptionId",
|
|
||||||
}).map((itm, idx) => {
|
|
||||||
itm.id = idx + 1;
|
|
||||||
return itm;
|
|
||||||
});
|
|
||||||
|
|
||||||
obj = {
|
|
||||||
type: key,
|
|
||||||
valueMutil: item.multipleStemName,
|
|
||||||
mutilList: restList,
|
|
||||||
orderNumber: item.orderNumber,
|
|
||||||
};
|
|
||||||
resultArr.push(obj);
|
|
||||||
}
|
|
||||||
if (key === 3) {
|
|
||||||
obj = {
|
|
||||||
type: key,
|
|
||||||
valueAsk: item.assessmentQaTitle,
|
|
||||||
valueAskDesc: item.assessmentQaDescribe,
|
|
||||||
optionId: item.assessmentQaId,
|
|
||||||
};
|
|
||||||
resultArr.push(obj);
|
|
||||||
}
|
|
||||||
if (key === 4) {
|
|
||||||
obj = {
|
|
||||||
type: key,
|
|
||||||
valuePin: item.assessmentScTitle,
|
|
||||||
minScore: item.assessmentMinScore,
|
|
||||||
maxScore: item.assessmentMaxScore,
|
|
||||||
pinQuan: item.weightScale,
|
|
||||||
optionId: item.assessmentScId,
|
|
||||||
};
|
|
||||||
resultArr.push(obj);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
resultArr.map((itm, idx) => {
|
resultArr.map((itm, idx) => {
|
||||||
itm.id = idx + 1;
|
itm.id = idx + 1;
|
||||||
@@ -237,6 +204,7 @@ export default {
|
|||||||
});
|
});
|
||||||
return resultArr;
|
return resultArr;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
// 转换成后端格式
|
// 转换成后端格式
|
||||||
const restData = (arr, typeKey) => {
|
const restData = (arr, typeKey) => {
|
||||||
const resultArr = [];
|
const resultArr = [];
|
||||||
@@ -315,6 +283,7 @@ export default {
|
|||||||
});
|
});
|
||||||
return resultArr;
|
return resultArr;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 解散传值
|
// 解散传值
|
||||||
const parseItem = (arr) => {
|
const parseItem = (arr) => {
|
||||||
const filterComObj = filterCommon(arr, "questionType");
|
const filterComObj = filterCommon(arr, "questionType");
|
||||||
@@ -364,7 +333,7 @@ export default {
|
|||||||
return resultObj;
|
return resultObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
*/
|
||||||
const handleTypes = () => {
|
const handleTypes = () => {
|
||||||
let obj = {
|
let obj = {
|
||||||
id: state.allFormsData.length,
|
id: state.allFormsData.length,
|
||||||
@@ -399,7 +368,9 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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)) {
|
||||||
@@ -408,11 +379,10 @@ export default {
|
|||||||
console.log(12121212);
|
console.log(12121212);
|
||||||
console.log(filterData);
|
console.log(filterData);
|
||||||
|
|
||||||
if (state.assessmentId) {
|
if (state.ballotId) {
|
||||||
resultPost = {
|
resultPost = {
|
||||||
assessmentId: state.assessmentId,
|
ballotId: state.ballotId,
|
||||||
assessmentName: state.assessmentName,
|
ballotName: state.ballotName,
|
||||||
assessmentMark: state.valueMore,
|
|
||||||
...filterData,
|
...filterData,
|
||||||
};
|
};
|
||||||
resultPost = deepCloneFilterString(resultPost, [
|
resultPost = deepCloneFilterString(resultPost, [
|
||||||
@@ -431,7 +401,7 @@ export default {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
resultPost = {
|
resultPost = {
|
||||||
assessmentName: state.assessmentNameNew,
|
ballotName: state.ballotNameNew,
|
||||||
assessmentMark: state.valueMore,
|
assessmentMark: state.valueMore,
|
||||||
...filterData,
|
...filterData,
|
||||||
};
|
};
|
||||||
@@ -439,22 +409,20 @@ export default {
|
|||||||
"assessmentMaxScore",
|
"assessmentMaxScore",
|
||||||
"assessmentMinScore",
|
"assessmentMinScore",
|
||||||
]);
|
]);
|
||||||
createResearch(resultPost).then((res) => {
|
createOptionMessage(resultPost).then((res) => {
|
||||||
if (res.data.code === 200) {
|
if (res.data.code === 200) {
|
||||||
message.success("创建成功");
|
message.success("创建成功");
|
||||||
router.push({
|
|
||||||
path: "/researchmanage",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
const handleAllCancel = () => {
|
const handleAllCancel = () => {
|
||||||
state.allFormsData = [];
|
state.allFormsData = [];
|
||||||
router.push({
|
|
||||||
path: "/researchmanage",
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
const checkVal = (filterData) => {
|
const checkVal = (filterData) => {
|
||||||
// 问答
|
// 问答
|
||||||
if (
|
if (
|
||||||
@@ -516,6 +484,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
|
|||||||
@@ -908,7 +908,7 @@ import AddDiscuss from "../../components/drawers/AddDiscuss.vue";
|
|||||||
import AddActive from "../../components/drawers/AddActive.vue";
|
import AddActive from "../../components/drawers/AddActive.vue";
|
||||||
import AddEval from "../../components/drawers/AddEval.vue";
|
import AddEval from "../../components/drawers/AddEval.vue";
|
||||||
import AddInvist from "../../components/drawers/AddInvist.vue";
|
import AddInvist from "../../components/drawers/AddInvist.vue";
|
||||||
import AddVote from "../../components/drawers/AddVote.vue";
|
import AddVote from "../../components/vote/AddVote.vue";
|
||||||
import AddLive from "../../components/drawers/AddLive.vue";
|
import AddLive from "../../components/drawers/AddLive.vue";
|
||||||
import AddRef from "../../components/drawers/AddRef.vue";
|
import AddRef from "../../components/drawers/AddRef.vue";
|
||||||
import * as api from "../../api/indexLevel";
|
import * as api from "../../api/indexLevel";
|
||||||
|
|||||||
@@ -877,10 +877,10 @@ import AddTest from "../../components/drawers/AddTest.vue";
|
|||||||
import AddLive from "../../components/drawers/AddLive.vue";
|
import AddLive from "../../components/drawers/AddLive.vue";
|
||||||
import AddRef from "../../components/drawers/AddRef.vue";
|
import AddRef from "../../components/drawers/AddRef.vue";
|
||||||
import AddDiscuss from "../../components/drawers/AddDiscuss.vue";
|
import AddDiscuss from "../../components/drawers/AddDiscuss.vue";
|
||||||
import AddActive from "../../components/drawers/AddActive.vue";
|
import AddActive from "../../components/drawers/AddActive.vue";s
|
||||||
import AddEval from "../../components/drawers/AddEval.vue";
|
import AddEval from "../../components/drawers/AddEval.vue";
|
||||||
import AddInvist from "../../components/drawers/AddInvist.vue";
|
import AddInvist from "../../components/drawers/AddInvist.vue";
|
||||||
import AddVote from "../../components/drawers/AddVote.vue";
|
import AddVote from "../../components/vote/AddVote.vue";
|
||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import * as api from "../../api/indexTaskadd";
|
import * as api from "../../api/indexTaskadd";
|
||||||
import * as apistage from "../../api/indexStage";
|
import * as apistage from "../../api/indexStage";
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { reactive, toRefs } from "vue";
|
import { reactive, toRefs } from "vue";
|
||||||
import AddVote from "../../components/drawers/AddVote";
|
import AddVote from "../../components/vote/AddVote";
|
||||||
// import { PlusOutlined, LoadingOutlined } from "@ant-design/icons-vue";
|
// import { PlusOutlined, LoadingOutlined } from "@ant-design/icons-vue";
|
||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import * as api from "../../api/index1";
|
import * as api from "../../api/index1";
|
||||||
|
|||||||
Reference in New Issue
Block a user