Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 业务选择器分页不显示对应的业务 #8322

Merged
merged 4 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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