--fix bug

This commit is contained in:
yuping
2023-03-30 00:05:12 +08:00
parent 74a8474eec
commit 991044074a
4 changed files with 65 additions and 112 deletions

View File

@@ -60,7 +60,7 @@ const rulesRef = ref({
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 = () => {
visible.value = false;

View File

@@ -597,9 +597,7 @@ const cancelStorage = async () => {
};
// 开课按钮
const openCourse = (ele) => {
coursePlanRef.value.openDrawer(ele);
};
const openCourse = (ele) => coursePlanRef.value.openDrawer(ele);
</script>
<style lang="scss">
.ConfirmModal {

View File

@@ -533,6 +533,7 @@ const showModal = () => {
};
const editModal = () => {
formValue.value = projectInfo.value.stageList[activeIndex.value]
formValue.value.edit = true
stage.value = true
};
@@ -542,7 +543,7 @@ function editStage() {
message.warning("请输入阶段名称!");
return
}
if(formValue.value.id){
if(formValue.value.edit){
stage.value = false
return
}

View File

@@ -8,7 +8,7 @@
<img src="../../assets/images/projectadd/right.png" style="margin-left: 10px; cursor: pointer"
@click="showCancel" v-show="projectInfo.stageList[0].id != '0'" />
</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="btnText">添加阶段</div>
</div>
@@ -33,10 +33,10 @@
<span style="font-size: 12px; color: #ffffff">说明</span>
</div>
</a-popover>
<div class="imgIcon" @click="showModal(element, 'edit')"></div>
<div class="imgIcon" @click="editModal()"></div>
</div>
<div class="boxs_right">
<div class="imgIcon" @click="showDeleteStage(index)"></div>
<div class="imgIcon" @click="deleteStage()"></div>
</div>
</div>
<div class="items2">
@@ -98,7 +98,8 @@
<div class="mid">
<div class="item" v-for="(value, key) in TASK_TYPE" :key="key">
<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">
<div class="itcon">
<div class="img">
@@ -317,8 +318,8 @@
<div class="namebox">
<div class="inname">阶段说明</div>
</div>
<div class="intext" style="margin-left: 14px">
<a-textarea v-model:value="formValue.remark" style="height: 88px" show-count :maxlength="100"
<div class="intext" style="margin-left: 14px;width:384px">
<a-textarea v-model:value="formValue.remark" style="height: 88px;width:384px" show-count :maxlength="100"
placeholder="请输入阶段说明" />
</div>
</div>
@@ -357,7 +358,7 @@
</a-modal>
</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="del_header"></div>
<div class="del_main">
@@ -381,7 +382,7 @@
</div>
</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="del_header"></div>
<div class="del_main">
@@ -482,68 +483,35 @@
</div>
</div>
</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>
</template>
<script setup>
import { computed, onMounted, onUnmounted, ref, watch, } from "vue";
import { computed, onMounted, ref, watch, } from "vue";
import { message } from "ant-design-vue";
import * as api from "../../api/indexTemplate";
import * as api from "@/api/indexTemplate";
import Draggable from "vuedraggable";
import { useRoute } from "vue-router";
import { TASK_TYPE } from "@/utils/const";
import { request } from "@/api/request";
import { PROJECT_TEMPLATE_DETAIL_MODIFY } from "@/api/apis";
import dialog from "@/utils/dialog";
const route = useRoute();
const courseRef = ref({})
const visiblene = ref(false);
const deAll = ref(false);
const deleteModal = ref(false);
const confirmModal = ref(false);
const stage = ref(false);
const ischapterEdit = ref(false);//修改阶段标志
const cancelModal = ref(false);
const deleteStageModal = ref(false);
const templateLoading = ref(false);
const cancleLoading = ref(false);
const projectInfo = ref({
stageList: [{
"id": "0",
taskTemplateList: [{
}]
taskTemplateList: [{}]
}],
projectTemplateInfo: {
}
projectTemplateInfo: {}
});
const activeIndex = ref(0);
const moveChapterIndex = ref(0);
@@ -579,7 +547,7 @@ function changeStageIndex(index) {
const getTask = async () => {
await api.templateEditDetail(route.query.projectId).then((res) => {
projectInfo.value = res.data.data
if (projectInfo.value.stageList.length == 0) {
if (projectInfo.value.stageList.length === 0) {
projectInfo.value.stageList = [{
"id": "0",
taskTemplateList: []
@@ -635,94 +603,80 @@ const closeModal = () => {
stage.value = false
};
//显示添加阶段弹窗
const showModal = (e, type) => {
ischapterEdit.value = (type === "edit");
console.log(ischapterEdit.value)
if (type == 'edit') {
console.log("阶段信息:" + e.name);
formValue.value = e;//回传修改的信息
} else {
formValue.value = {};
}
const showModal = () => {
formValue.value = {taskTemplateList: []}
stage.value = true
};
const editModal = () => {
formValue.value = projectInfo.value.stageList[activeIndex.value]
formValue.value.edit = true
stage.value = true
};
//添加阶段
function editStage() {
if (!formValue.value.name) {
message.warning("请输入阶段名称!");
return
}
//是否修改阶段2023-02-27add
if (ischapterEdit.value) {//修改
projectInfo.value.stageList[activeIndex.value] = formValue.value;
} else {//添加
projectInfo.value.stageList.push({ ...formValue.value })
if(formValue.value.edit){
stage.value = false
return
}
//替换 默认阶段
if (projectInfo.value.stageList.length === 1 && projectInfo.value.stageList[0].id === '0') {
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)
} else {
projectInfo.value.stageList.push({...formValue.value})
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
}
//打开删除阶段弹窗
const showDeleteStage = (index) => {
deleteStageModal.value = true;
deleteIndex.value = index;
};
//关闭删除阶段弹窗
const closeDeleteStage = () => {
deleteStageModal.value = false;
};
//删除阶段
const deleteStage = () => {
console.log("删除阶段前的数据:" + JSON.stringify(projectInfo.value));
if (projectInfo.value.stageList.length === 1) {
projectInfo.value.stageList = [{ id: '0', stageId: '0', name: '', remark: '', taskTemplateList: [] }];
deleteStageModal.value = false;
return
dialog({
content: projectInfo.value.stageList.length === 1 ? "当前为最后一个阶段,删除后任务将被移出,为无阶段模式,确认删除阶段吗?" : '确认删除此阶段吗?',
ok: () => {
message.success("删除成功");
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;
console.log("删除阶段后的数据:" + JSON.stringify(projectInfo.value));
activeIndex.value = activeIndex.value - 1;
deleteStageModal.value = false;
activeIndex.value && (activeIndex.value = activeIndex.value - 1);
},
});
};
onMounted(() => {
document.getElementsByTagName("main")[0].style.background = "rgb(245, 247, 250,1)";
document.getElementsByTagName("main")[0].style.boxShadow = "none";
getTask();
});
onMounted(getTask);
const showCancel = () => cancelModal.value = true;
const closeCancel = () => cancelModal.value = false;
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) => {
deleteModal.value = true;
deleteIndex.value = index
};
const closeDelete = () => {
deleteModal.value = false;
};
const closeDelete = () => deleteModal.value = false;
// 删除所有阶段
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 = () => {