mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-15 05:46:45 +08:00
--fix bug
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import http from "./config";
|
import http from "./config";
|
||||||
//获取任务列表
|
//获取任务列表
|
||||||
export const getTask = (obj) => http.get('/admin/project/detail', { params: obj })
|
export const getTask = (obj) => http.get('/admin/project/detail', { params: obj })
|
||||||
|
export const getDraftTask = (obj) => http.get('/admin/project/detailDraft', { params: obj })
|
||||||
|
|
||||||
//项目里的新建或编辑阶段任务
|
//项目里的新建或编辑阶段任务
|
||||||
export const addTask = (obj) => http.post('/admin/project/editTask', obj)
|
export const addTask = (obj) => http.post('/admin/project/editTask', obj)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<Draggable v-model="projectInfo.stageList" chosenClass="chosen" ghostClass="ghost" forceFallback="true"
|
<Draggable v-model="projectInfo.stageList" chosenClass="chosen" ghostClass="ghost" forceFallback="true"
|
||||||
group="stage" animation="500">
|
group="stage" animation="500">
|
||||||
<template #item="{ element,index }">
|
<template #item="{ element,index }">
|
||||||
<div class="items" v-if="element.id !==0" :class="activeIndex === index ? 'active' : ''"
|
<div class="items" v-if="element.id !=='0'" :class="activeIndex === index ? 'active' : ''"
|
||||||
@click="changeStageIndex(index)">
|
@click="changeStageIndex(index)">
|
||||||
<div class="items1">
|
<div class="items1">
|
||||||
<div class="boxs_left">
|
<div class="boxs_left">
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
<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">
|
||||||
<component :is="value.component" :ref="el=>courseRef['el'+key]=el" :type="key"
|
<component :is="value.component" :ref="el=>courseRef['el'+key]=el" :type="key"
|
||||||
v-model:task-list="projectInfo.stageList[activeIndex].taskList">
|
v-model:task-list="projectInfo.stageList[activeIndex].taskDraftDtoList">
|
||||||
<div class="itcon">
|
<div class="itcon">
|
||||||
<div class="img">
|
<div class="img">
|
||||||
<img :src="value.img"/>
|
<img :src="value.img"/>
|
||||||
@@ -180,7 +180,7 @@
|
|||||||
操作
|
操作
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Draggable v-model="projectInfo.stageList[activeIndex].taskList" chosenClass="chosen" ghostClass="ghost"
|
<Draggable v-model="projectInfo.stageList[activeIndex].taskDraftDtoList" chosenClass="chosen" ghostClass="ghost"
|
||||||
forceFallback="true" group="task" animation="500">
|
forceFallback="true" group="task" animation="500">
|
||||||
<template #item="{ element,index }">
|
<template #item="{ element,index }">
|
||||||
<div style="
|
<div style="
|
||||||
@@ -407,7 +407,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
<!-- 确认删除任务弹窗 -->
|
<!-- 确认删除任务弹窗 -->
|
||||||
<a-modal v-model:visible="deleteModal" :footer="null" :closable="cC" wrapClassName="ConfirmModal"
|
<a-modal v-model:visible="deleteModal" :footer="null" wrapClassName="ConfirmModal"
|
||||||
centered="true">
|
centered="true">
|
||||||
<div class="delete">
|
<div class="delete">
|
||||||
<div class="del_header"></div>
|
<div class="del_header"></div>
|
||||||
@@ -466,7 +466,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mid">
|
<div class="mid">
|
||||||
<div class="inher">
|
<div class="inher">
|
||||||
<div class="cur">已选中{{ projectInfo.stageList[activeIndex]?.taskList?.filter(t=>t.checked)?.length }}个任务</div>
|
<div class="cur">已选中{{
|
||||||
|
projectInfo.stageList[activeIndex]?.taskDraftDtoList?.filter(t => t.checked)?.length
|
||||||
|
}}个任务
|
||||||
|
</div>
|
||||||
<div class="select">
|
<div class="select">
|
||||||
<a-select v-model:value="moveChapterIndex" style="width: 100%" placeholder="请选择阶段" allowClear
|
<a-select v-model:value="moveChapterIndex" style="width: 100%" placeholder="请选择阶段" allowClear
|
||||||
:options="projectInfo.stageList.map(({name:label},value)=>({label,value,disabled:value===activeIndex}))"></a-select>
|
:options="projectInfo.stageList.map(({name:label},value)=>({label,value,disabled:value===activeIndex}))"></a-select>
|
||||||
@@ -537,19 +540,19 @@ const deleteStageModal = ref(false);
|
|||||||
const templateLoading = ref(false);
|
const templateLoading = ref(false);
|
||||||
const confirmLoading = ref(false);
|
const confirmLoading = ref(false);
|
||||||
const cancleLoading = ref(false);
|
const cancleLoading = ref(false);
|
||||||
const projectInfo = ref({stageList: [{taskList: [{}]}], projectInfo: {}});
|
const projectInfo = ref({stageList: [{taskDraftDtoList: [{}]}], projectInfo: {}});
|
||||||
const activeIndex = ref(0);
|
const activeIndex = ref(0);
|
||||||
const moveChapterIndex = ref(0);
|
const moveChapterIndex = ref(0);
|
||||||
const deleteIndex = ref(0);
|
const deleteIndex = ref(0);
|
||||||
const formValue = ref({taskList: []});
|
const formValue = ref({taskDraftDtoList: []});
|
||||||
|
|
||||||
|
|
||||||
const selectAll = computed(() => {
|
const selectAll = computed(() => {
|
||||||
const selectedNum = projectInfo.value?.stageList[activeIndex.value]?.taskList?.filter(t => t.checked)?.length
|
const selectedNum = projectInfo.value?.stageList[activeIndex.value]?.taskDraftDtoList?.filter(t => t.checked)?.length
|
||||||
if (!selectedNum) {
|
if (!selectedNum) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if (selectedNum === projectInfo.value?.stageList[activeIndex.value]?.taskList?.length) {
|
if (selectedNum === projectInfo.value?.stageList[activeIndex.value]?.taskDraftDtoList?.length) {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
return 2
|
return 2
|
||||||
@@ -561,13 +564,7 @@ function changeStageIndex(index) {
|
|||||||
|
|
||||||
//获取任务列表
|
//获取任务列表
|
||||||
const getTask = async () => {
|
const getTask = async () => {
|
||||||
await api.getTask({projectId: route.query.projectId}).then((res) => {
|
await api.getDraftTask({projectId: route.query.projectId}).then((res) => {projectInfo.value = res.data.data});
|
||||||
projectInfo.value = res.data.data
|
|
||||||
});
|
|
||||||
//如果没有阶段就给个默认的阶段 但是并不存储
|
|
||||||
if (!projectInfo.value.stageList.length) {
|
|
||||||
projectInfo.value.stageList.push({id: 0, stageId: 0, name: '', remark: '', taskList: []})
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const editTaskForType = (ele, index) => {
|
const editTaskForType = (ele, index) => {
|
||||||
@@ -579,7 +576,7 @@ const showChangeModal = () => {
|
|||||||
message.warning("请添加阶段!");
|
message.warning("请添加阶段!");
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!projectInfo.value?.stageList[activeIndex.value]?.taskList?.filter(t => t.checked)?.length) {
|
if (!projectInfo.value?.stageList[activeIndex.value]?.taskDraftDtoList?.filter(t => t.checked)?.length) {
|
||||||
message.warning("请选择要移动的任务!");
|
message.warning("请选择要移动的任务!");
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -590,21 +587,21 @@ const closeChangeModal = () => {
|
|||||||
};
|
};
|
||||||
//移动任务到阶段
|
//移动任务到阶段
|
||||||
const moveTask = () => {
|
const moveTask = () => {
|
||||||
projectInfo.value.stageList[moveChapterIndex.value].taskList.push(...projectInfo.value.stageList[activeIndex.value].taskList.filter(t => t.checked).map((t) => ({
|
projectInfo.value.stageList[moveChapterIndex.value].taskDraftDtoList.push(...projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.filter(t => t.checked).map((t) => ({
|
||||||
...t,
|
...t,
|
||||||
checked: false
|
checked: false
|
||||||
})));
|
})));
|
||||||
projectInfo.value.stageList[activeIndex.value].taskList = projectInfo.value.stageList[activeIndex.value].taskList.filter(t => !t.checked);
|
projectInfo.value.stageList[activeIndex.value].taskDraftDtoList = projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.filter(t => !t.checked);
|
||||||
visiblene.value = false;
|
visiblene.value = false;
|
||||||
};
|
};
|
||||||
//批量删除
|
//批量删除
|
||||||
const deleteTaskAll = () => {
|
const deleteTaskAll = () => {
|
||||||
projectInfo.value.stageList[activeIndex.value].taskList = projectInfo.value.stageList[activeIndex.value].taskList.filter(t => !t.checked);
|
projectInfo.value.stageList[activeIndex.value].taskDraftDtoList = projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.filter(t => !t.checked);
|
||||||
deAll.value = false;
|
deAll.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const confirmDelTask = () => {
|
const confirmDelTask = () => {
|
||||||
projectInfo.value.stageList[activeIndex.value].taskList.splice(deleteIndex.value, 1)
|
projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.splice(deleteIndex.value, 1)
|
||||||
deleteModal.value = false
|
deleteModal.value = false
|
||||||
};
|
};
|
||||||
//关闭添加阶段弹窗
|
//关闭添加阶段弹窗
|
||||||
@@ -623,15 +620,15 @@ function editStage() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
//替换 默认阶段
|
//替换 默认阶段
|
||||||
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.taskList = [...projectInfo.value.stageList[0].taskList]
|
formValue.value.taskDraftDtoList = [...projectInfo.value.stageList[0].taskDraftDtoList]
|
||||||
projectInfo.value.stageList.push({...formValue.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})
|
projectInfo.value.stageList.push({...formValue.value})
|
||||||
activeIndex.value = activeIndex.value + 1
|
activeIndex.value = activeIndex.value + 1
|
||||||
}
|
}
|
||||||
formValue.value = {taskList: []}
|
formValue.value = {taskDraftDtoList: []}
|
||||||
stage.value = false
|
stage.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -646,7 +643,11 @@ const closeDeleteStage = () => {
|
|||||||
};
|
};
|
||||||
//删除阶段
|
//删除阶段
|
||||||
const deleteStage = () => {
|
const deleteStage = () => {
|
||||||
projectInfo.value.stageList.splice(deleteIndex.value, 1)
|
if (projectInfo.value.stageList.length === 1) {
|
||||||
|
projectInfo.value.stageList = [{id: '0', stageId: '0', name: '', remark: '', taskDraftDtoList: []}];
|
||||||
|
return
|
||||||
|
}
|
||||||
|
projectInfo.value.stageList.splice(activeIndex.value, 1)
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
document.getElementsByTagName("main")[0].style.background = "rgb(245, 247, 250,1)";
|
document.getElementsByTagName("main")[0].style.background = "rgb(245, 247, 250,1)";
|
||||||
@@ -681,13 +682,13 @@ const removeAllLevel = () => {
|
|||||||
//全选任务或全不选任务
|
//全选任务或全不选任务
|
||||||
const selectRowAll = () => {
|
const selectRowAll = () => {
|
||||||
if (selectAll.value === 1) {
|
if (selectAll.value === 1) {
|
||||||
projectInfo.value.stageList[activeIndex.value].taskList.forEach(t => t.checked = false)
|
projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.forEach(t => t.checked = false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
projectInfo.value.stageList[activeIndex.value].taskList.forEach(t => t.checked = true)
|
projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.forEach(t => t.checked = true)
|
||||||
};
|
};
|
||||||
const showdeAll = () => {
|
const showdeAll = () => {
|
||||||
if (!projectInfo.value?.stageList[activeIndex.value]?.taskList?.filter(t => t.checked)?.length) {
|
if (!projectInfo.value?.stageList[activeIndex.value]?.taskDraftDtoList?.filter(t => t.checked)?.length) {
|
||||||
message.warning("请选择要删除的任务!");
|
message.warning("请选择要删除的任务!");
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -701,6 +702,7 @@ const closeDeAll = () => {
|
|||||||
const temporaryStorage = async () => {
|
const temporaryStorage = async () => {
|
||||||
templateLoading.value = true
|
templateLoading.value = true
|
||||||
await request(PROJECT_DETAIL_MODIFY, projectInfo.value)
|
await request(PROJECT_DETAIL_MODIFY, projectInfo.value)
|
||||||
|
await getTask()
|
||||||
message.success("暂存成功");
|
message.success("暂存成功");
|
||||||
templateLoading.value = false
|
templateLoading.value = false
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user