fix: 修改bug
This commit is contained in:
parent
71af134d09
commit
e42c6b34d1
|
@ -3,7 +3,7 @@
|
||||||
<div style="padding: 0 10px">
|
<div style="padding: 0 10px">
|
||||||
<div class="alert">
|
<div class="alert">
|
||||||
<AIcon type="InfoCircleOutlined" />
|
<AIcon type="InfoCircleOutlined" />
|
||||||
你可以在该页面选择需要订阅的主题及接收通知的方式。
|
注意:接收人需要有告警配置页面的查询权限,才能收到告警类通知
|
||||||
</div>
|
</div>
|
||||||
<div class="content-collapse">
|
<div class="content-collapse">
|
||||||
<template v-if="dataSource.length">
|
<template v-if="dataSource.length">
|
||||||
|
|
|
@ -2,10 +2,24 @@
|
||||||
<div class="metadata-map">
|
<div class="metadata-map">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<j-space style="margin-bottom: 24px">
|
<j-space style="margin-bottom: 24px">
|
||||||
<j-select @change="onSearchChange" show-search allow-clear placeholder="请选择属性名称" style="width: 250px;">
|
<j-select
|
||||||
<j-select-option :label="item.name" v-for="item in dataSourceCache" :value="item?.id" :key="item?.id">{{item?.name}}</j-select-option>
|
@change="onSearchChange"
|
||||||
|
show-search
|
||||||
|
allow-clear
|
||||||
|
placeholder="请选择属性名称"
|
||||||
|
style="width: 250px"
|
||||||
|
>
|
||||||
|
<j-select-option
|
||||||
|
:label="item.name"
|
||||||
|
v-for="item in dataSourceCache"
|
||||||
|
:value="item?.id"
|
||||||
|
:key="item?.id"
|
||||||
|
>{{ item?.name }}</j-select-option
|
||||||
|
>
|
||||||
</j-select>
|
</j-select>
|
||||||
<j-button type="primary" @click="onSearch"><AIcon type="SearchOutlined" /></j-button>
|
<j-button type="primary" @click="onSearch"
|
||||||
|
><AIcon type="SearchOutlined"
|
||||||
|
/></j-button>
|
||||||
</j-space>
|
</j-space>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<j-scrollbar height="100%">
|
<j-scrollbar height="100%">
|
||||||
|
@ -151,6 +165,7 @@ const originalData = ref([]);
|
||||||
|
|
||||||
const _value = ref<any>(undefined);
|
const _value = ref<any>(undefined);
|
||||||
const searchValue = ref<any>(undefined);
|
const searchValue = ref<any>(undefined);
|
||||||
|
const _delTag = ref<boolean>(false);
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
|
@ -202,6 +217,7 @@ const getMetadataMapData = () => {
|
||||||
return {
|
return {
|
||||||
id: item.metadataId,
|
id: item.metadataId,
|
||||||
originalId: item.originalId,
|
originalId: item.originalId,
|
||||||
|
customMapping: item.customMapping,
|
||||||
};
|
};
|
||||||
}) || [],
|
}) || [],
|
||||||
);
|
);
|
||||||
|
@ -218,18 +234,18 @@ const customRow = (record: any) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSearchChange = (_: any, options: any) => {
|
const onSearchChange = (_: any, options: any) => {
|
||||||
searchValue.value = options?.label
|
searchValue.value = options?.label;
|
||||||
}
|
};
|
||||||
|
|
||||||
const onSearch = () => {
|
const onSearch = () => {
|
||||||
if (searchValue.value) {
|
if (searchValue.value) {
|
||||||
const _item: any = dataSourceCache.value.find((item: any) => {
|
const _item: any = dataSourceCache.value.find((item: any) => {
|
||||||
return searchValue.value === item?.name;
|
return searchValue.value === item?.name;
|
||||||
});
|
});
|
||||||
if(_item) {
|
if (_item) {
|
||||||
_value.value = _item?.name;
|
_value.value = _item?.name;
|
||||||
document.getElementById(_item?.id)?.scrollIntoView(); // 滚动到可视区域
|
document.getElementById(_item?.id)?.scrollIntoView(); // 滚动到可视区域
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_value.value = undefined;
|
_value.value = undefined;
|
||||||
}
|
}
|
||||||
|
@ -251,16 +267,23 @@ const getDefaultMetadata = async () => {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const concatProperties = [...metadataMap];
|
const concatProperties = [...metadataMap];
|
||||||
const arr = concatProperties.map((item) => item.id);
|
|
||||||
const _arr = concatProperties.map((item) => item.originalId);
|
|
||||||
|
|
||||||
_properties.map((item) => {
|
if (!concatProperties.length) {
|
||||||
// 添加默认映射,但是该选项还没被其他属性映射
|
_delTag.value = true;
|
||||||
if (!arr.includes(item.id) && !_arr.includes(item.id)) {
|
const arr = concatProperties.map((item) => item.id);
|
||||||
concatProperties.push({ id: item.id, originalId: item.id });
|
const _arr = concatProperties.map((item) => item.originalId);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
_properties.map((item) => {
|
||||||
|
// 添加默认映射,但是该选项还没被其他属性映射
|
||||||
|
if (!arr.includes(item.id) && !_arr.includes(item.id)) {
|
||||||
|
concatProperties.push({
|
||||||
|
id: item.id,
|
||||||
|
originalId: item.id,
|
||||||
|
customMapping: item?.customMapping,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
dataSource.value =
|
dataSource.value =
|
||||||
properties?.map((item: any, index: number) => {
|
properties?.map((item: any, index: number) => {
|
||||||
const _m = concatProperties.find((p) => p.id === item.id);
|
const _m = concatProperties.find((p) => p.id === item.id);
|
||||||
|
@ -269,6 +292,7 @@ const getDefaultMetadata = async () => {
|
||||||
id: item.id, // 产品物模型id
|
id: item.id, // 产品物模型id
|
||||||
name: item?.name,
|
name: item?.name,
|
||||||
type: item.valueType?.type,
|
type: item.valueType?.type,
|
||||||
|
customMapping: _m?.customMapping,
|
||||||
original: _m?.originalId, // 协议包物模型id
|
original: _m?.originalId, // 协议包物模型id
|
||||||
};
|
};
|
||||||
}) || [];
|
}) || [];
|
||||||
|
@ -289,19 +313,27 @@ const getMetadata = (): Promise<{ properties: any[] }> => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChange = async (value: any, id: string) => {
|
const onMapData = async (arr: any[], flag?: boolean) => {
|
||||||
const res = await metadataMapById('device', _id, [
|
const res = await metadataMapById('device', _id, arr);
|
||||||
{
|
if (res.success && flag) {
|
||||||
metadataType: 'property',
|
|
||||||
metadataId: value.id,
|
|
||||||
originalId: id || null,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
if (res.success) {
|
|
||||||
onlyMessage('操作成功');
|
onlyMessage('操作成功');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onChange = async (value: any, id: string) => {
|
||||||
|
if ((!id && value?.customMapping) || id) {
|
||||||
|
// 映射 / 取消映射
|
||||||
|
const arr = [
|
||||||
|
{
|
||||||
|
metadataType: 'property',
|
||||||
|
metadataId: value.id,
|
||||||
|
originalId: id,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
onMapData(arr, true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const onFilter = ({ key }: any) => {
|
const onFilter = ({ key }: any) => {
|
||||||
originalData.value = dataSource.value;
|
originalData.value = dataSource.value;
|
||||||
const _dataSource = cloneDeep(dataSource.value).sort((a: any, b: any) => {
|
const _dataSource = cloneDeep(dataSource.value).sort((a: any, b: any) => {
|
||||||
|
@ -324,6 +356,20 @@ const onClose = () => {
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getDefaultMetadata();
|
getDefaultMetadata();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (_delTag.value) {
|
||||||
|
// 保存数据
|
||||||
|
const arr = dataSourceCache.value.filter((i: any) => i?.original).map((item: any) => {
|
||||||
|
return {
|
||||||
|
metadataType: 'property',
|
||||||
|
metadataId: item.id,
|
||||||
|
originalId: item.original,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
onMapData(arr)
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang='less'>
|
<style scoped lang='less'>
|
||||||
|
|
|
@ -151,6 +151,7 @@ const pluginOptions = ref<any[]>([]);
|
||||||
const filterValue = ref<boolean | undefined>(undefined);
|
const filterValue = ref<boolean | undefined>(undefined);
|
||||||
const originalData = ref([]);
|
const originalData = ref([]);
|
||||||
const searchValue = ref<any>(undefined);
|
const searchValue = ref<any>(undefined);
|
||||||
|
const _delTag = ref<boolean>(false);
|
||||||
|
|
||||||
// const tableFilter = (value: string, record: any) => {
|
// const tableFilter = (value: string, record: any) => {
|
||||||
// return true
|
// return true
|
||||||
|
@ -203,6 +204,7 @@ const getMetadataMapData = () => {
|
||||||
return {
|
return {
|
||||||
id: item.metadataId,
|
id: item.metadataId,
|
||||||
pluginId: item.originalId,
|
pluginId: item.originalId,
|
||||||
|
customMapping: item?.customMapping,
|
||||||
};
|
};
|
||||||
}) || [],
|
}) || [],
|
||||||
);
|
);
|
||||||
|
@ -250,16 +252,18 @@ const getDefaultMetadata = async () => {
|
||||||
|
|
||||||
// const concatProperties = [ ...pluginProperties.map(item => ({ id: item.id, pluginId: item.id})), ...metadataMap]
|
// const concatProperties = [ ...pluginProperties.map(item => ({ id: item.id, pluginId: item.id})), ...metadataMap]
|
||||||
const concatProperties = [...metadataMap];
|
const concatProperties = [...metadataMap];
|
||||||
const arr = concatProperties.map((item) => item.id);
|
if(!concatProperties.length) {
|
||||||
const _arr = concatProperties.map((item) => item.pluginId);
|
_delTag.value = true
|
||||||
|
const arr = concatProperties.map((item) => item.id);
|
||||||
pluginProperties.map((item) => {
|
const _arr = concatProperties.map((item) => item.pluginId);
|
||||||
// 添加默认映射,但是该选项还没被其他属性映射
|
|
||||||
if (!arr.includes(item.id) && !_arr.includes(item.id)) {
|
|
||||||
concatProperties.push({ id: item.id, pluginId: item.id });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
pluginProperties.map((item) => {
|
||||||
|
// 添加默认映射,但是该选项还没被其他属性映射
|
||||||
|
if (!arr.includes(item.id) && !_arr.includes(item.id)) {
|
||||||
|
concatProperties.push({ id: item.id, pluginId: item.id, customMapping: item?.customMapping, });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
dataSource.value =
|
dataSource.value =
|
||||||
properties?.map((item: any, index: number) => {
|
properties?.map((item: any, index: number) => {
|
||||||
const _m = concatProperties.find((p) => p.id === item.id);
|
const _m = concatProperties.find((p) => p.id === item.id);
|
||||||
|
@ -268,6 +272,7 @@ const getDefaultMetadata = async () => {
|
||||||
id: item.id, // 产品物模型id
|
id: item.id, // 产品物模型id
|
||||||
name: item?.name,
|
name: item?.name,
|
||||||
type: item.valueType?.type,
|
type: item.valueType?.type,
|
||||||
|
customMapping: _m?.customMapping,
|
||||||
plugin: _m?.pluginId, // 插件物模型id
|
plugin: _m?.pluginId, // 插件物模型id
|
||||||
};
|
};
|
||||||
}) || [];
|
}) || [];
|
||||||
|
@ -304,19 +309,27 @@ const getPluginMetadata = (): Promise<{ properties: any[] }> => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const pluginChange = async (value: any, id: string) => {
|
const onMapData = async (arr: any[], flag?: boolean) => {
|
||||||
const res = await metadataMapById('product', productDetail.value?.id, [
|
const res = await metadataMapById('product', productDetail.value?.id, arr);
|
||||||
{
|
if (res.success && flag) {
|
||||||
metadataType: 'property',
|
|
||||||
metadataId: value.id,
|
|
||||||
originalId: id,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
if (res.success) {
|
|
||||||
onlyMessage('操作成功');
|
onlyMessage('操作成功');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const pluginChange = async (value: any, id: string) => {
|
||||||
|
if ((!id && value?.customMapping) || id) {
|
||||||
|
// 映射 / 取消映射
|
||||||
|
const arr = [
|
||||||
|
{
|
||||||
|
metadataType: 'property',
|
||||||
|
metadataId: value.id,
|
||||||
|
originalId: id,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
onMapData(arr, true)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const onFilter = ({ key }: any) => {
|
const onFilter = ({ key }: any) => {
|
||||||
originalData.value = dataSource.value;
|
originalData.value = dataSource.value;
|
||||||
const _dataSource = cloneDeep(dataSource.value).sort((a: any, b: any) => {
|
const _dataSource = cloneDeep(dataSource.value).sort((a: any, b: any) => {
|
||||||
|
@ -339,6 +352,20 @@ const onClose = () => {
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getDefaultMetadata();
|
getDefaultMetadata();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (_delTag.value) {
|
||||||
|
// 保存数据
|
||||||
|
const arr = dataSourceCache.value.filter((i: any) => i?.plugin).map((item: any) => {
|
||||||
|
return {
|
||||||
|
metadataType: 'property',
|
||||||
|
metadataId: item.id,
|
||||||
|
originalId: item.plugin,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
onMapData(arr)
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang='less'>
|
<style scoped lang='less'>
|
||||||
|
|
|
@ -2006,7 +2006,7 @@ export default [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
accessSupport: { text: "不支持", value: "unsupported" },
|
accessSupport: { text: "间接支持", value: "indirect" },
|
||||||
supportDataAccess: false
|
supportDataAccess: false
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -2363,10 +2363,10 @@ export default [
|
||||||
permission: 'rule-scene',
|
permission: 'rule-scene',
|
||||||
actions: ['query', 'delete'],
|
actions: ['query', 'delete'],
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
permission: 'alarm-config',
|
// permission: 'alarm-config',
|
||||||
actions: ['query'],
|
// actions: ['query'],
|
||||||
},
|
// },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -3837,8 +3837,8 @@ jetlinks-ui-components@^1.0.23:
|
||||||
|
|
||||||
jetlinks-ui-components@^1.0.24:
|
jetlinks-ui-components@^1.0.24:
|
||||||
version "1.0.24"
|
version "1.0.24"
|
||||||
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#68660b63aea9b4befeaa4c5e3ff121668bb984bb"
|
resolved "http://registry.jetlinks.cn/jetlinks-ui-components/-/jetlinks-ui-components-1.0.24.tgz#b49c1f29c2e0a6dd9550a1f916dfb722a18b81bf"
|
||||||
integrity sha512-09s73oEPKf+TC3KVL4suXrI4FjylJqyB2qXbFQtBOqyK/mSfMN/TJ7mcEoZdycBqAvmv35zTDKXIQIcvAAaitQ==
|
integrity sha512-DtUJeIqb1IJ9uS/85IdOoJfz7V4isN9naxKOoY9azaRAjTbHaZsf20snLmDMT5o2tDlToHmi+KoCO+f1lG2Tyg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@vueuse/core" "^9.12.0"
|
"@vueuse/core" "^9.12.0"
|
||||||
"@vueuse/router" "^9.13.0"
|
"@vueuse/router" "^9.13.0"
|
||||||
|
|
Loading…
Reference in New Issue