perf: 支持项目调整排序

This commit is contained in:
kuaifan 2025-08-19 22:17:17 +08:00
parent 2a25cf3bbd
commit e237b4db1c
3 changed files with 22 additions and 2 deletions

View File

@ -1073,6 +1073,7 @@ export default {
list: nonPinnedItems.map(item => item.id) list: nonPinnedItems.map(item => item.id)
}, },
method: 'post', method: 'post',
spinner: 2000
}).then(({msg}) => { }).then(({msg}) => {
$A.messageSuccess(msg) $A.messageSuccess(msg)
}).catch(({msg}) => { }).catch(({msg}) => {

View File

@ -15,11 +15,11 @@
<Draggable <Draggable
:list="projectDraggableList" :list="projectDraggableList"
:animation="150" :animation="150"
:disabled="!!projectKeyValue" :disabled="!(isDragging && !projectKeyValue)"
tag="ul" tag="ul"
item-key="id" item-key="id"
draggable="li:not(.pinned)" draggable="li:not(.pinned)"
handle=".project-h1" handle=".project-item"
@scroll.native="onScroll" @scroll.native="onScroll"
@touchstart.native="onTouchStart" @touchstart.native="onTouchStart"
v-longpress="handleLongpress" v-longpress="handleLongpress"
@ -56,6 +56,9 @@
<span v-else class="percent-text">{{item.task_percent}}%</span> <span v-else class="percent-text">{{item.task_percent}}%</span>
</iCircle> </iCircle>
</div> </div>
<div v-show="isDragging && !projectKeyValue" class="item-sort">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12h18"/><path d="M3 18h18"/><path d="M3 6h18"/></svg>
</div>
</div> </div>
</li> </li>
<template v-if="projectLists.length === 0"> <template v-if="projectLists.length === 0">
@ -85,6 +88,9 @@
<DropdownItem @click.native="handleChatClick"> <DropdownItem @click.native="handleChatClick">
{{ $L('项目讨论') }} {{ $L('项目讨论') }}
</DropdownItem> </DropdownItem>
<DropdownItem v-if="!projectKeyValue" @click.native="isDragging=!isDragging">
{{ $L(isDragging ? '退出排序' : '调整排序') }}
</DropdownItem>
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
</div> </div>
@ -111,6 +117,7 @@ export default {
operateVisible: false, operateVisible: false,
operateItem: {}, operateItem: {},
isDragging: false,
projectDraggableList: [], projectDraggableList: [],
projectDragging: false, projectDragging: false,
} }
@ -182,6 +189,7 @@ export default {
list: nonPinnedItems.map(item => item.id) list: nonPinnedItems.map(item => item.id)
}, },
method: 'post', method: 'post',
spinner: 2000
}).then(({msg}) => { }).then(({msg}) => {
$A.messageSuccess(msg) $A.messageSuccess(msg)
}).catch(({msg}) => { }).catch(({msg}) => {

View File

@ -188,6 +188,17 @@
} }
} }
} }
.item-sort {
flex-shrink: 0;
padding-left: 16px;
display: flex;
align-items: center;
justify-content: flex-end;
> svg {
width: 20px;
height: 20px;
}
}
} }
} }
} }