From 9983dc5bb9494988c4d269ef6e0fd62b30f51e44 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Fri, 28 Jun 2024 17:15:00 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=A7=A3=E5=86=B3todo=E3=80=91?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=9C=89=E7=94=9F=E6=88=90=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E7=89=87=EF=BC=8C=E8=BD=AE=E8=AF=A2=E6=94=B9=E6=88=90?= =?UTF-8?q?=20get=20=E6=8E=A5=E5=8F=A3=E5=8E=BB=E8=BD=AE=E8=AF=A2=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=9F=BA=E4=BA=8E=20page=20=E8=BD=AE=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/image/ImageTask.vue | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/views/ai/image/ImageTask.vue b/src/views/ai/image/ImageTask.vue index 37134ba7..daec9a6b 100644 --- a/src/views/ai/image/ImageTask.vue +++ b/src/views/ai/image/ImageTask.vue @@ -78,12 +78,13 @@ const getImageList = async (apply: boolean = false) => { } pageTotal.value = total // 需要 watch 的数据 - imageList.value.map(item => { + const newWatImages = {} + imageList.value.forEach(item => { if (item.status === 10) { - watchImages.value[item.id] = item + newWatImages[item.id] = item } }) - + watchImages.value = newWatImages } finally { if (imageTaskLoadingInstance.value) { imageTaskLoadingInstance.value.close() @@ -98,18 +99,24 @@ const getImageList = async (apply: boolean = false) => { const refreshWatchImages = async () => { const imageIds = Object.keys(watchImages.value) if (imageIds.length < 1) { + console.log('refreshWatchImages 不刷新', imageIds) return } - const res = await ImageApi.getImageMyIds({ids: imageIds.join(',')}) as ImageRespVO[] + const res = await ImageApi.getImageMyIds({ids: imageIds.join(',')}) as ImageVO[] + const newWatchImages = {} res.forEach(image => { - const index = imageList.value.findIndex(oldImage => image.id === oldImage.id) - if (index !== -1) { - // 更新 imageList - imageList.value[index] = image - // 删除 watchImages - delete watchImages.value[image.id]; + if (image.status === 10) { + newWatchImages[image.id] = image + } else { + const index = imageList.value.findIndex(oldImage => image.id === oldImage.id) + if (index !== -1) { + // 更新 imageList + imageList.value[index] = image + } } }) + console.log('newWatchImages-done', newWatchImages) + watchImages.value = newWatchImages } /** 图片 - btn click */