mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-19 09:43:32 +00:00
fix: 修复搜索组件在页面刷新后搜索条件是布尔类型时页面不显示中文问题
1、优化获取url中搜索条件的算法
This commit is contained in:
@@ -151,32 +151,39 @@ export default {
|
||||
// this.$nextTick(() => this.$emit('tagSearch', this.filterMaps))
|
||||
},
|
||||
methods: {
|
||||
// 判断url中的查询条件
|
||||
// 获取url中的查询条件,判断是不是包含在当前查询条件里
|
||||
checkInTableColumns() {
|
||||
const routeQuery = this.getUrlQuery ? this.$route?.query : {}
|
||||
const routeQueryKeys = Object.keys(routeQuery)
|
||||
const routeQueryKeysLength = routeQueryKeys.length
|
||||
const keys = {}
|
||||
if (routeQueryKeys.length < 1) return keys
|
||||
if (routeQueryKeys.length > 0) {
|
||||
for (let i = 0; i < routeQueryKeys.length; i++) {
|
||||
if (routeQueryKeysLength < 1) return keys
|
||||
if (routeQueryKeysLength > 0) {
|
||||
for (let i = 0; i < routeQueryKeysLength; i++) {
|
||||
const key = routeQueryKeys[i]
|
||||
const valueDecode = decodeURI(routeQuery[key])
|
||||
let valueDecode = decodeURI(routeQuery[key])
|
||||
const isSearch = key !== 'search'
|
||||
for (let k = 0, len = this.options.length; k < len; k++) {
|
||||
const cur = this.options[k]
|
||||
const curOptions = this.options || []
|
||||
for (let k = 0, len = curOptions.length; k < len; k++) {
|
||||
const cur = curOptions[k]
|
||||
if (cur?.type === 'boolean') {
|
||||
valueDecode = !!valueDecode
|
||||
}
|
||||
if (key === cur.value || !isSearch) {
|
||||
const curChildren = cur.children || []
|
||||
keys[key] = {
|
||||
...cur,
|
||||
key,
|
||||
label: isSearch ? cur.label : '',
|
||||
value: valueDecode
|
||||
}
|
||||
if (isSearch && curChildren.length > 0) {
|
||||
curChildren.forEach(item => {
|
||||
for (const item of curChildren) {
|
||||
if (valueDecode === item.value) {
|
||||
keys[key].valueLabel = item.label
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user