mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-14 05:16:45 +08:00
feat:项目任务列表 考试的删除,编辑,新增
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
>
|
>
|
||||||
<div class="drawerMain">
|
<div class="drawerMain">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="headerTitle">{{examinationId ? "编辑" : "添加" }}考试</div>
|
<div class="headerTitle">{{EditTestId ? "编辑" : "添加" }}考试</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"
|
||||||
@@ -228,10 +228,34 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
examinationId: {
|
EditTestId: { // 要编辑的考试id
|
||||||
type: Number,
|
type: Number,
|
||||||
default: -1,
|
default: -1,
|
||||||
}
|
},
|
||||||
|
projectId: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
chooseStageId: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
routerTaskId: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
isLevel: { // 是否是关卡页面触发
|
||||||
|
type: Boolean,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
projectTaskId: { // 要编辑的projectId
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
edit: { //
|
||||||
|
type: Boolean,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
const formState = reactive({
|
const formState = reactive({
|
||||||
@@ -368,7 +392,7 @@ export default {
|
|||||||
])
|
])
|
||||||
const handleFinish = values => {
|
const handleFinish = values => {
|
||||||
console.log(values);
|
console.log(values);
|
||||||
updateTest(props.examinationId)
|
updateTest();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFinishFailed = errors => {
|
const handleFinishFailed = errors => {
|
||||||
@@ -387,9 +411,18 @@ export default {
|
|||||||
resetForm();
|
resetForm();
|
||||||
formState.choosedTime = '';
|
formState.choosedTime = '';
|
||||||
ctx.emit("update:addtestVisible", false);
|
ctx.emit("update:addtestVisible", false);
|
||||||
|
ctx.emit("update:edit", false);
|
||||||
};
|
};
|
||||||
const queryTest = (data) => {
|
const afterVisibleChange = (bool) => {
|
||||||
queryExaminationDetailById(data).then((res) => {
|
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.examinationName = res.data.data.examinationName;
|
||||||
formState.workRequirement = res.data.data.workRequirement;
|
formState.workRequirement = res.data.data.workRequirement;
|
||||||
formState.examinationDuration = res.data.data.examinationDuration;
|
formState.examinationDuration = res.data.data.examinationDuration;
|
||||||
@@ -408,7 +441,23 @@ export default {
|
|||||||
message.error(`查询失败`)
|
message.error(`查询失败`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const updateTest = (id) => {
|
const updateTest = () => {
|
||||||
|
|
||||||
|
// 如果是关卡页面进入 ---------------------------------
|
||||||
|
if (props.isLevel) {
|
||||||
|
//.
|
||||||
|
} else { // 从任务界面进入
|
||||||
|
if(props.edit) { // 编辑任务
|
||||||
|
myUpdateExamination()
|
||||||
|
}else { // 创建任务
|
||||||
|
myCreateExamination()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const myUpdateExamination = () => {
|
||||||
let obj = {
|
let obj = {
|
||||||
"createTime": "",
|
"createTime": "",
|
||||||
"createUser": 0,
|
"createUser": 0,
|
||||||
@@ -416,7 +465,7 @@ export default {
|
|||||||
"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": "",
|
"examinationFlag": "",
|
||||||
"examinationId": id || 0,
|
"examinationId": props.EditTestId,
|
||||||
"examinationLimit": formState.examinationLimit,
|
"examinationLimit": formState.examinationLimit,
|
||||||
"examinationName": formState.examinationName,
|
"examinationName": formState.examinationName,
|
||||||
"examinationPaperId": 0,
|
"examinationPaperId": 0,
|
||||||
@@ -431,48 +480,66 @@ export default {
|
|||||||
"updateTime": "",
|
"updateTime": "",
|
||||||
"updateUser": 0
|
"updateUser": 0
|
||||||
}
|
}
|
||||||
if(id) {
|
updateExamination(obj).then((res)=>{
|
||||||
updateExamination(obj).then((res)=>{
|
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
myProjectEditTask(res.data.data.examinationId)
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
message.error(`编辑失败`)
|
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)=>{
|
}).catch((err)=>{
|
||||||
message.error(`添加失败${err}`)
|
message.error(`添加失败${err}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const myProjectEditTask = (testId) => {
|
||||||
|
|
||||||
let editObj = {
|
let editObj = {
|
||||||
"courseId": 0,
|
"courseId": testId,
|
||||||
"duration": 0,
|
"duration": 50,
|
||||||
"flag": true,
|
"flag": true,
|
||||||
"name": "",
|
"name": formState.examinationName,
|
||||||
"projectId": 0,
|
"projectId": props.projectId,
|
||||||
"projectTaskId": props.examinationId || '',
|
"projectTaskId": props.projectTaskId || null,
|
||||||
"stageId": 0,
|
"stageId": props.chooseStageId,
|
||||||
"type": 5
|
"type": 5
|
||||||
}
|
}
|
||||||
// 新增编辑或新增项目
|
// 新增编辑或新增项目
|
||||||
ProjectEditTask(editObj).then(res => {
|
ProjectEditTask(editObj).then(res => {
|
||||||
console.log(` 编辑项目成功的打印 ${res}`);
|
console.log(` 编辑项目成功的打印 ${res}`);
|
||||||
message.success(`${props.examinationId? '编辑' : '新增'}阶段任务成功`)
|
message.success(`${props.EditTestId? '编辑' : '新增'}阶段任务成功`)
|
||||||
|
ctx.emit("changeData", false);
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
message.error(`${props.examinationId? '编辑' : '新增'}阶段任务失败`)
|
message.error(`${props.EditTestId? '编辑' : '新增'}阶段任务失败`)
|
||||||
console.log(` 编辑项目失败的打印 ${err}`);
|
console.log(` 编辑项目失败的打印 ${err}`);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
const afterVisibleChange = (bool) => {
|
|
||||||
console.log("formState", bool);
|
|
||||||
if(props.addtestVisible && props.examinationId){
|
|
||||||
queryTest({examinationId: props.examinationId})
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const cloradio1 = (value) => {
|
const cloradio1 = (value) => {
|
||||||
if (value != "") {
|
if (value != "") {
|
||||||
formState.showAnswers = "";
|
formState.showAnswers = "";
|
||||||
|
|||||||
@@ -162,7 +162,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- 添加考试侧弹窗 -->
|
<!-- 添加考试侧弹窗 -->
|
||||||
<div>
|
<div>
|
||||||
<add-test v-model:addtestVisible="addtestvisible" />
|
<add-test
|
||||||
|
v-model:addtestVisible="addtestvisible"
|
||||||
|
@changeData="updateTableData"
|
||||||
|
:isLevel=false
|
||||||
|
v-model:edit="edit"
|
||||||
|
v-model:projectId="projectId"
|
||||||
|
v-model:chooseStageId="chooseStageId"
|
||||||
|
v-model:EditTestId="EditTestId"
|
||||||
|
v-model:projectTaskId="projectTaskId"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 添加考试侧弹窗 -->
|
<!-- 添加考试侧弹窗 -->
|
||||||
<div class="lin"></div>
|
<div class="lin"></div>
|
||||||
@@ -863,6 +872,7 @@ export default {
|
|||||||
EditLiveId: null, //要编辑的直播的id
|
EditLiveId: null, //要编辑的直播的id
|
||||||
editDiscussId:null,//要编辑的讨论的id
|
editDiscussId:null,//要编辑的讨论的id
|
||||||
EditWorkId:null, // 要编辑的作业id
|
EditWorkId:null, // 要编辑的作业id
|
||||||
|
EditTestId: null,// 要编辑的考试id
|
||||||
EditEvalId:null,
|
EditEvalId:null,
|
||||||
projectTaskId:null, // 要编辑的具体任务id
|
projectTaskId:null, // 要编辑的具体任务id
|
||||||
projectNameList: [
|
projectNameList: [
|
||||||
@@ -1295,7 +1305,7 @@ export default {
|
|||||||
// 删除考试
|
// 删除考试
|
||||||
const deleteTest = () => {
|
const deleteTest = () => {
|
||||||
let obj = {
|
let obj = {
|
||||||
examinationId: 0,
|
examinationId: state.deleteID,
|
||||||
};
|
};
|
||||||
deleteExaminationById(obj)
|
deleteExaminationById(obj)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -1688,7 +1698,9 @@ export default {
|
|||||||
state.projectTaskId = eleId;
|
state.projectTaskId = eleId;
|
||||||
state.addhomeworkvisible = true;
|
state.addhomeworkvisible = true;
|
||||||
};
|
};
|
||||||
const showDrawerAddTest = () => {
|
const showDrawerAddTest = (id,eleId) => {
|
||||||
|
state.EditTestId = id
|
||||||
|
state.projectTaskId = eleId;
|
||||||
state.addtestvisible = true;
|
state.addtestvisible = true;
|
||||||
};
|
};
|
||||||
const showDrawerAddLive = () => {
|
const showDrawerAddLive = () => {
|
||||||
@@ -1842,7 +1854,7 @@ export default {
|
|||||||
}else if (type == "作业") {
|
}else if (type == "作业") {
|
||||||
showDrawerAddHomework(id,eleId);
|
showDrawerAddHomework(id,eleId);
|
||||||
}else if (type == "考试") {
|
}else if (type == "考试") {
|
||||||
showDrawerAddTest(id);
|
showDrawerAddTest(id,eleId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user