fix: 修复实体搜索框text模式下点击top后表达式错误的问题、修复分页bug
This commit is contained in:
@@ -107,7 +107,6 @@ export default {
|
|||||||
// 新增条件
|
// 新增条件
|
||||||
addCondition (meta) {
|
addCondition (meta) {
|
||||||
this.metaList.forEach(m => {
|
this.metaList.forEach(m => {
|
||||||
console.info(m)
|
|
||||||
m.cancelEditing()
|
m.cancelEditing()
|
||||||
})
|
})
|
||||||
// 先判断上一个condition是否已填写完整,没有则删除;之后将当前所有meta的内容的isEditing置为false
|
// 先判断上一个condition是否已填写完整,没有则删除;之后将当前所有meta的内容的isEditing置为false
|
||||||
@@ -155,6 +154,8 @@ export default {
|
|||||||
if (this.isCustomized(value)) {
|
if (this.isCustomized(value)) {
|
||||||
meta.column.type = columnType.fullText
|
meta.column.type = columnType.fullText
|
||||||
meta.column.label = value
|
meta.column.label = value
|
||||||
|
meta.resetOperator()
|
||||||
|
meta.resetValue()
|
||||||
} else {
|
} else {
|
||||||
const selectedColumn = this.columnList.find(column => {
|
const selectedColumn = this.columnList.find(column => {
|
||||||
return column.name === value
|
return column.name === value
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export default {
|
|||||||
return column.name === key
|
return column.name === key
|
||||||
})
|
})
|
||||||
let current = this.codeMirror.getValue()
|
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)
|
toRaw(this.codeMirror).setValue(current)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,23 @@ export default class Meta {
|
|||||||
this.isEditing = false
|
this.isEditing = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetOperator () {
|
||||||
|
this.operator = {
|
||||||
|
value: '',
|
||||||
|
isEditing: false,
|
||||||
|
show: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resetValue () {
|
||||||
|
this.value = {
|
||||||
|
value: '',
|
||||||
|
label: '',
|
||||||
|
isEditing: false,
|
||||||
|
show: false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function cloneMeta (source) {
|
export function cloneMeta (source) {
|
||||||
|
|||||||
@@ -122,18 +122,19 @@ export default class SqlParser extends SqlParserVisitor {
|
|||||||
}
|
}
|
||||||
// 如果column.name为空,则参数值是column,否则是value
|
// 如果column.name为空,则参数值是column,否则是value
|
||||||
if (!this.tempMeta.column.name) {
|
if (!this.tempMeta.column.name) {
|
||||||
// 在columnList中的,按columnList;不在则先设为空串,由之后value值来自动判断
|
// 在columnList中的,按columnList;不在则为全文检索
|
||||||
const column = this.columnList.find(column => {
|
const column = this.columnList.find(column => {
|
||||||
return column.name === value
|
return column.name === value
|
||||||
})
|
})
|
||||||
this.tempMeta.column.name = value
|
this.tempMeta.column.name = value
|
||||||
this.tempMeta.column.label = column ? column.label : value
|
this.tempMeta.column.label = column ? column.label : value
|
||||||
this.tempMeta.column.type = column ? column.type : ''
|
this.tempMeta.column.type = column ? column.type : columnType.fullText
|
||||||
} else {
|
if (this.tempMeta.column.type === columnType.fullText) {
|
||||||
// 若column的type为空,则根据value自动判断赋值
|
this.tempMeta.value.show = false
|
||||||
if (!this.tempMeta.column.type) {
|
this.tempMeta.operator.show = false
|
||||||
this.tempMeta.column.type = handleType(value)
|
this.metaList.push(cloneMeta(this.tempMeta))
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
if (this.tempMeta.column.type === columnType.string) {
|
if (this.tempMeta.column.type === columnType.string) {
|
||||||
if (_.isArray(value)) {
|
if (_.isArray(value)) {
|
||||||
this.tempMeta.value.value = value.map(v => {
|
this.tempMeta.value.value = value.map(v => {
|
||||||
|
|||||||
@@ -256,6 +256,7 @@ export default {
|
|||||||
],
|
],
|
||||||
listData: [],
|
listData: [],
|
||||||
q: '',
|
q: '',
|
||||||
|
metaList: [],
|
||||||
limitFilterType: true, // 是否限定了filter的类型
|
limitFilterType: true, // 是否限定了filter的类型
|
||||||
listLoading: false/*,
|
listLoading: false/*,
|
||||||
listData: JSON.parse(`[
|
listData: JSON.parse(`[
|
||||||
@@ -439,8 +440,10 @@ export default {
|
|||||||
search (metaList, formatSql) {
|
search (metaList, formatSql) {
|
||||||
if (formatSql) {
|
if (formatSql) {
|
||||||
this.q = formatSql
|
this.q = formatSql
|
||||||
|
this.metaList = metaList
|
||||||
} else {
|
} else {
|
||||||
this.q = ''
|
this.q = ''
|
||||||
|
this.metaList = []
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.showList) {
|
if (!this.showList) {
|
||||||
@@ -489,11 +492,11 @@ export default {
|
|||||||
},
|
},
|
||||||
pageSize (val) {
|
pageSize (val) {
|
||||||
this.pageObj.pageSize = val
|
this.pageObj.pageSize = val
|
||||||
this.search()
|
this.search(this.metaList, this.q)
|
||||||
},
|
},
|
||||||
pageNo (val) {
|
pageNo (val) {
|
||||||
this.pageObj.pageNo = val
|
this.pageObj.pageNo = val
|
||||||
this.search()
|
this.search(this.metaList, this.q)
|
||||||
},
|
},
|
||||||
// 点击上一页箭头
|
// 点击上一页箭头
|
||||||
prev () {
|
prev () {
|
||||||
@@ -671,7 +674,7 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
timeFilter (n) {
|
timeFilter (n) {
|
||||||
this.search()
|
this.search(this.metaList, this.q)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup () {
|
setup () {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<div class="search-symbol-inline" v-if="showList">
|
<div class="search-symbol-inline" v-if="showList">
|
||||||
<i class="cn-icon cn-icon-help"></i>
|
<i class="cn-icon cn-icon-help"></i>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="explorer-search__foot">
|
<div v-else class="explorer-search__foot" v-ele-click-outside="esc">
|
||||||
<div class="foot__item" @click="triggerHistory">
|
<div class="foot__item" @click="triggerHistory">
|
||||||
<i class="el-icon-arrow-right" :class="{ 'arrow-rotate': showHistory }" style="padding-right: 5px;"></i>
|
<i class="el-icon-arrow-right" :class="{ 'arrow-rotate': showHistory }" style="padding-right: 5px;"></i>
|
||||||
<span>{{$t('search.searchHistory')}}</span>
|
<span>{{$t('search.searchHistory')}}</span>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
<span>{{$t('overall.help')}}</span>
|
<span>{{$t('overall.help')}}</span>
|
||||||
</div>
|
</div>
|
||||||
<transition name="el-zoom-in-top">
|
<transition name="el-zoom-in-top">
|
||||||
<div class="search__history" v-show="showHistory" v-ele-click-outside="esc">
|
<div class="search__history" v-show="showHistory">
|
||||||
<div class="history__items">
|
<div class="history__items">
|
||||||
<div class="history__item" v-for="(h, i) in history" :key="i" @click="selectHistory(h.sql)">
|
<div class="history__item" v-for="(h, i) in history" :key="i" @click="selectHistory(h.sql)">
|
||||||
<span class="item-date">{{h.date}}</span>
|
<span class="item-date">{{h.date}}</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user