From 28e23111a53ebf46a579c568d1663126b2fc651d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= <2498601771@qq.com>
Date: Wed, 31 May 2023 17:33:45 +0800
Subject: [PATCH] =?UTF-8?q?CN-1049=20fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=8D?=
=?UTF-8?q?=E7=82=B9=E5=87=BBcondition=EF=BC=8C=E9=80=89=E6=8B=A9=E5=B7=A6?=
=?UTF-8?q?=E4=BE=A7filter=E6=9D=A1=E4=BB=B6=E6=97=B6=E6=90=9C=E7=B4=A2?=
=?UTF-8?q?=E6=A1=86=E5=8F=82=E6=95=B0=E6=B2=A1=E6=9C=89=E5=8D=95=E5=BC=95?=
=?UTF-8?q?=E5=8F=B7=E5=8C=85=E8=A3=B9=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/advancedSearch/TagMode.vue | 27 ++++++++++++-------
src/components/advancedSearch/meta/parser.js | 3 +--
.../advancedSearch/meta/sql-parser.js | 3 +--
3 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/src/components/advancedSearch/TagMode.vue b/src/components/advancedSearch/TagMode.vue
index ad0b2090..2eb39d8a 100644
--- a/src/components/advancedSearch/TagMode.vue
+++ b/src/components/advancedSearch/TagMode.vue
@@ -29,7 +29,7 @@
>
- {{meta.column.label}}
+ {{meta.column.label}}
{{meta.operator.value}}
@@ -37,9 +37,9 @@
-
+
-
{{meta.value.label}}
+
{{meta.value.label}}
@@ -182,10 +182,10 @@ export default {
selectConnection (value, meta) {
meta.isEditing = false
},
- columnClick (meta, index) {
+ columnClick (meta) {
meta.column.isEditing = true
this.$nextTick(() => {
- this.$refs.columnSelect[index === 0 ? index : index - 1].focus() // 避免参数有and等情况
+ this.$refs.columnSelect[this.$refs.columnSelect.length - 1].focus()
})
},
columnBlur (meta, index) {
@@ -282,10 +282,10 @@ export default {
}
meta.value.isEditing = !meta.isCompleteCondition()
},
- valueClick (meta, index) {
+ valueClick (meta) {
meta.value.isEditing = true
this.$nextTick(() => {
- this.$refs.valueInput[index === 0 ? index : index - 1].focus() // 避免参数有and等情况
+ this.$refs.valueInput[0].focus()
})
},
// 判断是否是用户自己添加的内容,用于判断是否是全局搜索
@@ -323,7 +323,7 @@ export default {
}
},
// 处理value,例如转换IN的值
- handleValue (value, column, operator) {
+ handleValue (value, column, operator, flag) {
const isArray = ['IN', 'NOT IN'].indexOf(operator) > -1
if (isArray) {
if (_.isArray(value)) {
@@ -333,7 +333,14 @@ export default {
return value
}
} else {
- return column.type === columnType.string ? stringInQuot(value) : value
+ let newValue = column.type === columnType.string ? stringInQuot(value) : value
+ if (flag) {
+ newValue = newValue.slice(1)
+ newValue = newValue.slice(0, newValue.length - 1)
+ return newValue
+ } else {
+ return newValue
+ }
}
},
addParams (params) {
@@ -347,7 +354,7 @@ export default {
meta.column.label = column ? column.label : param.column
meta.operator.value = '='
meta.operator.show = true
- meta.value.value = this.handleValue(param.value, column, column.operator)
+ meta.value.value = this.handleValue(param.value, column, column.operator, 'noQuotes')
meta.value.show = true
meta.value.label = meta.value.value
this.addCondition(meta)
diff --git a/src/components/advancedSearch/meta/parser.js b/src/components/advancedSearch/meta/parser.js
index c218cddf..e0308767 100644
--- a/src/components/advancedSearch/meta/parser.js
+++ b/src/components/advancedSearch/meta/parser.js
@@ -756,8 +756,7 @@ export function stringInQuot (value) {
}
const match = `${value}`.match(/^'.+?'$/)
- // return match ? value : `'${value}'` // 单引号包裹,暂时保留
- return match ? value : `${value}`
+ return match ? value : `'${value}'`
}
// IN和LIKE前后加空格
diff --git a/src/components/advancedSearch/meta/sql-parser.js b/src/components/advancedSearch/meta/sql-parser.js
index 9668e209..c266680a 100644
--- a/src/components/advancedSearch/meta/sql-parser.js
+++ b/src/components/advancedSearch/meta/sql-parser.js
@@ -255,8 +255,7 @@ export function stringInQuot (value) {
}
const match = `${value}`.match(/^'.+?'$/)
- // return match ? value : `'${value}'`
- return match ? value : `${value}`
+ return match ? value : `'${value}'`
}
// IN和LIKE前后加空格
export function handleOperatorSpace (operator) {