From 38bc1ec7290662f2991cea0dde35a3bf375a9ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= <2498601771@qq.com> Date: Tue, 27 Jun 2023 10:41:00 +0800 Subject: [PATCH] =?UTF-8?q?CN-1115:=20=E5=AE=9E=E4=BD=93=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=85=A8=E9=87=8F=E6=90=9C=E7=B4=A2=E6=97=B6?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/advancedSearch/TextMode.vue | 11 ++++++++++- src/views/entityExplorer/EntityExplorer.vue | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/components/advancedSearch/TextMode.vue b/src/components/advancedSearch/TextMode.vue index 700fd165..f7fa06d5 100644 --- a/src/components/advancedSearch/TextMode.vue +++ b/src/components/advancedSearch/TextMode.vue @@ -166,9 +166,18 @@ export default { }, mounted () { // 如果地址栏包含参数q,则将参数q回显到搜索栏内 - const { q } = this.$route.query + let { q } = this.$route.query this.initCodeMirror() if (q) { + // 为避免地址栏任意输入导致全查询的q带QUERY,解析时不识别导致的语法错误 + // 如地址栏输入116.178.222.171,此时的q很长,刷新界面时需要把q里的116.178.222.171拿出来进行搜索 + if (q.indexOf('QUERY') > -1) { + const strList = q.split(' ') + if (strList.length > 0) { + // 此时strList[1]为ip_addr:116.178.222.171,获取116.178.222.171 + q = strList[1].slice(8) + } + } toRaw(this.codeMirror).setValue(q) } diff --git a/src/views/entityExplorer/EntityExplorer.vue b/src/views/entityExplorer/EntityExplorer.vue index cb5ea65c..21cb4e5d 100644 --- a/src/views/entityExplorer/EntityExplorer.vue +++ b/src/views/entityExplorer/EntityExplorer.vue @@ -779,10 +779,19 @@ export default { * @param q */ initSearch (q) { - const str = q + let str = q // 此处的mode不做text和tag区分,是因为text和tag构造搜索参数过程不一样,但结果的参数一致 // 故采用text的参数形式进行搜索,tag形式在tagMode.vue的mounted里根据地址栏的参数q构造metaList if (str) { + // 为避免地址栏任意输入导致全查询的q带QUERY,解析时不识别导致的语法错误 + // 如地址栏输入116.178.222.171,此时的q很长,刷新界面时需要把q里的116.178.222.171拿出来进行搜索 + if (str.indexOf('QUERY') > -1) { + const strList = str.split(' ') + if (strList.length > 0) { + // 此时strList[1]为ip_addr:116.178.222.171,获取116.178.222.171 + str = strList[1].slice(8) + } + } const parser = new Parser(columnList) const errorList = parser.validateStr(str) if (_.isEmpty(errorList)) {