From 7e4ece806b2678bdefcbacc9a66f24442139e8c9 Mon Sep 17 00:00:00 2001 From: yzygyin <1446680116@qq.com> Date: Tue, 21 Jan 2025 17:47:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=80=90=E4=BA=A7=E5=93=81=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=91=E6=90=9C=E7=B4=A2/=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E4=BC=98=E5=8C=96=20#=20Reviewed,=20transact?= =?UTF-8?q?ion=20id:=2029735?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/event/filter-input.scss | 75 +++++++++++++ .../pages/event/filter-input.tsx | 104 +++++++++++++++++- .../src/monitor-pc/lang/table-column.ts | 2 + 3 files changed, 179 insertions(+), 2 deletions(-) diff --git a/bkmonitor/webpack/src/fta-solutions/pages/event/filter-input.scss b/bkmonitor/webpack/src/fta-solutions/pages/event/filter-input.scss index 83e1733eab..4559250e65 100644 --- a/bkmonitor/webpack/src/fta-solutions/pages/event/filter-input.scss +++ b/bkmonitor/webpack/src/fta-solutions/pages/event/filter-input.scss @@ -207,3 +207,78 @@ .condition-list { @include common-list(240px) } + +.search-type-dropdown { + position: absolute; + top: 100%; + left: 0; + z-index: 10; + width: 100%; + padding: 4px 0; + background-color: white; + border: 1px solid #c4c6cc; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); + transform: translateY(3px); + + .suggestion-container { + position: relative; + display: flex; + align-items: center; + justify-content: flex-start; + width: 100%; + height: 32px; + cursor: pointer; + + &.active { + background-color: #F5F7FA; + + .bk-tag { + background-color: #FFFFFF; + } + } + + &:hover { + color: #3a84ff; + cursor: pointer; + background-color: #eaF3FF; + + .center-item > span{ + color: #3a84ff; + } + + .bk-tag { + cursor: pointer; + } + } + + .left-item, .center-item { + min-width: 34.3%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + + .bk-tag { + max-width: calc(100% - 48px); + margin-left: 4px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } + + .left-item { + padding-right: 16px; + margin-left: 12px; + + } + + .center-item { + display: flex; + align-items: center; + + & > span { + color: #979BA5; + } + } + } +} diff --git a/bkmonitor/webpack/src/fta-solutions/pages/event/filter-input.tsx b/bkmonitor/webpack/src/fta-solutions/pages/event/filter-input.tsx index 120d7c992b..9b1691cb95 100644 --- a/bkmonitor/webpack/src/fta-solutions/pages/event/filter-input.tsx +++ b/bkmonitor/webpack/src/fta-solutions/pages/event/filter-input.tsx @@ -66,6 +66,13 @@ interface IFilterInputEvent { onFavorite: string; onChange: string; } + +interface SuggestionType { + type: string; + label: string; + prefix: string; +} + const textTypeList = ['field', 'method', 'value', 'condition']; /* 处理字符串数组不能连续两个冒号 */ @@ -161,10 +168,19 @@ export default class FilerInput extends tsc { this.handleInputFocus(); }, 16); @@ -967,6 +1008,7 @@ export default class FilerInput extends tsc @@ -1234,6 +1308,32 @@ export default class FilerInput extends tsc +
+ {this.suggestionTypes.map((item, index) => ( +
this.selectSuggestion(item.type)} + > +
+ {this.wrapWithPrefixIfNeeded(this.inputValue, item.prefix)} +
+
+ {item.label} + {this.wrapWithPrefixIfNeeded(this.inputValue, '')} +
+
+ ))} +