diff --git a/src/components/drawers/AddTest.vue b/src/components/drawers/AddTest.vue index ec7403a9..a534386a 100644 --- a/src/components/drawers/AddTest.vue +++ b/src/components/drawers/AddTest.vue @@ -8,7 +8,7 @@ >
-
{{examinationId ? "编辑" : "添加" }}考试
+
{{EditTestId ? "编辑" : "添加" }}考试
{ console.log(values); - updateTest(props.examinationId) + updateTest(); }; const handleFinishFailed = errors => { @@ -387,9 +411,18 @@ export default { resetForm(); formState.choosedTime = ''; ctx.emit("update:addtestVisible", false); + ctx.emit("update:edit", false); }; - const queryTest = (data) => { - queryExaminationDetailById(data).then((res) => { + const afterVisibleChange = (bool) => { + console.log(props.edit); + if (props.addtestVisible && props.edit) { // 该页面显示同时 edit为true 时,发送查询请求, + queryTest() + } + console.log("formState", bool); + }; + const queryTest = () => { + console.log(props.EditTestId); + queryExaminationDetailById({examinationId:props.EditTestId}).then((res) => { formState.examinationName = res.data.data.examinationName; formState.workRequirement = res.data.data.workRequirement; formState.examinationDuration = res.data.data.examinationDuration; @@ -408,7 +441,23 @@ export default { message.error(`查询失败`) }) } - const updateTest = (id) => { + const updateTest = () => { + + // 如果是关卡页面进入 --------------------------------- + if (props.isLevel) { + //. + } else { // 从任务界面进入 + if(props.edit) { // 编辑任务 + myUpdateExamination() + }else { // 创建任务 + myCreateExamination() + } + } + + + } + + const myUpdateExamination = () => { let obj = { "createTime": "", "createUser": 0, @@ -416,7 +465,7 @@ export default { "examinationEndTime": dayjs(formState.choosedTime[1]).format("YYYY-MM-DD"), "examinationExplain": formState.examinationExplain, "examinationFlag": "", - "examinationId": id || 0, + "examinationId": props.EditTestId, "examinationLimit": formState.examinationLimit, "examinationName": formState.examinationName, "examinationPaperId": 0, @@ -431,48 +480,66 @@ export default { "updateTime": "", "updateUser": 0 } - if(id) { - updateExamination(obj).then((res)=>{ + updateExamination(obj).then((res)=>{ console.log(res); + myProjectEditTask(res.data.data.examinationId) }).catch(()=>{ message.error(`编辑失败`) }) - } else { - createExamination(obj).then(()=>{ + + } + const myCreateExamination = () => { + let obj = { + "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)=>{ + myProjectEditTask(res.data.data.examinationId) }).catch((err)=>{ message.error(`添加失败${err}`) }) - } - - + } + const myProjectEditTask = (testId) => { let editObj = { - "courseId": 0, - "duration": 0, + "courseId": testId, + "duration": 50, "flag": true, - "name": "", - "projectId": 0, - "projectTaskId": props.examinationId || '', - "stageId": 0, + "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.examinationId? '编辑' : '新增'}阶段任务成功`) + message.success(`${props.EditTestId? '编辑' : '新增'}阶段任务成功`) + ctx.emit("changeData", false); closeDrawer(); }).catch(err => { - message.error(`${props.examinationId? '编辑' : '新增'}阶段任务失败`) + message.error(`${props.EditTestId? '编辑' : '新增'}阶段任务失败`) console.log(` 编辑项目失败的打印 ${err}`); }) - - } - const afterVisibleChange = (bool) => { - console.log("formState", bool); - if(props.addtestVisible && props.examinationId){ - queryTest({examinationId: props.examinationId}) - } - }; + const cloradio1 = (value) => { if (value != "") { formState.showAnswers = ""; diff --git a/src/components/drawers/AddVote.vue b/src/components/drawers/AddVote.vue index 99acd182..cf784131 100644 --- a/src/components/drawers/AddVote.vue +++ b/src/components/drawers/AddVote.vue @@ -176,6 +176,8 @@ export default { basevote: "", endTimes: "", startTimes: "", + ascriptionId:"", + voteStemId:"", }); const closeDrawer = () => { ctx.emit("update:addvoteVisible", false); @@ -189,8 +191,11 @@ export default { }; const changeVData = (data) => { console.log('111', data); - state.creVote = data + state.creVote = data.creVote + state.ascriptionId = data.ascriptionId + state.voteStemId = data.voteStemId console.log('222',state.creVote); + console.log('333',state.ascriptionId); } const delBox = () => { state.creVote = false; diff --git a/src/components/drawers/CreVote.vue b/src/components/drawers/CreVote.vue index e16c49f2..f8f1cc35 100644 --- a/src/components/drawers/CreVote.vue +++ b/src/components/drawers/CreVote.vue @@ -167,27 +167,46 @@ export default { // return message.info("请输入选项"); // } console.log(state.questions[0].inputV); - let obj = { - createTime: "", - createUser: 0, - optionDto: [ - { - optionId: 0, - optionName: "", - optionPictureAddress: "", - }, - ], - stemName: "", - updateTime: "", - updateUser: 0, - voteStemId: 0, - }; + let obj = [ + { + ascriptionId: 0, + createTime: "", + createUser: 0, + optionDetailList: [ + { + createTime: "", + createUser: 0, + optionId: 0, + optionName: "", + optionOrderNum: "", + optionPictureAddress: "", + stem: "", + updateTime: "", + updateUser: 0, + voteStemId: 0, + }, + ], + orderNumber: "", + updateTime: "", + updateUser: 0, + voteStemFlag: "", + voteStemId: 0, + voteStemName: "", + }, + ]; api .createOptionMessage(obj) .then((res) => { console.log("创建成功", res); + console.log('res.data.data[0].ascriptionId',res.data.data[0].ascriptionId); + console.log('res.data.data[0].voteStemId',res.data.data[0].voteStemId); message.success("创建成功"); - ctx.emit("getData", state.creVote); + let stemData = { + creVote: state.creVote, + ascriptionId: res.data.data[0].ascriptionId, + voteStemId:res.data.data[0].voteStemId + }; + ctx.emit("getData", stemData); closeDrawer(); }) .catch((err) => { diff --git a/src/views/projectcenter/TaskAdd.vue b/src/views/projectcenter/TaskAdd.vue index c75ccbfb..31969683 100644 --- a/src/views/projectcenter/TaskAdd.vue +++ b/src/views/projectcenter/TaskAdd.vue @@ -162,7 +162,16 @@
- +
@@ -866,6 +875,7 @@ export default { EditLiveId: null, //要编辑的直播的id editDiscussId:null,//要编辑的讨论的id EditWorkId:null, // 要编辑的作业id + EditTestId: null,// 要编辑的考试id EditEvalId:null, projectTaskId:null, // 要编辑的具体任务id projectNameList: [ @@ -1298,7 +1308,7 @@ export default { // 删除考试 const deleteTest = () => { let obj = { - examinationId: 0, + examinationId: state.deleteID, }; deleteExaminationById(obj) .then((res) => { @@ -1691,7 +1701,9 @@ export default { state.projectTaskId = eleId; state.addhomeworkvisible = true; }; - const showDrawerAddTest = () => { + const showDrawerAddTest = (id,eleId) => { + state.EditTestId = id + state.projectTaskId = eleId; state.addtestvisible = true; }; const showDrawerAddLive = () => { @@ -1847,7 +1859,7 @@ export default { }else if (type == "作业") { showDrawerAddHomework(id,eleId); }else if (type == "考试") { - showDrawerAddTest(id); + showDrawerAddTest(id,eleId); } } return {