From a9e4f9d0af39c3ab3879c0d076b07ee0a605698f Mon Sep 17 00:00:00 2001 From: 100011797 <2642441182@qq.com> Date: Mon, 3 Jul 2023 11:57:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Layout/components/NoticeItem.vue | 8 +- .../Instance/Detail/MetadataMap/index.vue | 88 ++++++++++++------- .../Product/Detail/MetadataMap/index.vue | 86 +++++++++++++++--- .../Save/components/NotifyConfig.vue | 6 ++ 4 files changed, 140 insertions(+), 48 deletions(-) diff --git a/src/components/Layout/components/NoticeItem.vue b/src/components/Layout/components/NoticeItem.vue index 2aba964f..9d82b2d6 100644 --- a/src/components/Layout/components/NoticeItem.vue +++ b/src/components/Layout/components/NoticeItem.vue @@ -21,7 +21,7 @@ }} -

{{ props.data?.message }}

+
{{ props.data?.message }}
查看详情 @@ -100,7 +100,7 @@ const read = (type: '_read' | '_unread') => { .list-items { width: 312px; overflow: hidden; - height: 100px; + height: 80px; border-bottom: 1px solid #f0f0f0; margin: 0 24px; box-sizing: content-box; @@ -116,7 +116,7 @@ const read = (type: '_read' | '_unread') => { .list-item-left { padding: 12px 0; width: 312px; - height: 100px; + height: 80px; .header { display: flex; align-items: center; @@ -143,7 +143,7 @@ const read = (type: '_read' | '_unread') => { } } - p { + .message { font-size: 12px; } } diff --git a/src/views/device/Instance/Detail/MetadataMap/index.vue b/src/views/device/Instance/Detail/MetadataMap/index.vue index 18c8270f..477f7a25 100644 --- a/src/views/device/Instance/Detail/MetadataMap/index.vue +++ b/src/views/device/Instance/Detail/MetadataMap/index.vue @@ -20,7 +20,14 @@ > @@ -58,7 +86,8 @@ :disabled=" selectedOriginalKeys.includes(item.id) " - >{{ item.label }} ({{ + > + {{ item.label }} ({{ item.id }}) @@ -100,6 +129,7 @@ import { getProtocolMetadata, } from '@/api/device/instance'; import { useInstanceStore } from '@/store/instance'; +import { cloneDeep } from 'lodash-es'; const deviceStore = useInstanceStore(); const { current: deviceDetail } = storeToRefs(deviceStore); @@ -107,6 +137,9 @@ const dataSourceCache = ref([]); const dataSource = ref([]); const targetOptions = ref([]); +const filterValue = ref(undefined); +const originalData = ref([]); + const columns = [ { title: '序号', @@ -121,33 +154,6 @@ const columns = [ title: '目标属性', dataIndex: 'original', width: 250, - sorter: { - compare: (a, b) => - (a.original?.length || 0) - (b.original?.length || 0), - }, - // filters: [ - // { - // text: '置顶已映射数据', - // value: true, - // }, - // { - // text: '置顶未映射数据', - // value: false, - // }, - // ], - // filterMultiple: false, - // onFilter: (value: string) => { - // const _dataSource = cloneDeep(dataSource.value).sort((a: any, b: any) => { - // if(!value) { - // return (a.original ? 1 : -1) - (b.original ? 1 : -1) - // } else { - // return (b.original ? 1 : -1) - (a.original ? 1 : -1) - // } - // }) - // console.log(value) - // dataSource.value = _dataSource - // return true - // }, }, ]; @@ -204,6 +210,9 @@ const search = (value: string) => { const getDefaultMetadata = async () => { const properties = metadata.value?.properties; + if (!deviceDetail.value?.protocol) { + return; + } const _metadata = await getMetadata(); const _properties = _metadata?.properties || []; const metadataMap: any = await getMetadataMapData(); @@ -266,6 +275,25 @@ const onChange = async (value: any, id: string) => { } }; +const onFilter = ({ key }: any) => { + originalData.value = dataSource.value + const _dataSource = cloneDeep(dataSource.value).sort((a: any, b: any) => { + if (!key) { + return (a.original ? 1 : -1) - (b.original ? 1 : -1); + } else { + return (b.original ? 1 : -1) - (a.original ? 1 : -1); + } + }); + + dataSource.value = _dataSource; + filterValue.value = key; +}; + +const onClose = () => { + filterValue.value = undefined; + dataSource.value = originalData.value; +}; + onMounted(() => { getDefaultMetadata(); }); diff --git a/src/views/device/Product/Detail/MetadataMap/index.vue b/src/views/device/Product/Detail/MetadataMap/index.vue index d4e9f666..f9c5003c 100644 --- a/src/views/device/Product/Detail/MetadataMap/index.vue +++ b/src/views/device/Product/Detail/MetadataMap/index.vue @@ -20,17 +20,48 @@ > -