|
@@ -3151,7 +3151,7 @@ const setAttachmentListRef = (el) => {
|
|
|
|
|
|
// 初始化拖拽功能
|
|
|
const initDragAndDrop = () => {
|
|
|
- attachmentListRefs.value.forEach((container) => {
|
|
|
+ attachmentListRefs.value.forEach((container, index) => {
|
|
|
const items = container.querySelectorAll('.hc-attachment-item')
|
|
|
|
|
|
items.forEach((item) => {
|
|
@@ -3172,6 +3172,15 @@ const initDragAndDrop = () => {
|
|
|
i.classList.remove('dragging')
|
|
|
i.style.display = ''
|
|
|
})
|
|
|
+
|
|
|
+ // 获取新的顺序
|
|
|
+ const newOrder = Array.from(container.querySelectorAll('.hc-attachment-item')).map(item => item.dataset.id)
|
|
|
+
|
|
|
+ // 更新 attachmentList.value 中对应项的 fileList 顺序
|
|
|
+ const attachment = attachmentList.value[index]
|
|
|
+ if (attachment) {
|
|
|
+ attachment.fileList = attachment.fileList.sort((a, b) => newOrder.indexOf(a.id) - newOrder.indexOf(b.id))
|
|
|
+ }
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -3228,6 +3237,7 @@ const saveFileOrderLoad = ref(false)
|
|
|
const saveFileOrder = async () => {
|
|
|
|
|
|
saveFileOrderLoad.value = true
|
|
|
+ console.log(attachmentList.value, 'attachmentList.value')
|
|
|
|
|
|
const { error, code, msg } = await wbsApi.sortPdf( attachmentList.value)
|
|
|
saveFileOrderLoad.value = false
|