mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 19:06:45 +08:00
feat:项目任务列表 考试的删除,编辑,新增
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
>
|
||||
<div class="drawerMain">
|
||||
<div class="header">
|
||||
<div class="headerTitle">{{examinationId ? "编辑" : "添加" }}考试</div>
|
||||
<div class="headerTitle">{{EditTestId ? "编辑" : "添加" }}考试</div>
|
||||
<img
|
||||
style="width: 29px; height: 29px; cursor: pointer"
|
||||
src="../../assets/images/basicinfo/close.png"
|
||||
@@ -228,10 +228,34 @@ export default {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
examinationId: {
|
||||
EditTestId: { // 要编辑的考试id
|
||||
type: Number,
|
||||
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) {
|
||||
const formState = reactive({
|
||||
@@ -368,7 +392,7 @@ export default {
|
||||
])
|
||||
const handleFinish = values => {
|
||||
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 = "";
|
||||
|
||||
@@ -162,7 +162,16 @@
|
||||
</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 class="lin"></div>
|
||||
@@ -863,6 +872,7 @@ export default {
|
||||
EditLiveId: null, //要编辑的直播的id
|
||||
editDiscussId:null,//要编辑的讨论的id
|
||||
EditWorkId:null, // 要编辑的作业id
|
||||
EditTestId: null,// 要编辑的考试id
|
||||
EditEvalId:null,
|
||||
projectTaskId:null, // 要编辑的具体任务id
|
||||
projectNameList: [
|
||||
@@ -1295,7 +1305,7 @@ export default {
|
||||
// 删除考试
|
||||
const deleteTest = () => {
|
||||
let obj = {
|
||||
examinationId: 0,
|
||||
examinationId: state.deleteID,
|
||||
};
|
||||
deleteExaminationById(obj)
|
||||
.then((res) => {
|
||||
@@ -1688,7 +1698,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 = () => {
|
||||
@@ -1842,7 +1854,7 @@ export default {
|
||||
}else if (type == "作业") {
|
||||
showDrawerAddHomework(id,eleId);
|
||||
}else if (type == "考试") {
|
||||
showDrawerAddTest(id);
|
||||
showDrawerAddTest(id,eleId);
|
||||
}
|
||||
}
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user