index.vue
973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<template>
<div class="comSelect-container">
<NCC-TreeSelect :options="treeData" v-model="innerValue" :placeholder="placeholder"
:clearable="clearable" :disabled="disabled" v-on="$listeners" lastLevel lastLevelKey='type'
:multiple="multiple" lastLevelValue='user'>
</NCC-TreeSelect>
</div>
</template>
<script>
export default {
name: 'userSelect',
props: ["value", "disabled", "placeholder", "multiple", "clearable"],
model: {
prop: 'value',
event: 'input'
},
data() {
return {
treeData: [],
innerValue: this.value
}
},
methods: {
async getData() {
this.treeData = await this.$store.dispatch('base/getUserTree')
}
},
created() {
this.getData()
},
watch: {
innerValue(val) {
val && this.$emit('change', val)
},
value(val) {
this.innerValue = val
}
}
}
</script>
<style lang="scss">
.comSelect-container {
.el-select {
width: 100%;
}
}
</style>