search dashboards

This commit is contained in:
Qiuxia Fan 2022-03-15 00:14:47 +08:00
parent 43dda1b32b
commit 30fed5c83f
2 changed files with 10 additions and 3 deletions

View File

@ -20,6 +20,7 @@ limitations under the License. -->
placeholder="Please input"
class="input-with-search"
size="small"
@change="searchDashboards"
>
<template #append>
<el-button size="small">
@ -108,7 +109,7 @@ async function setList() {
return;
}
}
dashboards.value = JSON.parse(sessionStorage.getItem("dashboards") || "");
dashboards.value = JSON.parse(sessionStorage.getItem("dashboards") || "[]");
}
const handleEdit = (row: { name: string; layer: string; entity: string }) => {
router.push(
@ -125,6 +126,12 @@ const handleDelete = (
`${row.layer}_${row.entity}_${row.name.split(" ").join("-")}`
);
};
function searchDashboards() {
const list = JSON.parse(sessionStorage.getItem("dashboards") || "[]");
dashboards.value = list.filter((d: { name: string }) =>
d.name.includes(searchText.value)
);
}
</script>
<style lang="scss" scoped>
.header {

View File

@ -84,10 +84,10 @@ onBeforeMount(async () => {
return { label: d, value: d };
});
});
function changeLayer(opt: { label: string; value: string }[]) {
function changeLayer(opt: { label: string; value: string }[] | any) {
states.selectedLayer = opt[0].value;
}
function changeEntity(opt: { label: string; value: string }[]) {
function changeEntity(opt: { label: string; value: string }[] | any) {
states.entity = opt[0].value;
}
</script>