VariablesSelector.vue
1.41 KB
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
<template>
<el-popover placement="bottom-start" v-model="visible">
<ht-tree
style="max-height:400px;width:300px;overflow: auto;"
v-if="visible"
:data="data"
:node-key="nodeKey"
:expand-on-click-node="false"
:props="props"
:support-filter="supportFilter"
:default-expand-all="defaultExpandAll"
@node-click="handleNodeClick"
></ht-tree>
<el-button slot="reference">选择变量</el-button>
</el-popover>
</template>
<script>
import utils from "@/hotent-ui-util.js";
export default {
props: {
data: {
type: Array,
default: () => {
return [];
}
},
buttonLabel: {
type: String,
default: "选择变量"
},
supportFilter: {
type: Boolean,
default: false
},
defaultExpandAll: {
type: Boolean,
default: true
},
nodeKey: {
type: String,
default: "id"
},
props: {
type: Object,
default: () => {
return { children: "children", label: "label" };
}
}
},
data() {
return {
visible: false
};
},
methods: {
handleNodeClick(selection, node) {
if (selection && selection.children && selection.children.length > 0) {
return;
}
this.visible = false;
this.$emit("node-click", selection, node);
}
}
};
</script>
<style scoped>
div >>> .el-dialog__body {
padding: 10px;
}
</style>