1 | <template>
|
2 | <div class='list-group system-left-tree' style="overflow-x: auto">
|
3 |
|
4 | <div class="chi">
|
5 | <tree :model='functions' :is-click="isClick === false ? isClick : true" style="display: inline-block" v-ref:resourcetree>
|
6 | <span partial>
|
7 |
|
8 | <span :class="{ 'tree-img': isFolder(row), 'tree-span': !isFolder(row) }" v-if="!isClick" >
|
9 | <img v-if="isFolder(row)" :src="$parent.$parent.imgSrc" alt="">{{row.data.name}}
|
10 | </span>
|
11 |
|
12 | <img v-if="row.data.resourcetype === 'root'" src="../../../static/ldaplefticon/root.png" style="margin-right: 5px">
|
13 | <img v-if="row.data.name === '组织机构' " src="../../../static/ldaplefticon/organization.png" style="margin-right: 5px">
|
14 | <img v-if="row.data.name === '功能模块' " src="../../../static/ldaplefticon/功能模块.png" style="margin-right: 5px">
|
15 | <img v-if="row.data.name === '功能权限' " src="../../../static/ldaplefticon/功能权限.png" style="margin-right: 5px">
|
16 | <img v-if="row.data.name === '手机服务' " src="../../../static/ldaplefticon/手机服务.png" style="margin-right: 5px">
|
17 | <img v-if="row.data.name === '超级管理员' " src="../../../static/ldaplefticon/超级管理员.png" style="margin-right: 5px">
|
18 | <img v-if="row.data.name === '客服系统' " src="../../../static/ldaplefticon/客服系统.png" style="margin-right: 5px">
|
19 | <img v-if="row.data.resourcetype === 'organization' && row.data.name !== '组织机构' " src="../../../static/ldaplefticon/gongsi.png" style="margin-right: 5px">
|
20 | <img v-if="row.data.resourcetype === 'user' && row.data.name !== '超级管理员' " src="../../../static/ldaplefticon/renyuan.png" style="margin-right: 5px">
|
21 | <img v-if="row.data.resourcetype === 'role'" src="../../../static/ldaplefticon/role.png" style="margin-right: 5px">
|
22 | <img v-if="row.data.resourcetype === 'zone'" src="../../../static/ldaplefticon/zone.png" style="margin-right: 5px">
|
23 | <img v-if="row.data.resourcetype === 'department'" src="../../../static/ldaplefticon/department.png" style="margin-right: 5px">
|
24 |
|
25 | <span v-if="isClick">{{row.data.name}}</span>
|
26 |
|
27 | <img v-if="row.data.haslicense && row.data.haslicense !== 'false'" src="../../../static/ldaplefticon/qx.png" style="margin:0 0 0 5px; height: 1em; width: 0.8em ">
|
28 | </span>
|
29 | </tree>
|
30 | </div>
|
31 | </div>
|
32 | </template>
|
33 |
|
34 | <script>
|
35 | export default {
|
36 | props: ['functions', 'userid', 'isClick'],
|
37 | title: '左侧树菜单',
|
38 | data () {
|
39 | return {
|
40 | imgSrc: './static/treeset.png'
|
41 | }
|
42 | },
|
43 | ready(){
|
44 |
|
45 | },
|
46 | methods: {
|
47 | open (row) {
|
48 | if (row.data.name === '资源管理') {
|
49 | this.$parent.changeMain(row.data.id)
|
50 | return
|
51 | }
|
52 | if (this.$parent.routeName === 'main') {
|
53 | if (row.data.link) {
|
54 | this.$goto(row.data.link, {data: row.data, userid: this.userid}, 'main')
|
55 | }
|
56 | }else {
|
57 | if (row.data.resourcetype) {
|
58 |
|
59 | if(row.data.hasright){
|
60 | let parent = this.functions
|
61 | delete parent.children
|
62 |
|
63 | if(row.data.name=='部门管理'||row.data.name=='角色管理'||row.data.name=='人员管理'||row.data.name=='资源调配'){
|
64 | this.$goto(row.data.link, {data: row.data,parent: parent,userid: this.userid,compid:row.data.id}, 'resmain')
|
65 | }else {
|
66 | this.$goto(row.data.resourcetype, {data: row.data,parent: parent,userid: this.userid,compid:row.data.id}, 'resmain')
|
67 | }
|
68 | }
|
69 | }
|
70 | }
|
71 | }
|
72 | },
|
73 | events: {
|
74 | 'select-changed': function (data) {
|
75 |
|
76 | console.log('发生变化 树。。')
|
77 | this.open(data.val)
|
78 |
|
79 | },
|
80 | 'toggle' () {
|
81 | console.log('接收到展开事件', this.$refs.resourcetree)
|
82 |
|
83 | this.$refs.resourcetree.$el.scrollLeft = this.$refs.resourcetree.$el.scrollWidth - this.$refs.resourcetree.$el.clientWidth
|
84 |
|
85 | }
|
86 | }
|
87 | }
|
88 | </script>
|