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 @@
>
-
+
目标属性
-
+
{{
+ filterValue ? '已映射' : '未映射'
+ }}
+
+
+
+
+ 置顶已映射数据
+ 置顶未映射数据
+
+
+
@@ -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 @@
>
-
- 目标属性
-
-
-
+
+
+ 目标属性
+
+
+
+
{{
+ filterValue ? '已映射' : '未映射'
+ }}
+
+
+
+
+ 置顶已映射数据
+ 置顶未映射数据
+
+
+
+
-
+
@@ -50,7 +81,11 @@
:key='index + "_" + item.id'
:value='item.value'
:disabled='selectedPluginKeys.includes(item.id)'
- >{{ item.label }} ({{ item.id }})
+ >
+ {{ item.label }} ({{
+ item.id
+ }})
+
@@ -90,6 +125,7 @@ import { detail as queryPluginAccessDetail } from '@/api/link/accessConfig'
import { getPluginData, getProductByPluginId } from '@/api/link/plugin'
import { getImage, onlyMessage } from '@/utils/comm'
import { getMetadataMapById, metadataMapById } from '@/api/device/instance'
+import { cloneDeep } from 'lodash-es';
const productStore = useProductStore();
const { current: productDetail } = storeToRefs(productStore)
@@ -97,9 +133,12 @@ const dataSourceCache = ref([])
const dataSource = ref([])
const pluginOptions = ref([])
-const tableFilter = (value: string, record: any) => {
- return true
-}
+const filterValue = ref(undefined);
+const originalData = ref([]);
+
+// const tableFilter = (value: string, record: any) => {
+// return true
+// }
const columns = [
{
@@ -115,7 +154,7 @@ const columns = [
title: '目标属性',
dataIndex: 'plugin',
width: 250,
- sorter: tableFilter
+ // sorter: tableFilter
}
]
@@ -214,6 +253,25 @@ const pluginChange = 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.plugin ? 1 : -1) - (b.plugin ? 1 : -1);
+ } else {
+ return (b.plugin ? 1 : -1) - (a.plugin ? 1 : -1);
+ }
+ });
+
+ dataSource.value = _dataSource;
+ filterValue.value = key;
+};
+
+const onClose = () => {
+ filterValue.value = undefined;
+ dataSource.value = originalData.value;
+};
+
onMounted(() => {
getDefaultMetadata()
})
diff --git a/src/views/system/NoticeRule/components/Save/components/NotifyConfig.vue b/src/views/system/NoticeRule/components/Save/components/NotifyConfig.vue
index 6a29d5dd..0da3f69f 100644
--- a/src/views/system/NoticeRule/components/Save/components/NotifyConfig.vue
+++ b/src/views/system/NoticeRule/components/Save/components/NotifyConfig.vue
@@ -138,6 +138,12 @@ const query = (e: Record) =>
column: 'type',
value: noticeType.get(props.notifyType),
},
+ {
+ termType: 'not',
+ column: 'provider',
+ type: 'and',
+ value: 'dingTalkRobotWebHook',
+ }
],
},
],