CN-1187: 手动输入不符合准确格式的筛选条件时,既无筛选效果,也无错误提示

This commit is contained in:
刘洪洪
2023-08-09 16:58:04 +08:00
parent e0decfc40b
commit 64bc0cdf9d
5 changed files with 79 additions and 16 deletions

View File

@@ -100,7 +100,7 @@ import Meta, { connection, condition, columnType } from './meta/meta'
import _ from 'lodash'
import { handleErrorTip } from '@/components/advancedSearch/meta/error'
import Parser, { stringInQuot } from '@/components/advancedSearch/meta/parser'
import { overwriteUrl, urlParamsHandler } from '@/utils/tools'
import { comparedEntityKey, overwriteUrl, urlParamsHandler } from '@/utils/tools'
export default {
name: 'TagMode',
props: {
@@ -435,8 +435,9 @@ export default {
mounted () {
const vm = this
// 如果地址栏包含参数q则匹配出metaList到搜索栏回显使用
const { q } = this.$route.query
let { q } = this.$route.query
if (q) {
q = comparedEntityKey(q).key
const parser = new Parser(this.columnList)
this.metaList = parser.parseStr(q).metaList
}

View File

@@ -36,7 +36,7 @@ import { toRaw } from 'vue'
import _ from 'lodash'
import { columnType } from '@/components/advancedSearch/meta/meta'
import { handleErrorTip } from '@/components/advancedSearch/meta/error'
import { overwriteUrl, urlParamsHandler } from '@/utils/tools'
import { comparedEntityKey, overwriteUrl, urlParamsHandler } from '@/utils/tools'
export default {
name: 'TextMode',
@@ -73,11 +73,16 @@ export default {
const str = this.codeMirror.getValue().trim()
if (str) {
const parser = new Parser(this.columnList)
const errorList = parser.validateStr(str)
if (_.isEmpty(errorList)) {
this.$emit('search', parser.parseStr(str))
const keyInfo = comparedEntityKey(str)
if (keyInfo.isKey) {
const errorList = parser.validateStr(keyInfo.key)
if (_.isEmpty(errorList)) {
this.$emit('search', { ...parser.parseStr(keyInfo.key), str: str })
} else {
this.$message.error(handleErrorTip(errorList[0]))
}
} else {
this.$message.error(handleErrorTip(errorList[0]))
this.$message.error(this.$t('tip.invalidQueryField') + keyInfo.key)
}
} else {
this.$emit('search', { q: '', str: '', metaList: [] })
@@ -87,8 +92,9 @@ export default {
this.codeMirror.focus()
},
changeMode () {
const str = this.codeMirror.getValue().trim()
let str = this.codeMirror.getValue().trim()
if (str) {
str = comparedEntityKey(str).key
const parser = new Parser(this.columnList)
const errorList = parser.validateStr(str)
if (_.isEmpty(errorList)) {