fix: 修复实体搜索框如下问题:1.模糊搜索与精准搜索并列时报错,以及搜索value包含and导致搜索异常;2.tag模式清除搜索条件后,转text模式又恢复;3.tag模式下has右括号是全角;4.点击左侧tag条件时,搜索语句应是has;5.tag模式下,多个条件且其中一个为全文检索时,全文检索在请求参数中丢失。

This commit is contained in:
刘洪洪
2023-08-29 19:12:49 +08:00
parent 778dd21b3a
commit 7f94254a8a
3 changed files with 107 additions and 22 deletions

View File

@@ -3,6 +3,7 @@ import Token, { types } from './token'
import ParserError, { errorTypes, errorDesc } from '@/components/advancedSearch/meta/error'
import _ from 'lodash'
import { columnList } from '@/utils/static-data'
import { getEntityTypeByValue } from '@/utils/tools'
const strReg = {
all: /^[\da-zA-Z\s.'><!=-_(),%]$/,
@@ -789,6 +790,16 @@ export function handleOperatorSpace (operator) {
* @returns {string|*}
*/
export function handleMetaListToStr (metaList) {
// 将模糊搜索的值转换为对应类型如1.1.1.1,则添加操作符,类型等,以便于后面的操作
metaList.forEach(item => {
if (item.column.type === 'fullText') {
item.operator.value = '='
item.value.value = item.column.label
item.value.label = item.column.label
item.column.label = getEntityTypeByValue(item.column.label)
item.column.type = 'string'
}
})
// 长度为1时即模糊搜索例如搜索框值为1.1.1.1则直接返回1.1.1.1
// 如果为IP='1.1.1.1'的情况则从metaList拼接成IP='1.1.1.1'返回出去
if (metaList && metaList.length === 1) {