a42b3256
wuxw
HC小区管理系统前段vue版正在开发中
|
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
<template>
<el-card class="org-tree-card">
<el-tree
ref="orgTree"
:data="orgTreeData"
:props="defaultProps"
node-key="id"
highlight-current
default-expand-all
@node-click="handleNodeClick"
/>
</el-card>
</template>
<script>
import { queryAdminOrgTree } from '@/api/staff/storeStaffApi'
export default {
name: 'StoreOrgTree',
data() {
return {
orgTreeData: [],
defaultProps: {
children: 'children',
label: 'text'
}
}
},
created() {
this.fetchOrgTree()
},
methods: {
async fetchOrgTree() {
let _dataTree = [{
id:'1',
text:'全部',
children: []
}]
try {
const { data } = await queryAdminOrgTree({ hc: 1.8 })
_dataTree[0].children = data
this.orgTreeData = _dataTree
} catch (error) {
this.$message.error(this.$t('storeOrgTree.fetchError'))
}
},
handleNodeClick(data) {
this.$emit('switchOrg', {
orgId: data.id,
orgName: data.text
})
},
refreshTree() {
this.fetchOrgTree()
}
}
}
</script>
<style lang="scss" scoped>
.org-tree-card {
height: 100%;
.el-tree {
height: 100%;
overflow: auto;
}
}
</style>
|