fix: 修复实体搜索切换页码不高亮,以及多个搜索关键字拼接为一个字段时不高亮等问题

This commit is contained in:
刘洪洪
2023-11-10 18:15:33 +08:00
parent 360fffde68
commit 2f919d1774
4 changed files with 32 additions and 18 deletions

View File

@@ -424,19 +424,21 @@ export default {
},
pageSize (val) {
this.pageObj.pageSize = val
const keywordList = this.getKeywordListByMetaList(this.metaList)
if (this.initFlag) {
if (val !== 20) {
this.search({ metaList: this.metaList, q: this.q })
this.search({ metaList: this.metaList, q: this.q, keywordList: keywordList })
}
} else {
this.search({ metaList: this.metaList, q: this.q })
this.search({ metaList: this.metaList, q: this.q, keywordList: keywordList })
}
},
pageNo (val) {
if (!this.initFlag) {
this.pageObj.pageNo = val
this.pageObj.resetPageNo = false
this.search({ metaList: this.metaList, q: this.q })
const keywordList = this.getKeywordListByMetaList(this.metaList)
this.search({ metaList: this.metaList, q: this.q, keywordList: keywordList })
}
},
// 点击上一页箭头
@@ -683,14 +685,7 @@ export default {
}
const parser = new Parser(columnList)
const metaList = parser.parseStr(_.cloneDeep(str)).metaList
const keywordList = []
metaList.forEach(item => {
if (item.column && item.column.type === columnType.fullText) {
keywordList.push({ type: item.column.type, value: item.column.label })
} else if (item.column && item.column.type === columnType.string) {
keywordList.push({ type: item.column.type, value: item.value.value })
}
})
const keywordList = this.getKeywordListByMetaList(metaList)
const keyInfo = parser.comparedEntityKey(parser.handleEntityTypeByStr(str))
if (keyInfo.isKey) {
const errorList = parser.validateStr(keyInfo.key)
@@ -744,6 +739,19 @@ export default {
}).finally(() => {
})
},
getKeywordListByMetaList (metaList) {
if (metaList) {
const keywordList = []
metaList.forEach(item => {
if (item.column && item.column.type === columnType.fullText) {
keywordList.push({ type: item.column.type, value: item.column.label })
} else if (item.column && item.column.type === columnType.string) {
keywordList.push({ type: item.column.type, value: item.value.value })
}
})
return keywordList
}
},
getKeyword (list) {
if (list) {
const metaList = JSON.parse(JSON.stringify(list))
@@ -773,7 +781,6 @@ export default {
}
},
mounted () {
this.getEntityIndexData()
let { q, listMode } = this.$route.query
// 如果地址栏有listMode即列表页并非首页则开始搜索
@@ -788,6 +795,9 @@ export default {
if (q) {
str1 = q.substring(q.indexOf('%'), q.indexOf('%') + 3)
}
if (q.indexOf('+') > -1) {
q = q.replace('+', '')
}
if (q && q.indexOf('%') > 0 && (str1 !== '%20' || str1 === '%25')) {
q = decodeURI(q)
}
@@ -797,6 +807,10 @@ export default {
this.$store.commit('resetScoreBase')
this.queryScoreBase()
}
if (!this.showList) {
this.getEntityIndexData()
}
},
watch: {
timeFilter () {