fix: 修复实体搜索框text模式下点击top后表达式错误的问题、修复分页bug

This commit is contained in:
chenjinsong
2022-02-07 16:11:49 +08:00
parent 1169029406
commit 2ed78bc1f3
6 changed files with 35 additions and 13 deletions

View File

@@ -107,7 +107,6 @@ export default {
// 新增条件
addCondition (meta) {
this.metaList.forEach(m => {
console.info(m)
m.cancelEditing()
})
// 先判断上一个condition是否已填写完整没有则删除之后将当前所有meta的内容的isEditing置为false
@@ -155,6 +154,8 @@ export default {
if (this.isCustomized(value)) {
meta.column.type = columnType.fullText
meta.column.label = value
meta.resetOperator()
meta.resetValue()
} else {
const selectedColumn = this.columnList.find(column => {
return column.name === value

View File

@@ -88,7 +88,7 @@ export default {
return column.name === key
})
let current = this.codeMirror.getValue()
current = `${key}=${(column.type === columnType.string ? stringInQuot(params[key]) : params[key])} ${current ? 'AND' : ''} ${current}`
current = `${current ? current + 'AND ' : ''}${key}=${(column.type === columnType.string ? stringInQuot(params[key]) : params[key])}`
toRaw(this.codeMirror).setValue(current)
})
}

View File

@@ -87,6 +87,23 @@ export default class Meta {
this.isEditing = false
}
}
resetOperator () {
this.operator = {
value: '',
isEditing: false,
show: false
}
}
resetValue () {
this.value = {
value: '',
label: '',
isEditing: false,
show: false
}
}
}
export function cloneMeta (source) {

View File

@@ -122,18 +122,19 @@ export default class SqlParser extends SqlParserVisitor {
}
// 如果column.name为空则参数值是column否则是value
if (!this.tempMeta.column.name) {
// 在columnList中的按columnList不在则先设为空串由之后value值来自动判断
// 在columnList中的按columnList不在则为全文检索
const column = this.columnList.find(column => {
return column.name === value
})
this.tempMeta.column.name = value
this.tempMeta.column.label = column ? column.label : value
this.tempMeta.column.type = column ? column.type : ''
} else {
// 若column的type为空则根据value自动判断赋值
if (!this.tempMeta.column.type) {
this.tempMeta.column.type = handleType(value)
this.tempMeta.column.type = column ? column.type : columnType.fullText
if (this.tempMeta.column.type === columnType.fullText) {
this.tempMeta.value.show = false
this.tempMeta.operator.show = false
this.metaList.push(cloneMeta(this.tempMeta))
}
} else {
if (this.tempMeta.column.type === columnType.string) {
if (_.isArray(value)) {
this.tempMeta.value.value = value.map(v => {