From 5f8bc64b1e25d9f27d3eba6d23be6076ad6dae5c Mon Sep 17 00:00:00 2001 From: xieyonghong <18010623010@163.com> Date: Wed, 26 Apr 2023 10:25:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8F=B3=E4=B8=8A?= =?UTF-8?q?=E8=A7=92=E9=80=9A=E7=9F=A5=E6=96=87=E4=BB=B6notification?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Layout/components/Notice.vue | 68 +++++++++---------- .../DataCollect/Collector/Point/index.vue | 25 +++---- 2 files changed, 45 insertions(+), 48 deletions(-) diff --git a/src/components/Layout/components/Notice.vue b/src/components/Layout/components/Notice.vue index 25570448..b6485554 100644 --- a/src/components/Layout/components/Notice.vue +++ b/src/components/Layout/components/Notice.vue @@ -45,47 +45,43 @@ const subscribeNotice = () => { total.value += 1; notification.open({ message: resp?.payload?.topicName, - description: () => ( -
{ - { - /* changeStatus_api('_read', [resp.id]); */ - } - read('', resp); - }} - > - {resp?.payload?.message} -
- ), + description: () => + h( + 'div', + { + class: "ellipsis", + style: { + cursor: 'pointer' + }, + onClick: () => { + read('', resp); + } + }, + { + default: () => resp?.payload?.message + } + ) + , onClick: () => { // changeStatus_api('_read', [resp.id]) read('', resp); }, key: resp.payload.id, - btn: ( - - ), + btn: () => + h( + Button, + { + type: "primary", + size: "small", + onClick: (e: Event) => { + e.stopPropagation(); + read('_read', resp); + } + }, + { + default: () => "标记已读" + } + ), }); }); }; diff --git a/src/views/DataCollect/Collector/Point/index.vue b/src/views/DataCollect/Collector/Point/index.vue index c2fee56d..fea336b3 100644 --- a/src/views/DataCollect/Collector/Point/index.vue +++ b/src/views/DataCollect/Collector/Point/index.vue @@ -468,7 +468,7 @@ const columns = [ const subRef = ref(); const propertyValue = ref(new Map()); - +const cacheIds = ref() const showBatch = ref(false); const clickBatch = () => { @@ -657,15 +657,18 @@ const onCheckAllChange = (e: any) => { watch( () => tableRef?.value?._dataSource, (value) => { + subRef.value?.unsubscribe(); if (value.length !== 0) { - subscribeProperty(value); - value.forEach((item: any) => { - item?.accessModes?.forEach((i: any) => { - if (i?.value === 'read') { - ReadIdMap.set(item.id, item); - } - }); - }); + setTimeout(() => { + subscribeProperty(value); + value.forEach((item: any) => { + item?.accessModes?.forEach((i: any) => { + if (i?.value === 'read') { + ReadIdMap.set(item.id, item); + } + }); + }); + }, 100) } cancelSelect(); checkAll.value = false; @@ -701,9 +704,7 @@ watch( ); onUnmounted(() => { - if (subRef.value) { - subRef.value?.unsubscribe(); - } + subRef.value?.unsubscribe(); }); /**