CN-1361 fix: 1、修复实体搜索在ip like后带%刷新报错;2、text模式下模糊搜索切换为tag带%;3、text模式切换tag模式连接符不能点击。
This commit is contained in:
@@ -298,6 +298,10 @@ export default {
|
||||
},
|
||||
operatorClick (meta) {
|
||||
meta.operator.isEditing = true
|
||||
if (!this.operatorList.length) {
|
||||
const obj = this.columnList.find(t => t.label === meta.column.label)
|
||||
this.operatorList = obj ? obj.doc.constraints.operator_functions.split(',') : ['=', 'IN']
|
||||
}
|
||||
},
|
||||
valueFocus (meta) {
|
||||
if (meta.column.type === columnType.array) {
|
||||
@@ -333,24 +337,24 @@ export default {
|
||||
meta.value.label = label
|
||||
} else {
|
||||
if (!_.isNumber(meta.value.value)) {
|
||||
let str = meta.value.value.trim().replace(/"/g, "'")
|
||||
if (str[0] === "'" && str[str.length - 1] === "'") {
|
||||
str = str.substring(1, str.length)
|
||||
str = str.substring(0, str.length - 1)
|
||||
}
|
||||
// 如果此时参数为xi'an,处理为xi''an,后一个条件避免若参数为xi''an,则不处理
|
||||
if (str.indexOf("'") > -1 && str.indexOf("''") === -1) {
|
||||
str = str.replace(/'/g, "''")
|
||||
}
|
||||
// let str = meta.value.value.trim().replace(/"/g, "'")
|
||||
// if (str[0] === "'" && str[str.length - 1] === "'") {
|
||||
// str = str.substring(1, str.length)
|
||||
// str = str.substring(0, str.length - 1)
|
||||
// }
|
||||
// // 如果此时参数为xi'an,处理为xi''an,后一个条件避免若参数为xi''an,则不处理
|
||||
// if (str.indexOf("'") > -1 && str.indexOf("''") === -1) {
|
||||
// str = str.replace(/'/g, "''")
|
||||
// }
|
||||
// if (str[0] === '%') {
|
||||
// str = str.substring(1, str.length)
|
||||
// }
|
||||
// if (str[str.length - 1] === '%') {
|
||||
// str = str.substring(0, str.length - 1)
|
||||
// }
|
||||
meta.value.value = str
|
||||
// meta.value.value = str
|
||||
}
|
||||
meta.value.label = meta.value.value // label是显示,value是实际值
|
||||
// meta.value.label = meta.value.value // label是显示,value是实际值
|
||||
}
|
||||
},
|
||||
valueBlur (meta) {
|
||||
@@ -401,26 +405,34 @@ export default {
|
||||
str = str.replace(/'/g, "''")
|
||||
}
|
||||
|
||||
// // domain和app选择like时,添加%
|
||||
// if (meta.operator.value.toLowerCase() === 'like') {
|
||||
// if (meta.column.label.toLowerCase() === 'domain') {
|
||||
// if (str[0] === '%') {
|
||||
// str = str.substring(1, str.length)
|
||||
// }
|
||||
// str = `%${str}`
|
||||
// }
|
||||
//
|
||||
// if (meta.column.label.toLowerCase() === 'app') {
|
||||
// if (str[0] === '%' && str[str.length - 1] === '%') {
|
||||
// str = str.substring(1, str.length)
|
||||
// str = str.substring(0, str.length - 1)
|
||||
// }
|
||||
// str = `%${str}%`
|
||||
// }
|
||||
// }
|
||||
// domain和app选择like时,添加%
|
||||
if (meta.operator.value.toLowerCase() === 'like') {
|
||||
if (meta.column.label.toLowerCase() === 'domain') {
|
||||
if (meta.value.label1) {
|
||||
if (str[0] !== '%') {
|
||||
meta.value.label1 = `%${str}`
|
||||
} else {
|
||||
meta.value.label1 = `${str}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isWrapped) {
|
||||
if (meta.column.label.toLowerCase() === 'app') {
|
||||
if (meta.value.label1) {
|
||||
if (str[0] !== '%' && str[str.length - 1] !== '%') {
|
||||
meta.value.label1 = `%${str}%`
|
||||
} else {
|
||||
meta.value.label1 = `${str}`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isWrapped) {
|
||||
meta.value.value = `'${str}'`
|
||||
if (meta.value.label1) {
|
||||
meta.value.label1 = `'${meta.value.label1}'`
|
||||
}
|
||||
}
|
||||
}
|
||||
meta.value.label = meta.value.value // label是显示,value是实际值
|
||||
@@ -610,7 +622,7 @@ export default {
|
||||
let { q } = this.$route.query
|
||||
if (q && !this.convertMetaList) {
|
||||
const parser = new Parser(this.columnList)
|
||||
if (q.indexOf('%') > -1) {
|
||||
if (q.indexOf('%') === 0 || q.indexOf('%20') > -1 || q.indexOf('%25') > -1) {
|
||||
q = decodeURI(q)
|
||||
}
|
||||
this.metaList = parser.parseStr(q).metaList
|
||||
@@ -642,12 +654,14 @@ export default {
|
||||
const isWrapped = this.isSingleQuoteWrapping(label)
|
||||
if (item.column.label === 'domain') {
|
||||
item.operator.value = 'like'
|
||||
item.value.value = isWrapped ? `'%${this.delSingleQuote(label)}'` : `%${this.delSingleQuote(label)}`
|
||||
item.value.label = isWrapped ? `'%${this.delSingleQuote(label)}'` : `%${this.delSingleQuote(label)}`
|
||||
item.value.value = isWrapped ? `'${this.delSingleQuote(label)}'` : `${this.delSingleQuote(label)}`
|
||||
item.value.label = isWrapped ? `'${this.delSingleQuote(label)}'` : `${this.delSingleQuote(label)}`
|
||||
item.value.label1 = isWrapped ? `'%${this.delSingleQuote(label)}'` : `%${this.delSingleQuote(label)}`
|
||||
} else if (item.column.label === 'app') {
|
||||
item.operator.value = 'like'
|
||||
item.value.value = isWrapped ? `'%${this.delSingleQuote(label)}%'` : `%${this.delSingleQuote(label)}%`
|
||||
item.value.label = isWrapped ? `'%${this.delSingleQuote(label)}%'` : `%${this.delSingleQuote(label)}%`
|
||||
item.value.value = isWrapped ? `'${this.delSingleQuote(label)}'` : `${this.delSingleQuote(label)}`
|
||||
item.value.label = isWrapped ? `'${this.delSingleQuote(label)}'` : `${this.delSingleQuote(label)}`
|
||||
item.value.label1 = isWrapped ? `'%${this.delSingleQuote(label)}%'` : `%${this.delSingleQuote(label)}%`
|
||||
}
|
||||
item.column.type = 'string'
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ export default {
|
||||
toRaw(this.codeMirror).setValue(this.str)
|
||||
}
|
||||
if (q) {
|
||||
if (q.indexOf('%') > -1) {
|
||||
if (q.indexOf('%') === 0 || q.indexOf('%20') > -1 || q.indexOf('%25') > -1) {
|
||||
q = decodeURI(q)
|
||||
}
|
||||
// 为避免地址栏任意输入导致全查询的q带QUERY,解析时不识别导致的语法错误
|
||||
|
||||
@@ -841,12 +841,14 @@ export default class Parser {
|
||||
const isWrapped = this.isSingleQuoteWrapping(label)
|
||||
if (item.column.label === 'domain') {
|
||||
item.operator.value = 'like'
|
||||
item.value.value = isWrapped ? `'%${this.delSingleQuote(label)}'` : `%${this.delSingleQuote(label)}`
|
||||
item.value.label = isWrapped ? `'%${this.delSingleQuote(label)}'` : `%${this.delSingleQuote(label)}`
|
||||
item.value.value = isWrapped ? `'${this.delSingleQuote(label)}'` : `${this.delSingleQuote(label)}`
|
||||
item.value.label = isWrapped ? `'${this.delSingleQuote(label)}'` : `${this.delSingleQuote(label)}`
|
||||
item.value.label1 = isWrapped ? `'%${this.delSingleQuote(label)}'` : `%${this.delSingleQuote(label)}`
|
||||
} else if (item.column.label === 'app') {
|
||||
item.operator.value = 'like'
|
||||
item.value.value = isWrapped ? `'%${this.delSingleQuote(label)}%'` : `%${this.delSingleQuote(label)}%`
|
||||
item.value.label = isWrapped ? `'%${this.delSingleQuote(label)}%'` : `%${this.delSingleQuote(label)}%`
|
||||
item.value.value = isWrapped ? `'${this.delSingleQuote(label)}'` : `${this.delSingleQuote(label)}`
|
||||
item.value.label = isWrapped ? `'${this.delSingleQuote(label)}'` : `${this.delSingleQuote(label)}`
|
||||
item.value.label1 = isWrapped ? `'%${this.delSingleQuote(label)}%'` : `%${this.delSingleQuote(label)}%`
|
||||
}
|
||||
item.column.type = 'string'
|
||||
}
|
||||
@@ -928,7 +930,11 @@ export default class Parser {
|
||||
if (item.column.label.toLowerCase() === 'tag') {
|
||||
hasStr += `${item.operator.value}(${item.column.label},${item.value.value}) AND `
|
||||
} else if (!item.column.show && item.operator.value.toLowerCase() === 'like') {
|
||||
fullTextStr += `${item.column.label} ${item.operator.value} ${item.value.value} AND `
|
||||
if (item.value.label1) {
|
||||
fullTextStr += `${item.column.label} ${item.operator.value} ${item.value.label1} AND `
|
||||
} else {
|
||||
fullTextStr += `${item.column.label} ${item.operator.value} ${item.value.value} AND `
|
||||
}
|
||||
const isWrapped = this.isSingleQuoteWrapping(item.value.value)
|
||||
fullTextStr2 += isWrapped ? `'${this.delPercent(this.delSingleQuote(item.value.value))}' AND ` : `${this.delPercent(this.delSingleQuote(item.value.value))} AND `
|
||||
} else if (item.column.show && item.operator.value.toLowerCase() === 'like') {
|
||||
|
||||
Reference in New Issue
Block a user