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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
| <template>
| <div class="gongkongMain">
| <div>
| <el-tree :props="defaultProps" lazy @node-click="handleNodeClick" :load="treeLoad" node-key="id"/>
| </div>
| <div>内容</div>
| </div>
|
| </template>
| <script>
| export default {
| components: {},
| data() {
| return {
| defaultProps: {
| children: 'children',
| label: 'name',
| isLeaf: (data) => !data.hasChildren
| },
| treeData: []
| }
| },
| computed: {},
| watch: {
|
| },
| methods: {
| treeLoad (node, resolve) {
| // 如果是根节点(level=0),加载根节点数据
| const parentId = node.level === 0 ? 0 : node.data.id;
| this.loading = true;
| var obj = {nodeId: parentId}
| axios({
| url: '/blade-mdm/gkw/node/lazy-list',
| method: 'get',
| params: obj,
| }).then(
| res => {
| resolve(res.data.data);
| }
| ).catch(() => resolve([]));
| },
| // getPre() {
| // axios({
| // url: '/blade-mdm/gkw/node/lazy-list',
| // method: 'get',
| // params: {nodeId: this.nodeId}
| // }).then(
| // res => {
| // this.treeData = res.data.data; });
| // },
| handleNodeClick(a,b,c,d) {
| console.og(a,b,c,d)
| }
| },
| mounted() {
| //this.getPre();
| //判断版本 0:涉密网,1:工控网;
| // axios({url: '/blade-mdm/system/param/getValue?paramKey=networkType',method: 'get'}).then(res => {
| // if(res.data.data === "0") {
| // this.isSM = true;
| // }else {
| // this.getPre();
| // }
| // }
| // );
| }
| };
| </script>
|
| <style lang="scss">
| .gongkongMain {
| display: flex;
| padding: 0px;
| margin: 0px 7px 10px 7px;
| background-color: #fff;
| border-top: 1px solid #ccc;
| > div {
| padding: 12px;
| }
| }
| .gongkongMain > div:nth-child(1) {
| width:25%;
| border-right: 1px solid #ccc;
| }
| .gongkongMain div:nth-child(2) {
| flex: 1;
| padding-left: 20px;
| }
| </style>
|
|