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) {