Merge branch 'cherry-pick-6f72b225' into 'dev-23.09'
fix: 修复实体搜索内容包含非英文时会弹窗提示非法字符串的问题 See merge request cyber-narrator/cn-ui!45
This commit is contained in:
@@ -624,6 +624,11 @@ export default {
|
||||
const parser = new Parser(this.columnList)
|
||||
if (q.indexOf('%') === 0 || q.indexOf('%20') > -1 || q.indexOf('%25') > -1) {
|
||||
q = decodeURI(q)
|
||||
} else {
|
||||
const str1 = q.substring(q.indexOf('%'), q.indexOf('%') + 3)
|
||||
if (q.indexOf('%') > 0 && (str1 !== '%20' || str1 === '%25')) {
|
||||
q = decodeURI(q)
|
||||
}
|
||||
}
|
||||
this.metaList = parser.parseStr(q).metaList
|
||||
}
|
||||
|
||||
@@ -225,6 +225,11 @@ export default {
|
||||
if (q) {
|
||||
if (q.indexOf('%') === 0 || q.indexOf('%20') > -1 || q.indexOf('%25') > -1) {
|
||||
q = decodeURI(q)
|
||||
} else {
|
||||
const str1 = q.substring(q.indexOf('%'), q.indexOf('%') + 3)
|
||||
if (q.indexOf('%') > 0 && (str1 !== '%20' || str1 === '%25')) {
|
||||
q = decodeURI(q)
|
||||
}
|
||||
}
|
||||
// 为避免地址栏任意输入导致全查询的q带QUERY,解析时不识别导致的语法错误
|
||||
// 如地址栏输入116.178.222.171,此时的q很长,刷新界面时需要把q里的116.178.222.171拿出来进行搜索
|
||||
|
||||
@@ -6,9 +6,10 @@ import { ElMessage } from 'element-plus'
|
||||
import i18n from '@/i18n'
|
||||
|
||||
const strReg = {
|
||||
all: /^[\da-zA-Z\s.'><!=-_(),%]$/,
|
||||
// 需要不限制语言,正则过滤中英日语出错实现语言都通过。留个记录观察,后续校验
|
||||
all: /^[\da-zA-Z\u4E00-\u9FA5\u0800-\u4e00\s.'><!=-_(),%]$/,
|
||||
key: /^(?![\d])[\da-zA-Z\s.'-_]$/,
|
||||
value: /^[\da-zA-Z\s.'-_%]$/
|
||||
value: /^[\da-zA-Z\u4E00-\u9FA5\u0800-\u4e00\s.'-_%]$/
|
||||
}
|
||||
const operatorList = ['=', ' in ', ' IN ', ' like ', ' LIKE ', 'HAS(', 'has(']
|
||||
|
||||
|
||||
@@ -702,6 +702,11 @@ export default {
|
||||
if (q && (q.indexOf('%') === 0 || q.indexOf('%20') > -1 || q.indexOf('%25') > -1)) {
|
||||
q = decodeURI(q)
|
||||
}
|
||||
// %位置不为0,即内容包含非英文时
|
||||
const str1 = q.substring(q.indexOf('%'), q.indexOf('%') + 3)
|
||||
if (q && q.indexOf('%') > 0 && (str1 !== '%20' || str1 === '%25')) {
|
||||
q = decodeURI(q)
|
||||
}
|
||||
this.initSearch(q)
|
||||
this.listMode = listMode
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user