Skip to content

Commit

Permalink
fix: 业务选择器分页不显示对应的业务 (#8322)
Browse files Browse the repository at this point in the history
* fix: 业务选择器分页不显示对应的业务
--bug=136907985

* fix: 业务拓扑点击刷新机器数量一直加载中
--bug=136833653

* fix: 自动应用搜索值用name属性
--bug=136841923

* 优化
  • Loading branch information
zc422 authored Jan 20, 2025
1 parent 667755e commit 38ccdc2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/ui/src/components/ui/selector/business-mix.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
},
localSelected: {
get() {
console.log(this.value, 'this.value')
return this.value
},
set(value) {
Expand All @@ -130,6 +129,14 @@
}
}
},
watch: {
localSelected() {
const hasFirstPage = this.displayList.filter(list => list.id === this.value).length
if (!hasFirstPage) {
this.setBizChoose()
}
}
},
async created() {
this.getData()

Expand Down Expand Up @@ -195,6 +202,9 @@
this.displayList = value
}

this.setBizChoose()
},
setBizChoose() {
// 由于使用了分页加载,当前选中的业务可能不在列表中select组件无法回显,通过调用registerOption解决
this.$nextTick(() => {
const selectedOption = this.normalizationList.find(item => item.id === this.localSelected)
Expand All @@ -216,13 +226,11 @@
const lowerName = option.name.toLowerCase()
const matched = lowerName.indexOf(searchValue) !== -1
if (matched) {
console.log(option)
displayList.push(option)
} else {
const pinyinList = this.$bkToPinyin(lowerName, true, '-').split('-')
const pinyinStr = pinyinList.reduce((res, cur) => res + cur[0], '')
if (pinyinList.join('').indexOf(searchValue) !== -1 || pinyinStr.indexOf(searchValue) !== -1) {
console.log(option, 'pppyy')
displayList.push(option)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@
this.$set(data, 'status', 'finished')
this.$set(data, 'host_count', count.host_count)
this.$set(data, 'service_instance_count', count.service_instance_count)
this.$forceUpdate()
})
} catch (error) {
console.error(error)
Expand Down
5 changes: 4 additions & 1 deletion src/ui/src/views/host-apply/children/search-select-mix.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import { mapGetters } from 'vuex'
import has from 'has'
import { CONFIG_MODE } from '@/service/service-template/index.js'
import { PROPERTY_TYPES } from '@/dictionary/property-constants'

export default {
props: {
Expand Down Expand Up @@ -163,8 +164,10 @@
if (isAny) {
rule.operator = 'exist'
} else {
// 对枚举类型特殊处理
const val = item.type === PROPERTY_TYPES.ENUM ? value.name : value.id
rule.operator = 'contains'
rule.value = String(value.id).trim()
rule.value = String(val).trim()
}
rules.push(rule)
} else {
Expand Down

0 comments on commit 38ccdc2

Please sign in to comment.