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 @@ >
{
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/views/projectcenter/TaskAdd.vue b/src/views/projectcenter/TaskAdd.vue
index 8315f1ee..ad6cc7c0 100644
--- a/src/views/projectcenter/TaskAdd.vue
+++ b/src/views/projectcenter/TaskAdd.vue
@@ -162,7 +162,16 @@