mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-20 00:06:47 +08:00
--fix bug
This commit is contained in:
@@ -60,7 +60,7 @@ const rulesRef = ref({
|
|||||||
|
|
||||||
const { validate } = Form.useForm(formData, rulesRef);
|
const { validate } = Form.useForm(formData, rulesRef);
|
||||||
|
|
||||||
const selectIds = computed(()=>props.chapterList.flatMap(t=>props.infoType===1?t.taskDraftDtoList:t.draftTaskList)?.filter(s=>s?.type==props.type).map(t=>t.courseId).join(',') || '')
|
const selectIds = computed(()=>props.chapterList.flatMap(t=>props.infoType===1?t.taskDraftDtoList:props.infoType===2?t.draftTaskList:t.taskTemplateList)?.filter(s=>s?.type==props.type).map(t=>t.courseId).join(',') || '')
|
||||||
|
|
||||||
const closeDrawer = () => {
|
const closeDrawer = () => {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
|
|||||||
@@ -597,9 +597,7 @@ const cancelStorage = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 开课按钮
|
// 开课按钮
|
||||||
const openCourse = (ele) => {
|
const openCourse = (ele) => coursePlanRef.value.openDrawer(ele);
|
||||||
coursePlanRef.value.openDrawer(ele);
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.ConfirmModal {
|
.ConfirmModal {
|
||||||
|
|||||||
@@ -533,6 +533,7 @@ const showModal = () => {
|
|||||||
};
|
};
|
||||||
const editModal = () => {
|
const editModal = () => {
|
||||||
formValue.value = projectInfo.value.stageList[activeIndex.value]
|
formValue.value = projectInfo.value.stageList[activeIndex.value]
|
||||||
|
formValue.value.edit = true
|
||||||
stage.value = true
|
stage.value = true
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -542,7 +543,7 @@ function editStage() {
|
|||||||
message.warning("请输入阶段名称!");
|
message.warning("请输入阶段名称!");
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if(formValue.value.id){
|
if(formValue.value.edit){
|
||||||
stage.value = false
|
stage.value = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<img src="../../assets/images/projectadd/right.png" style="margin-left: 10px; cursor: pointer"
|
<img src="../../assets/images/projectadd/right.png" style="margin-left: 10px; cursor: pointer"
|
||||||
@click="showCancel" v-show="projectInfo.stageList[0].id != '0'" />
|
@click="showCancel" v-show="projectInfo.stageList[0].id != '0'" />
|
||||||
</div>
|
</div>
|
||||||
<div class="btn btn3" @click="showModal({}, 'add')" style="margin-left: 19px">
|
<div class="btn btn3" @click="showModal()" style="margin-left: 19px">
|
||||||
<div class="search"></div>
|
<div class="search"></div>
|
||||||
<div class="btnText">添加阶段</div>
|
<div class="btnText">添加阶段</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -33,10 +33,10 @@
|
|||||||
<span style="font-size: 12px; color: #ffffff">说明</span>
|
<span style="font-size: 12px; color: #ffffff">说明</span>
|
||||||
</div>
|
</div>
|
||||||
</a-popover>
|
</a-popover>
|
||||||
<div class="imgIcon" @click="showModal(element, 'edit')"></div>
|
<div class="imgIcon" @click="editModal()"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="boxs_right">
|
<div class="boxs_right">
|
||||||
<div class="imgIcon" @click="showDeleteStage(index)"></div>
|
<div class="imgIcon" @click="deleteStage()"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items2">
|
<div class="items2">
|
||||||
@@ -98,7 +98,8 @@
|
|||||||
<div class="mid">
|
<div class="mid">
|
||||||
<div class="item" v-for="(value, key) in TASK_TYPE" :key="key">
|
<div class="item" v-for="(value, key) in TASK_TYPE" :key="key">
|
||||||
<div v-if="key != 13">
|
<div v-if="key != 13">
|
||||||
<component :is="value.component" :ref="el => courseRef['el' + key] = el" :type="key" :infoType="1" :id="projectInfo.projectTemplateInfo?.id"
|
<component :is="value.component" :ref="el => courseRef['el' + key] = el" :type="key" :infoType="3" :id="projectInfo.projectTemplateInfo?.id"
|
||||||
|
:chapter-list="projectInfo.stageList"
|
||||||
v-model:task-list="projectInfo.stageList[activeIndex].taskTemplateList">
|
v-model:task-list="projectInfo.stageList[activeIndex].taskTemplateList">
|
||||||
<div class="itcon">
|
<div class="itcon">
|
||||||
<div class="img">
|
<div class="img">
|
||||||
@@ -317,8 +318,8 @@
|
|||||||
<div class="namebox">
|
<div class="namebox">
|
||||||
<div class="inname">阶段说明:</div>
|
<div class="inname">阶段说明:</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="intext" style="margin-left: 14px">
|
<div class="intext" style="margin-left: 14px;width:384px">
|
||||||
<a-textarea v-model:value="formValue.remark" style="height: 88px" show-count :maxlength="100"
|
<a-textarea v-model:value="formValue.remark" style="height: 88px;width:384px" show-count :maxlength="100"
|
||||||
placeholder="请输入阶段说明" />
|
placeholder="请输入阶段说明" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -357,7 +358,7 @@
|
|||||||
</a-modal>
|
</a-modal>
|
||||||
</div>
|
</div>
|
||||||
<!-- 确认添加阶段弹窗 -->
|
<!-- 确认添加阶段弹窗 -->
|
||||||
<a-modal v-model:visible="confirmModal" :footer="null" wrapClassName="ConfirmModal" centered="true">
|
<a-modal v-model:visible="confirmModal" :footer="null" wrapClassName="ConfirmModal" :centered="true">
|
||||||
<div class="delete">
|
<div class="delete">
|
||||||
<div class="del_header"></div>
|
<div class="del_header"></div>
|
||||||
<div class="del_main">
|
<div class="del_main">
|
||||||
@@ -381,7 +382,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
<!-- 确认取消阶段弹窗 -->
|
<!-- 确认取消阶段弹窗 -->
|
||||||
<a-modal v-model:visible="cancelModal" :footer="null" wrapClassName="ConfirmModal" centered="true">
|
<a-modal v-model:visible="cancelModal" :footer="null" wrapClassName="ConfirmModal" :centered="true">
|
||||||
<div class="delete">
|
<div class="delete">
|
||||||
<div class="del_header"></div>
|
<div class="del_header"></div>
|
||||||
<div class="del_main">
|
<div class="del_main">
|
||||||
@@ -482,68 +483,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
|
||||||
<!-- 是否删除阶段弹窗 -->
|
|
||||||
<a-modal v-model:visible="deleteStageModal" :footer="null" :closable="cC" wrapClassName="ConfirmModal"
|
|
||||||
centered="true">
|
|
||||||
<div class="delete">
|
|
||||||
<div class="del_header"></div>
|
|
||||||
<div class="del_main">
|
|
||||||
<div class="header">
|
|
||||||
<div class="icon"></div>
|
|
||||||
<span>提示</span>
|
|
||||||
<!-- <div class="close_exit" @click="closeDeleteStage"></div> -->
|
|
||||||
</div>
|
|
||||||
<div class="body">
|
|
||||||
<span style="width:320px;display:flex;justify-content:center;align-items:center;">{{
|
|
||||||
projectInfo.stageList?.length === 1 ? "当前为最后一个阶段,删除后任务将被移出,为无阶段模式,确认删除阶段吗?" : "您确定要删除此阶段"
|
|
||||||
}}</span>
|
|
||||||
</div>
|
|
||||||
<div class="del_btnbox">
|
|
||||||
<div class="del_btn btn2" @click="closeDeleteStage" style="margin-right: 32px;">
|
|
||||||
<div class="btnText">取消</div>
|
|
||||||
</div>
|
|
||||||
<div class="del_btn btn2" @click="deleteStage">
|
|
||||||
<div class="btnText">确定</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a-modal>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onMounted, onUnmounted, ref, watch, } from "vue";
|
import { computed, onMounted, ref, watch, } from "vue";
|
||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import * as api from "../../api/indexTemplate";
|
import * as api from "@/api/indexTemplate";
|
||||||
import Draggable from "vuedraggable";
|
import Draggable from "vuedraggable";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import { TASK_TYPE } from "@/utils/const";
|
import { TASK_TYPE } from "@/utils/const";
|
||||||
import { request } from "@/api/request";
|
import { request } from "@/api/request";
|
||||||
import { PROJECT_TEMPLATE_DETAIL_MODIFY } from "@/api/apis";
|
import { PROJECT_TEMPLATE_DETAIL_MODIFY } from "@/api/apis";
|
||||||
|
import dialog from "@/utils/dialog";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const courseRef = ref({})
|
const courseRef = ref({})
|
||||||
const visiblene = ref(false);
|
const visiblene = ref(false);
|
||||||
const deAll = ref(false);
|
const deAll = ref(false);
|
||||||
const deleteModal = ref(false);
|
const deleteModal = ref(false);
|
||||||
const confirmModal = ref(false);
|
|
||||||
const stage = ref(false);
|
const stage = ref(false);
|
||||||
const ischapterEdit = ref(false);//修改阶段标志
|
|
||||||
const cancelModal = ref(false);
|
const cancelModal = ref(false);
|
||||||
const deleteStageModal = ref(false);
|
|
||||||
const templateLoading = ref(false);
|
const templateLoading = ref(false);
|
||||||
const cancleLoading = ref(false);
|
const cancleLoading = ref(false);
|
||||||
const projectInfo = ref({
|
const projectInfo = ref({
|
||||||
stageList: [{
|
stageList: [{
|
||||||
"id": "0",
|
"id": "0",
|
||||||
taskTemplateList: [{
|
taskTemplateList: [{}]
|
||||||
}]
|
|
||||||
}],
|
}],
|
||||||
projectTemplateInfo: {
|
projectTemplateInfo: {}
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
const activeIndex = ref(0);
|
const activeIndex = ref(0);
|
||||||
const moveChapterIndex = ref(0);
|
const moveChapterIndex = ref(0);
|
||||||
@@ -579,7 +547,7 @@ function changeStageIndex(index) {
|
|||||||
const getTask = async () => {
|
const getTask = async () => {
|
||||||
await api.templateEditDetail(route.query.projectId).then((res) => {
|
await api.templateEditDetail(route.query.projectId).then((res) => {
|
||||||
projectInfo.value = res.data.data
|
projectInfo.value = res.data.data
|
||||||
if (projectInfo.value.stageList.length == 0) {
|
if (projectInfo.value.stageList.length === 0) {
|
||||||
projectInfo.value.stageList = [{
|
projectInfo.value.stageList = [{
|
||||||
"id": "0",
|
"id": "0",
|
||||||
taskTemplateList: []
|
taskTemplateList: []
|
||||||
@@ -635,94 +603,80 @@ const closeModal = () => {
|
|||||||
stage.value = false
|
stage.value = false
|
||||||
};
|
};
|
||||||
//显示添加阶段弹窗
|
//显示添加阶段弹窗
|
||||||
const showModal = (e, type) => {
|
const showModal = () => {
|
||||||
ischapterEdit.value = (type === "edit");
|
formValue.value = {taskTemplateList: []}
|
||||||
console.log(ischapterEdit.value)
|
stage.value = true
|
||||||
if (type == 'edit') {
|
};
|
||||||
console.log("阶段信息:" + e.name);
|
const editModal = () => {
|
||||||
formValue.value = e;//回传修改的信息
|
formValue.value = projectInfo.value.stageList[activeIndex.value]
|
||||||
} else {
|
formValue.value.edit = true
|
||||||
formValue.value = {};
|
|
||||||
}
|
|
||||||
stage.value = true
|
stage.value = true
|
||||||
};
|
};
|
||||||
|
|
||||||
//添加阶段
|
//添加阶段
|
||||||
function editStage() {
|
function editStage() {
|
||||||
if (!formValue.value.name) {
|
if (!formValue.value.name) {
|
||||||
message.warning("请输入阶段名称!");
|
message.warning("请输入阶段名称!");
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//是否修改阶段2023-02-27add
|
if(formValue.value.edit){
|
||||||
if (ischapterEdit.value) {//修改
|
stage.value = false
|
||||||
projectInfo.value.stageList[activeIndex.value] = formValue.value;
|
return
|
||||||
} else {//添加
|
|
||||||
projectInfo.value.stageList.push({ ...formValue.value })
|
|
||||||
}
|
}
|
||||||
//替换 默认阶段
|
//替换 默认阶段
|
||||||
if (projectInfo.value.stageList.length === 1 && projectInfo.value.stageList[0].id === '0') {
|
if (projectInfo.value.stageList.length === 1 && projectInfo.value.stageList[0].id === '0') {
|
||||||
formValue.value.taskTemplateList = [...projectInfo.value.stageList[0].taskTemplateList]
|
formValue.value.taskTemplateList = [...projectInfo.value.stageList[0].taskTemplateList]
|
||||||
console.log("修改后的阶段信息:" + JSON.stringify(projectInfo.value.stageList[activeIndex.value]))
|
projectInfo.value.stageList.push({...formValue.value})
|
||||||
projectInfo.value.stageList.splice(0, 1)
|
projectInfo.value.stageList.splice(0, 1)
|
||||||
} else {
|
} else {
|
||||||
|
projectInfo.value.stageList.push({...formValue.value})
|
||||||
activeIndex.value = activeIndex.value + 1
|
activeIndex.value = activeIndex.value + 1
|
||||||
console.log("activeIndex.value:" + activeIndex.value);
|
|
||||||
}
|
}
|
||||||
formValue.value = { taskTemplateList: [] }
|
console.log(projectInfo.value.stageList);
|
||||||
|
formValue.value = {taskTemplateList: []}
|
||||||
stage.value = false
|
stage.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
//打开删除阶段弹窗
|
|
||||||
const showDeleteStage = (index) => {
|
|
||||||
deleteStageModal.value = true;
|
|
||||||
deleteIndex.value = index;
|
|
||||||
};
|
|
||||||
//关闭删除阶段弹窗
|
|
||||||
const closeDeleteStage = () => {
|
|
||||||
deleteStageModal.value = false;
|
|
||||||
};
|
|
||||||
//删除阶段
|
//删除阶段
|
||||||
const deleteStage = () => {
|
const deleteStage = () => {
|
||||||
console.log("删除阶段前的数据:" + JSON.stringify(projectInfo.value));
|
dialog({
|
||||||
if (projectInfo.value.stageList.length === 1) {
|
content: projectInfo.value.stageList.length === 1 ? "当前为最后一个阶段,删除后任务将被移出,为无阶段模式,确认删除阶段吗?" : '确认删除此阶段吗?',
|
||||||
projectInfo.value.stageList = [{ id: '0', stageId: '0', name: '', remark: '', taskTemplateList: [] }];
|
ok: () => {
|
||||||
deleteStageModal.value = false;
|
message.success("删除成功");
|
||||||
return
|
if (projectInfo.value.stageList[activeIndex.value].id) {
|
||||||
|
projectInfo.value.stageList[activeIndex.value].deleted = true
|
||||||
|
projectInfo.value.stageList[activeIndex.value].taskTemplateList?.forEach((t, i) => t.id ? (t.deleted = true) : projectInfo.value.stageList[activeIndex.value].taskTemplateList.splice(i, 1));
|
||||||
|
} else {
|
||||||
|
projectInfo.value.stageList.splice(activeIndex.value, 1)
|
||||||
}
|
}
|
||||||
projectInfo.value.stageList[activeIndex.value].deleted = true;
|
activeIndex.value && (activeIndex.value = activeIndex.value - 1);
|
||||||
console.log("删除阶段后的数据:" + JSON.stringify(projectInfo.value));
|
},
|
||||||
activeIndex.value = activeIndex.value - 1;
|
});
|
||||||
deleteStageModal.value = false;
|
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(getTask);
|
||||||
document.getElementsByTagName("main")[0].style.background = "rgb(245, 247, 250,1)";
|
const showCancel = () => cancelModal.value = true;
|
||||||
document.getElementsByTagName("main")[0].style.boxShadow = "none";
|
const closeCancel = () => cancelModal.value = false;
|
||||||
getTask();
|
|
||||||
});
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
document.getElementsByTagName("main")[0].style.background = "#ffffff";
|
|
||||||
document.getElementsByTagName("main")[0].style.boxShadow = "0px 1px 35px 0px rgba(118, 136, 166, 0.07)";
|
|
||||||
});
|
|
||||||
const closeConfirm = () => {
|
|
||||||
confirmModal.value = false;
|
|
||||||
};
|
|
||||||
const showCancel = () => {
|
|
||||||
cancelModal.value = true;
|
|
||||||
};
|
|
||||||
const closeCancel = () => {
|
|
||||||
cancelModal.value = false;
|
|
||||||
};
|
|
||||||
const showDelete = (index) => {
|
const showDelete = (index) => {
|
||||||
deleteModal.value = true;
|
deleteModal.value = true;
|
||||||
deleteIndex.value = index
|
deleteIndex.value = index
|
||||||
};
|
};
|
||||||
const closeDelete = () => {
|
const closeDelete = () => deleteModal.value = false;
|
||||||
deleteModal.value = false;
|
|
||||||
};
|
|
||||||
// 删除所有阶段
|
// 删除所有阶段
|
||||||
const removeAllLevel = () => {
|
const removeAllLevel = () => {
|
||||||
|
dialog({
|
||||||
|
content: '确定要删除所有阶段吗?',
|
||||||
|
ok: () => {
|
||||||
|
message.success("删除成功");
|
||||||
|
projectInfo.value.stageList.forEach((t, i) => {
|
||||||
|
if (t.id) {
|
||||||
|
t.checked = false;
|
||||||
|
t.deleted = true;
|
||||||
|
} else {
|
||||||
|
projectInfo.value.stageList.splice(i, 1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
//全选任务或全不选任务
|
//全选任务或全不选任务
|
||||||
const selectRowAll = () => {
|
const selectRowAll = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user