feat: 过滤别名.

This commit is contained in:
lijiahang
2023-12-19 12:06:36 +08:00
parent 934c59cf96
commit 581c14d8d7
5 changed files with 21 additions and 7 deletions

View File

@@ -212,7 +212,6 @@
});
};
// FIXME 测试
// 保存节点
const saveNode = async (node: TreeNodeData) => {
const key = node.key

View File

@@ -1,7 +1,7 @@
<template>
<a-drawer v-model:visible="visible"
class="host-group-drawer"
width="70%"
:width="1120"
title="主机分组配置"
:esc-to-close="false"
:mask-closable="false"

View File

@@ -34,7 +34,11 @@
</template>
<!-- 内容 -->
<template #item="{ label }">
<span v-html="renderLabel(label)" />
<a-tooltip position="top"
:mini="true"
:content="label">
<span v-html="renderLabel(label)" />
</a-tooltip>
</template>
</a-transfer>
</div>
@@ -86,7 +90,6 @@
}
});
// FIXME 省略和tooltip
// 渲染 label
const renderLabel = (label: string) => {
const last = label.lastIndexOf('-');
@@ -142,10 +145,21 @@
user-select: none;
}
.arco-transfer-view-source {
.arco-transfer-list-item .arco-checkbox {
width: calc(100% - 24px);
position: absolute;
}
}
.arco-transfer-view-target {
.arco-transfer-list-item-content {
margin-left: 4px;
position: absolute;
width: calc(100% - 52px);
display: inline-block;
}
.arco-transfer-list-item-remove-btn {

View File

@@ -65,6 +65,7 @@
: list.filter(item => {
return (item.name as string)?.toLowerCase().indexOf(filterVal) > -1
|| (item.code as string)?.toLowerCase().indexOf(filterVal) > -1
|| (item.alias as string)?.toLowerCase().indexOf(filterVal) > -1
|| (item.address as string)?.toLowerCase().indexOf(filterVal) > -1;
});
}

View File

@@ -14,7 +14,7 @@
<!-- 过滤 -->
<a-auto-complete v-model="filterValue"
class="host-filter"
placeholder="输入名称/编码/IP @标签"
placeholder="别名/名称/编码/IP @标签"
:allow-clear="true"
:data="filterOptions"
:filter-option="searchFilter">
@@ -118,8 +118,8 @@
}).forEach(s => filterOptions.value.push(s));
// 添加主机信息
const hostMeta = hosts.value.hostList?.map(s => {
return [s.name, s.code, s.address];
}).flat(1);
return [s.name, s.code, s.address, s.alias];
}).filter(Boolean).flat(1);
[...new Set(hostMeta)].map(value => {
return { label: value, value };
}).forEach(s => filterOptions.value.push(s));