Skip to content

Commit 096216b

Browse files
authored
Merge pull request #8289 from TencentBlueKing/v3.13.x
Merge branch 'v3.13.x' into feature-layered
2 parents 18481d8 + e6e1d32 commit 096216b

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

src/ui/src/components/model-manage/_create-model.vue

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
name="modelGroup"
3838
:value="modelDialog.data.bk_classification_id"
3939
:scroll-height="200">
40-
<bk-option v-for="(option) in classifications"
40+
<bk-option v-for="(option) in allClassifications"
4141
:key="option.bk_classification_id"
4242
:id="option.bk_classification_id"
4343
:name="option.bk_classification_name">
@@ -142,7 +142,10 @@
142142
computed: {
143143
...mapGetters('objectModelClassify', [
144144
'classifications'
145-
])
145+
]),
146+
allClassifications() {
147+
return this.classifications.filter((item)=> !item.bk_ishidden)
148+
}
146149
},
147150
watch: {
148151
isShow(isShow) {

src/ui/src/components/ui/form/organization.vue

+24-12
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@
5555
</template>
5656

5757
<script setup>
58-
import { computed, ref } from 'vue'
58+
import { computed, ref, watch, nextTick } from 'vue'
5959
import { useStore } from '@/store'
6060
import debounce from 'lodash.debounce'
6161
import { isEmptyPropertyValue } from '@/utils/tools'
6262

6363
const props = defineProps({
6464
value: {
6565
type: [Array, String, Number],
66-
default: () => []
66+
default: () => ([])
6767
},
6868
disabled: {
6969
type: Boolean,
@@ -102,13 +102,7 @@
102102
const store = useStore()
103103
const searchRequestId = Symbol('orgSearch')
104104

105-
const initValue = props.value
106-
const localMultiple = computed(() => {
107-
if (Array.isArray(initValue) && initValue.length > 1 && !props.multiple) {
108-
return true
109-
}
110-
return props.multiple
111-
})
105+
const localMultiple = computed(() => props.multiple)
112106

113107
const treeProps = computed(() => ({
114108
showCheckbox: localMultiple.value,
@@ -136,12 +130,30 @@
136130
return this.value || ''
137131
},
138132
set(value) {
139-
emit('on-checked', value)
140-
emit('change', value)
141-
emit('input', value)
133+
let val = value || null
134+
if (val) {
135+
val = Array.isArray(value) ? value : [value]
136+
}
137+
emit('on-checked', val)
138+
emit('change', val)
139+
emit('input', val)
142140
}
143141
})
144142

143+
watch(() => props.multiple, (isMultiple) => {
144+
checked.value = []
145+
nextTick(() => {
146+
const { checked: checkedData } = tree.value
147+
if (isMultiple) {
148+
checkedData.forEach((id) => {
149+
tree.value?.setChecked(id, { emitEvent: true, checked: false })
150+
})
151+
} else {
152+
tree.value?.setSelected(-1, true)
153+
}
154+
})
155+
})
156+
145157
const loadTree = async () => {
146158
const { data: topData } = await getLazyData()
147159

0 commit comments

Comments
 (0)