mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-15 22:06:45 +08:00
fix:添加评估重复时禁止添加
This commit is contained in:
@@ -16,3 +16,6 @@ export const ProjectDeleteTask = (obj) => http.delete('/admin/project/deleteTask
|
||||
export const IsExistence = (obj) => http.post('/admin/router/queryTaskDoesItExist',obj);
|
||||
// 判断当前在线课是否已经添加到该项目下
|
||||
export const IsExistenceProject = (obj) => http.post('/admin/project/queryTaskDoesItExistForProject',obj);
|
||||
// 判断当前在线课是否已经添加到该模板库下
|
||||
export const IsExistenceProjectTemplate = (obj) => http.post('/admin/project/template/queryTaskDoesItExistForTemplate',obj);
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ import { reactive, toRefs } from "vue";
|
||||
import * as apiTask from "../../api/indexTaskadd";
|
||||
import { message } from "ant-design-vue";
|
||||
import AssessmentList from "./ AssessmentList.vue";
|
||||
import { RouterEditTask } from "@/api/indexTask";
|
||||
import { RouterEditTask, IsExistence, IsExistenceProject} from "@/api/indexTask";
|
||||
import * as api from "../../api/indexInvist";
|
||||
import { addTempTask } from "../../api/indexTaskadd";
|
||||
export default {
|
||||
@@ -222,6 +222,29 @@ export default {
|
||||
return message.warning("请选择评估");
|
||||
}
|
||||
if (props.isLevel == 1) {
|
||||
IsExistence({
|
||||
chapterId: Number(props.isactive),
|
||||
courseId: state.assessment.assessmentId,
|
||||
routerId: props.routerId,
|
||||
type: 11,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log('shifouchongfu',res)
|
||||
console.log("路径图中是否包含此评估了", res);
|
||||
if (res.data.data.length) {
|
||||
let strdata = res.data.data;
|
||||
let tipStr = "";
|
||||
for (let i = 0; i < strdata.length; i++) {
|
||||
if (i == strdata.length - 1) {
|
||||
tipStr += strdata[i].courseName;
|
||||
} else {
|
||||
tipStr += strdata[i].courseName + "/";
|
||||
}
|
||||
}
|
||||
message.destroy();
|
||||
message.warning("评估(" + tipStr + ")重复添加");
|
||||
return;
|
||||
} else {
|
||||
RouterEditTask({
|
||||
chapterId: props.isactive,
|
||||
courseId: state.assessment.assessmentId,
|
||||
@@ -241,7 +264,35 @@ export default {
|
||||
message.destroy();
|
||||
message.error(`${props.edit ? "编辑" : "新增"}关卡任务失败`);
|
||||
});
|
||||
}
|
||||
}).catch(err=>{
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
|
||||
} else if (props.isLevel == 2) {
|
||||
IsExistenceProject({
|
||||
courseId: state.assessment.assessmentId,
|
||||
projectId: props.projectId,
|
||||
stageId: props.chooseStageId || 0,
|
||||
type: 11,
|
||||
}).then(res=>{
|
||||
console.log(res)
|
||||
console.log("项目中是否包含此评估了", res);
|
||||
if (res.data.data.length) {
|
||||
let strdata = res.data.data;
|
||||
let tipStr = "";
|
||||
for (let i = 0; i < strdata.length; i++) {
|
||||
if (i == strdata.length - 1) {
|
||||
tipStr += strdata[i].courseName;
|
||||
} else {
|
||||
tipStr += strdata[i].courseName + "/";
|
||||
}
|
||||
}
|
||||
message.destroy();
|
||||
message.warning("评估(" + tipStr + ")重复添加");
|
||||
return;
|
||||
} else {
|
||||
apiTask
|
||||
.addTask({
|
||||
courseId: state.assessment.assessmentId,
|
||||
@@ -259,6 +310,11 @@ export default {
|
||||
.catch(() => {
|
||||
message.error(`${props.edit ? "编辑" : "新增"}任务失败`);
|
||||
});
|
||||
}
|
||||
}).catch(err=>{
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
} else if (props.isLevel == 3) {
|
||||
addTempTask({
|
||||
courseId: state.assessment.assessmentId,
|
||||
|
||||
Reference in New Issue
Block a user