fix: 修复右上角通知文件notification兼容处理

This commit is contained in:
xieyonghong 2023-04-26 10:25:49 +08:00
parent c99d2795bc
commit 5f8bc64b1e
2 changed files with 45 additions and 48 deletions

View File

@ -45,47 +45,43 @@ const subscribeNotice = () => {
total.value += 1; total.value += 1;
notification.open({ notification.open({
message: resp?.payload?.topicName, message: resp?.payload?.topicName,
description: () => ( description: () =>
<div h(
class="ellipsis" 'div',
style={{ cursor: 'pointer' }} {
onClick={() => { class: "ellipsis",
{ style: {
/* changeStatus_api('_read', [resp.id]); */ cursor: 'pointer'
} },
read('', resp); onClick: () => {
}} read('', resp);
> }
{resp?.payload?.message} },
</div> {
), default: () => resp?.payload?.message
}
)
,
onClick: () => { onClick: () => {
// changeStatus_api('_read', [resp.id]) // changeStatus_api('_read', [resp.id])
read('', resp); read('', resp);
}, },
key: resp.payload.id, key: resp.payload.id,
btn: ( btn: () =>
<Button h(
type="primary" Button,
size="small" {
onClick={(e) => { type: "primary",
{ size: "small",
/* changeStatus_api('_read', [resp.id]).then( onClick: (e: Event) => {
(resp: any) => { e.stopPropagation();
if (resp.status === 200) { read('_read', resp);
notification.close(resp.payload.id); }
getList(); },
} {
}, default: () => "标记已读"
); */ }
} ),
e.stopPropagation();
read('_read', resp);
}}
>
标记已读
</Button>
),
}); });
}); });
}; };

View File

@ -468,7 +468,7 @@ const columns = [
const subRef = ref(); const subRef = ref();
const propertyValue = ref(new Map()); const propertyValue = ref(new Map());
const cacheIds = ref<string>()
const showBatch = ref(false); const showBatch = ref(false);
const clickBatch = () => { const clickBatch = () => {
@ -657,15 +657,18 @@ const onCheckAllChange = (e: any) => {
watch( watch(
() => tableRef?.value?._dataSource, () => tableRef?.value?._dataSource,
(value) => { (value) => {
subRef.value?.unsubscribe();
if (value.length !== 0) { if (value.length !== 0) {
subscribeProperty(value); setTimeout(() => {
value.forEach((item: any) => { subscribeProperty(value);
item?.accessModes?.forEach((i: any) => { value.forEach((item: any) => {
if (i?.value === 'read') { item?.accessModes?.forEach((i: any) => {
ReadIdMap.set(item.id, item); if (i?.value === 'read') {
} ReadIdMap.set(item.id, item);
}); }
}); });
});
}, 100)
} }
cancelSelect(); cancelSelect();
checkAll.value = false; checkAll.value = false;
@ -701,9 +704,7 @@ watch(
); );
onUnmounted(() => { onUnmounted(() => {
if (subRef.value) { subRef.value?.unsubscribe();
subRef.value?.unsubscribe();
}
}); });
/** /**