fix: 优化采集器无数据时页面卡死问题
This commit is contained in:
parent
7aac9cfce6
commit
1cb1241c14
|
@ -22,13 +22,14 @@
|
||||||
<j-spin :spinning="spinning">
|
<j-spin :spinning="spinning">
|
||||||
<j-tree
|
<j-tree
|
||||||
:tree-data="defualtDataSource"
|
:tree-data="defualtDataSource"
|
||||||
v-model:selected-keys="selectedKeys"
|
:selected-keys="selectedKeys"
|
||||||
:fieldNames="{ key: 'id' }"
|
:fieldNames="{ key: 'id' }"
|
||||||
v-if="
|
v-if="
|
||||||
!(defualtDataSource.length === 0 ||
|
!(defualtDataSource.length === 0 ||
|
||||||
defualtDataSource?.[0]?.children?.length === 0)
|
defualtDataSource?.[0]?.children?.length === 0)
|
||||||
"
|
"
|
||||||
:height="660"
|
:height="660"
|
||||||
|
@select='treeSelect'
|
||||||
defaultExpandAll
|
defaultExpandAll
|
||||||
>
|
>
|
||||||
<template #title="{ name, data }">
|
<template #title="{ name, data }">
|
||||||
|
@ -263,15 +264,19 @@ const getChannelNoPaging = async () => {
|
||||||
Store.set('channelListAll', res.result);
|
Store.set('channelListAll', res.result);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const treeSelect = (keys: string, e: any) => {
|
||||||
|
selectedKeys.value = [e.node?.id]
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
handleSearch(_.cloneDeep(defualtParams));
|
handleSearch(_.cloneDeep(defualtParams));
|
||||||
getChannelNoPaging();
|
getChannelNoPaging();
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => selectedKeys.value,
|
() => selectedKeys.value[0],
|
||||||
(n, p) => {
|
(n, p) => {
|
||||||
const key = _.isArray(n) ? n[0] : n;
|
const key = _.isArray(selectedKeys.value) ? selectedKeys.value[0] : selectedKeys.value;
|
||||||
if (key) {
|
if (key) {
|
||||||
if (key !== "*") {
|
if (key !== "*") {
|
||||||
const row = collectorAll.value.find((i: any) => i.id === key);
|
const row = collectorAll.value.find((i: any) => i.id === key);
|
||||||
|
@ -281,8 +286,6 @@ watch(
|
||||||
id: '*'
|
id: '*'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
selectedKeys.value = p; // 防止取消
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue