Skip to content

Commit

Permalink
Merge pull request #8289 from TencentBlueKing/v3.13.x
Browse files Browse the repository at this point in the history
Merge branch 'v3.13.x' into feature-layered
  • Loading branch information
ZQHcode authored Dec 3, 2024
2 parents 18481d8 + e6e1d32 commit 096216b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
7 changes: 5 additions & 2 deletions src/ui/src/components/model-manage/_create-model.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
name="modelGroup"
:value="modelDialog.data.bk_classification_id"
:scroll-height="200">
<bk-option v-for="(option) in classifications"
<bk-option v-for="(option) in allClassifications"
:key="option.bk_classification_id"
:id="option.bk_classification_id"
:name="option.bk_classification_name">
Expand Down Expand Up @@ -142,7 +142,10 @@
computed: {
...mapGetters('objectModelClassify', [
'classifications'
])
]),
allClassifications() {
return this.classifications.filter((item)=> !item.bk_ishidden)
}
},
watch: {
isShow(isShow) {
Expand Down
36 changes: 24 additions & 12 deletions src/ui/src/components/ui/form/organization.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@
</template>

<script setup>
import { computed, ref } from 'vue'
import { computed, ref, watch, nextTick } from 'vue'
import { useStore } from '@/store'
import debounce from 'lodash.debounce'
import { isEmptyPropertyValue } from '@/utils/tools'

const props = defineProps({
value: {
type: [Array, String, Number],
default: () => []
default: () => ([])
},
disabled: {
type: Boolean,
Expand Down Expand Up @@ -102,13 +102,7 @@
const store = useStore()
const searchRequestId = Symbol('orgSearch')

const initValue = props.value
const localMultiple = computed(() => {
if (Array.isArray(initValue) && initValue.length > 1 && !props.multiple) {
return true
}
return props.multiple
})
const localMultiple = computed(() => props.multiple)

const treeProps = computed(() => ({
showCheckbox: localMultiple.value,
Expand Down Expand Up @@ -136,12 +130,30 @@
return this.value || ''
},
set(value) {
emit('on-checked', value)
emit('change', value)
emit('input', value)
let val = value || null
if (val) {
val = Array.isArray(value) ? value : [value]
}
emit('on-checked', val)
emit('change', val)
emit('input', val)
}
})

watch(() => props.multiple, (isMultiple) => {
checked.value = []
nextTick(() => {
const { checked: checkedData } = tree.value
if (isMultiple) {
checkedData.forEach((id) => {
tree.value?.setChecked(id, { emitEvent: true, checked: false })
})
} else {
tree.value?.setSelected(-1, true)
}
})
})

const loadTree = async () => {
const { data: topData } = await getLazyData()

Expand Down

0 comments on commit 096216b

Please sign in to comment.