--fix 排序

This commit is contained in:
yuping
2023-02-17 16:12:01 +08:00
parent 6f25303a58
commit 70f6d01594
2 changed files with 36 additions and 11 deletions

View File

@@ -16,7 +16,8 @@
<Draggable v-model="projectInfo.stageList" chosenClass="chosen" ghostClass="ghost" forceFallback="true"
group="stage" animation="500">
<template #item="{ element,index }">
<div class="items" v-if="element.id !=='0' && !element.deleted" :class="activeIndex === index ? 'active' : ''"
<div class="items" v-if="element.id !=='0' && !element.deleted"
:class="activeIndex === index ? 'active' : ''"
@click="changeStageIndex(index)">
<div class="items1">
<div class="boxs_left">
@@ -180,7 +181,8 @@
操作
</div>
</div>
<Draggable v-model="projectInfo.stageList[activeIndex].taskDraftDtoList" chosenClass="chosen" ghostClass="ghost"
<Draggable v-model="projectInfo.stageList[activeIndex].taskDraftDtoList" chosenClass="chosen"
ghostClass="ghost"
forceFallback="true" group="task" animation="500">
<template #item="{ element,index }">
<div style="
@@ -518,7 +520,7 @@
</template>
<script setup>
import {computed, onMounted, onUnmounted, ref,} from "vue";
import {computed, onMounted, onUnmounted, ref, watch,} from "vue";
import {message} from "ant-design-vue";
import * as api from "../../api/indexTaskadd";
import UnlockMode from "../../components/drawers/UnlockMode.vue";
@@ -558,13 +560,22 @@ const selectAll = computed(() => {
return 2
})
watch(() => projectInfo.value.stageList, () => {
projectInfo.value.stageList.forEach((t, i) => {
t.sort = i;
t.taskDraftDtoList?.forEach((s, j) => {s.sort = j})
})
}, {deep: true})
function changeStageIndex(index) {
activeIndex.value = index
}
//获取任务列表
const getTask = async () => {
await api.getDraftTask({projectId: route.query.projectId}).then((res) => {projectInfo.value = res.data.data});
await api.getDraftTask({projectId: route.query.projectId}).then((res) => {
projectInfo.value = res.data.data
});
};
const editTaskForType = (ele, index) => {
@@ -596,7 +607,7 @@ const moveTask = () => {
};
//批量删除
const deleteTaskAll = () => {
projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.filter(t => t.checked).forEach(t=>{
projectInfo.value.stageList[activeIndex.value].taskDraftDtoList.filter(t => t.checked).forEach(t => {
t.checked = false;
t.deleted = true;
})