fix: 修改bug

This commit is contained in:
100011797 2023-07-03 11:57:58 +08:00
parent 74747cd966
commit a9e4f9d0af
4 changed files with 140 additions and 48 deletions

View File

@ -21,7 +21,7 @@
}}
</div>
</div>
<p>{{ props.data?.message }}</p>
<div class="message">{{ props.data?.message }}</div>
</div>
<div class="list-item-right">
<j-button @click.stop="detail">查看详情</j-button>
@ -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;
}
}

View File

@ -20,7 +20,14 @@
>
<template #headerCell="{ column }">
<template v-if="column.dataIndex === 'original'">
<div style="width: 100%; display: flex; justify-content: space-between; align-items: center;">
<div
style="
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
"
>
<span>
目标属性<j-tooltip
title="协议包中物模型下的属性"
@ -31,7 +38,28 @@
/>
</j-tooltip>
</span>
<!-- <AIcon type="FilterOutlined" /> -->
<j-tag
v-if="filterValue !== undefined"
color="#87d068"
closable
@close="onClose"
><AIcon type="ArrowUpOutlined" /><span>{{
filterValue ? '已映射' : '未映射'
}}</span></j-tag
>
<j-dropdown v-else>
<AIcon type="FilterOutlined" />
<template #overlay>
<j-menu @click="onFilter">
<j-menu-item :key="true"
>置顶已映射数据</j-menu-item
>
<j-menu-item :key="false"
>置顶未映射数据</j-menu-item
>
</j-menu>
</template>
</j-dropdown>
</div>
</template>
</template>
@ -58,7 +86,8 @@
:disabled="
selectedOriginalKeys.includes(item.id)
"
>{{ item.label }} ({{
>
{{ item.label }} ({{
item.id
}})</j-select-option
>
@ -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<any[]>([]);
const filterValue = ref<boolean | undefined>(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();
});

View File

@ -20,17 +20,48 @@
>
<template #headerCell="{ column }">
<template v-if="column.dataIndex === 'plugin'">
<span>
目标属性<j-tooltip title="插件中物模型下的属性">
<AIcon
style="margin-left: 10px"
type="QuestionCircleOutlined"
/>
</j-tooltip>
</span>
<div
style="
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
"
>
<span>
目标属性<j-tooltip title="插件中物模型下的属性">
<AIcon
style="margin-left: 10px"
type="QuestionCircleOutlined"
/>
</j-tooltip>
</span>
<j-tag
v-if="filterValue !== undefined"
color="#87d068"
closable
@close="onClose"
><AIcon type="ArrowUpOutlined" /><span>{{
filterValue ? '已映射' : '未映射'
}}</span></j-tag
>
<j-dropdown v-else>
<AIcon type="FilterOutlined" />
<template #overlay>
<j-menu @click="onFilter">
<j-menu-item :key="true"
>置顶已映射数据</j-menu-item
>
<j-menu-item :key="false"
>置顶未映射数据</j-menu-item
>
</j-menu>
</template>
</j-dropdown>
</div>
</template>
</template>
<template #bodyCell="{ column, text, record, index }">
<template #bodyCell="{ column, text, record }">
<template v-if='column.dataIndex === "name"'>
<span class='metadata-title'>
<j-ellipsis>
@ -50,7 +81,11 @@
:key='index + "_" + item.id'
:value='item.value'
:disabled='selectedPluginKeys.includes(item.id)'
>{{ item.label }} ({{ item.id }})</j-select-option>
><j-tooltip :title="selectedPluginKeys.includes(item.id) ? '该属性已绑定平台属性' : ''">
{{ item.label }} ({{
item.id
}})
</j-tooltip></j-select-option>
</j-select>
</template>
</template>
@ -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<any[]>([])
const tableFilter = (value: string, record: any) => {
return true
}
const filterValue = ref<boolean | undefined>(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()
})

View File

@ -138,6 +138,12 @@ const query = (e: Record<string, any>) =>
column: 'type',
value: noticeType.get(props.notifyType),
},
{
termType: 'not',
column: 'provider',
type: 'and',
value: 'dingTalkRobotWebHook',
}
],
},
],