commit | author | age
|
9bcb19
|
1 |
<template> |
I |
2 |
<a-tree-select |
|
3 |
:dropdownStyle="{ maxHeight: '300px', overflow: 'auto' }" |
|
4 |
allowClear |
|
5 |
:treeData="orgTree" |
|
6 |
:placeholder="placeholder" |
|
7 |
treeDefaultExpandAll |
|
8 |
@change="onchange" |
|
9 |
> |
|
10 |
<span slot="title" slot-scope="{ id }">{{ id }}</span> |
|
11 |
</a-tree-select> |
|
12 |
</template> |
|
13 |
<script> |
|
14 |
import { getOrgTree } from '@/api/modular/system/orgManage' |
|
15 |
|
|
16 |
export default { |
|
17 |
name: 'DepartSelect', |
|
18 |
props: { |
|
19 |
placeholder: { |
|
20 |
type: String |
|
21 |
}, |
|
22 |
value: { |
|
23 |
type: String |
|
24 |
} |
|
25 |
}, |
|
26 |
data() { |
|
27 |
return { |
|
28 |
orgTree: [] |
|
29 |
} |
|
30 |
}, |
|
31 |
created() { |
|
32 |
this.getOrgData() |
|
33 |
}, |
|
34 |
methods: { |
|
35 |
getOrgData() { |
|
36 |
getOrgTree().then((res) => { |
|
37 |
this.orgTree = res |
|
38 |
}) |
|
39 |
}, |
|
40 |
/** |
|
41 |
* 选择树机构,初始化机构名称于表单中 |
|
42 |
*/ |
|
43 |
onchange (value) { |
|
44 |
this.$emit('change', value) |
|
45 |
} |
|
46 |
} |
|
47 |
} |
|
48 |
</script> |