feat:学习路径删除 增加任务到列表

This commit is contained in:
songwc
2022-11-07 16:25:54 +08:00
parent 2dc91fc559
commit f1a2fb4673
7 changed files with 330 additions and 418 deletions

View File

@@ -504,7 +504,7 @@
</span>
<span
style="color: #4ea6ff; cursor: pointer"
@click="showDelete(element.id)"
@click="showDeleteModal(element.id)"
>
删除
</span>
@@ -778,9 +778,16 @@
<add-live
v-model:addliveVisible="addlivevisible"
v-model:isStudy="isStudy"
v-model:isactive="isactive"
v-model:routerId="routerId"
/>
<!-- 添加外链抽屉 -->
<add-ref v-model:addrefVisible="addrefvisible" v-model:isStudy="isStudy" />
<add-ref
v-model:addrefVisible="addrefvisible"
v-model:isStudy="isStudy"
v-model:isactive="isactive"
v-model:routerId="routerId"
/>
<!-- 是否确认删除任务弹窗 -->
<!-- 确认删除阶段弹窗 -->
<a-modal
@@ -829,9 +836,10 @@ import AddVote from "../../components/drawers/AddVote.vue";
import AddLive from "../../components/drawers/AddLive.vue";
import AddRef from "../../components/drawers/AddRef.vue";
import * as api from "../../api/indexLevel";
import { GetRouterDetail, RouterDeleteTask } from "../../api/indexTask";
import { GetRouterDetail } from "../../api/indexTask";
import { message } from "ant-design-vue";
import { storage } from "../../api/storage";
import { deleteStudyTask } from "../../api/indexStudy";
import draggable from "vuedraggable";
export default {
name: "LevelAddDetail",
@@ -1176,6 +1184,7 @@ export default {
cretime: element.duration,
checked1: element.flag,
routerTaskId: element.routerTaskId,
courseId: element.courseId,
};
array.push(obj);
});
@@ -1218,135 +1227,128 @@ export default {
const showImpStu = () => {
state.AddImpStuvisible = true;
};
const tableDataFunc = () => {
const columns = [
{
title: "类型",
dataIndex: "state",
// width: "30%",
key: "state",
width: 60,
align: "left",
className: "classify",
scopedSlots: { customRender: "action" }, //引入的插槽
customRender: (text) => {
// console.log(text.record.checked1);
return (
<div class="racona">
<div
class="img"
style={{ cursor: "pointer" }}
onClick={() => {
console.log("点击了");
}}
></div>
<span> {text.record.lei}</span>
{/**
<div class="img"></div>
<a-checkbox class="ch" checked={text.record.checkedd}>
{text.record.lei}
</a-checkbox>
*/}
</div>
);
},
},
{
title: "任务名称",
dataIndex: "creater",
// width: "30%",
key: "creater",
width: 200,
align: "center",
className: "h",
},
{
title: "必修/选修",
dataIndex: "pubtime",
key: "pubtime",
// width: 100,
align: "center",
className: "h",
scopedSlots: { customRender: "action" }, //引入的插槽
customRender: (text) => {
// console.log(text.record.checked1);
return (
<div class="opat">
<div class="opacationt clearfix">
<a-switch
style="margin-left:-50px;margin-top:3px"
checked={text.record.checked1}
size="small"
active-color="red"
onClick={() => {
console.log("点击了");
text.record.checked1 = !text.record.checked1;
}}
/>
<div class="showt clearfix">
<div
class="bi"
style={
text.record.checked1 ? "z-index:999" : "z-index:998"
}
>
必修
</div>
<div class="xuan">选修</div>
</div>
</div>
</div>
);
},
},
{
title: "时长",
dataIndex: "cretime",
key: "cretime",
// width: 100,
align: "center",
className: "h",
},
{
title: "操作",
className: "h",
dataIndex: "opacation",
key: "opacation",
// width: 100,
align: "center",
scopedSlots: { customRender: "action" }, //引入的插槽
customRender: (e) => {
return (
<div class="opa">
<div class="opacation">
<span
style="color:#4EA6FF;margin-right:25px;cursor:pointer"
onClick={() => {
console.log("编辑id", e.record.routerTaskId);
console.log("编辑类型", e.record.lei);
state.editID = e.record.routerTaskId;
//state.addhomeworkvisible = true;
}}
>
编辑
</span>
<span
style="color:#4EA6FF;cursor:pointer"
onClick={() => {
showDeleteModal(e.record.routerTaskId);
}}
>
删除
</span>
</div>
</div>
);
},
},
];
return columns;
};
// const tableDataFunc = () => {
// const columns = [
// {
// title: "类型",
// dataIndex: "state",
// // width: "30%",
// key: "state",
// width: 60,
// align: "left",
// className: "classify",
// scopedSlots: { customRender: "action" }, //引入的插槽
// customRender: (text) => {
// // console.log(text.record.checked1);
// return (
// <div class="racona">
// <div
// class="img"
// style={{ cursor: "pointer" }}
// onClick={() => {
// console.log("点击了");
// }}
// ></div>
// <span> {text.record.lei}</span>
// </div>
// );
// },
// },
// {
// title: "任务名称",
// dataIndex: "creater",
// // width: "30%",
// key: "creater",
// width: 200,
// align: "center",
// className: "h",
// },
// {
// title: "必修/选修",
// dataIndex: "pubtime",
// key: "pubtime",
// // width: 100,
// align: "center",
// className: "h",
// scopedSlots: { customRender: "action" }, //引入的插槽
// customRender: (text) => {
// // console.log(text.record.checked1);
// return (
// <div class="opat">
// <div class="opacationt clearfix">
// <a-switch
// style="margin-left:-50px;margin-top:3px"
// checked={text.record.checked1}
// size="small"
// active-color="red"
// onClick={() => {
// console.log("点击了");
// text.record.checked1 = !text.record.checked1;
// }}
// />
// <div class="showt clearfix">
// <div
// class="bi"
// style={
// text.record.checked1 ? "z-index:999" : "z-index:998"
// }
// >
// 必修
// </div>
// <div class="xuan">选修</div>
// </div>
// </div>
// </div>
// );
// },
// },
// {
// title: "时长",
// dataIndex: "cretime",
// key: "cretime",
// // width: 100,
// align: "center",
// className: "h",
// },
// {
// title: "操作",
// className: "h",
// dataIndex: "opacation",
// key: "opacation",
// // width: 100,
// align: "center",
// scopedSlots: { customRender: "action" }, //引入的插槽
// customRender: (e) => {
// return (
// <div class="opa">
// <div class="opacation">
// <span
// style="color:#4EA6FF;margin-right:25px;cursor:pointer"
// onClick={() => {
// console.log("编辑id", e.record.routerTaskId);
// console.log("编辑类型", e.record.lei);
// state.editID = e.record.routerTaskId;
// //state.addhomeworkvisible = true;
// }}
// >
// 编辑
// </span>
// <span
// style="color:#4EA6FF;cursor:pointer"
// onClick={() => {
// showDeleteModal(e.record.routerTaskId);
// }}
// >
// 删除
// </span>
// </div>
// </div>
// );
// },
// },
// ];
// return columns;
// };
const checkType = (index) => {
let typeRules = [
"",
@@ -1381,13 +1383,6 @@ export default {
return (
<div class="racona">
<span> {text.record.name}</span>
{/**
<div class="img"></div>
<a-checkbox class="ch" checked={text.record.checkedd}>
{text.record.lei}
</a-checkbox>
*/}
</div>
);
},
@@ -1558,9 +1553,9 @@ export default {
});
const changebgc = (chapterId) => {
state.isactive = chapterId;
state.selectRow = [] //选择行
state.selectAll = 0 //0未选择1全选2部分选择
dataAssignment(chapterId);
state.selectRow = []; //选择行
state.selectAll = 0; //0未选择1全选2部分选择
dataAssignment(chapterId);
};
const gqxy_hShow = () => {
state.gqxy_hs = !state.gqxy_hs;
@@ -1574,6 +1569,7 @@ export default {
};
const showDeleteModal = (id) => {
state.deleteID = id;
console.log(id);
state.deleteModal = true;
};
const closeConfirm = () => {
@@ -1582,14 +1578,17 @@ export default {
state.editID = "";
};
const deleteLevelTask = () => {
RouterDeleteTask(state.listChoosedId)
.then((res) => {
console.log(`删除成功${res}`);
message.success("删除成功");
})
.catch((err) => {
console.log(`删除失败${err}`);
});
deleteStudyTask({ routerTaskIds: state.deleteID }).then((res) =>
console.log("删除成功", res)
);
// RouterDeleteTask(state.listChoosedId)
// .then((res) => {
// console.log(`删除成功${res}`);
// message.success("删除成功");
// })
// .catch((err) => {
// console.log(`删除失败${err}`);
// });
};
const showDrawerAddLive = () => {
@@ -1663,50 +1662,50 @@ export default {
//批量删除任务
const deletecTaskAll = () => {
let arr = state.selectRow;
console.log("选择的行信息",arr);
arr.map( value => {
console.log("选择的行信息", arr);
arr.map((value) => {
let obj = {
routerTaskIds: value,
}
console.log("value",value);
};
console.log("value", value);
api
.deleteTask(obj)
.then((res) => {
console.log(res);
message.destroy();
message.success("批量删除成功");
})
.catch((err) => {
console.log(err);
});
})
}
.deleteTask(obj)
.then((res) => {
console.log(res);
message.destroy();
message.success("批量删除成功");
})
.catch((err) => {
console.log(err);
});
});
};
//移动任务到关卡
const moveTask = () => {
let arr = state.selectRow;
console.log("选择的行信息",arr);
console.log("选择的关卡id",state.isactive);
arr.map( value => {
console.log("value:",value);
console.log("选择的行信息", arr);
console.log("选择的关卡id", state.isactive);
arr.map((value) => {
console.log("value:", value);
let obj = {
chapterId: state.isactive,
routerTaskIdList: value,
}
routerTaskIdList: value,
};
api
.moveTask(obj)
.then((res) => {
console.log("移动成功",res);
console.log("移动成功", res);
message.destroy();
message.success("移动成功");
})
.catch((err) => {
console.log("移动失败",err);
})
})
console.log("移动失败", err);
});
});
};
return {
...toRefs(state),
tableDataFunc,
// tableDataFunc,
tableDataFunc2,
showDrawer,
closeDrawer,
@@ -1741,6 +1740,7 @@ export default {
changeRow,
deletecTaskAll,
moveTask,
showDeleteModal,
};
},
};