|
@@ -3,10 +3,19 @@
|
|
|
<el-tree
|
|
|
:data="treeData"
|
|
|
:props="defaultProps"
|
|
|
+ highlight-current
|
|
|
@node-click="handleNodeClick"
|
|
|
+ :default-checked-keys="[activeIndex]"
|
|
|
>
|
|
|
<div class="custom-tree-node" slot-scope="{ node }">
|
|
|
- <div>
|
|
|
+ <div
|
|
|
+ :class="[
|
|
|
+ activeIndex == node.data.id
|
|
|
+ ? 'tree_box_item_active'
|
|
|
+ : 'tree_box_item',
|
|
|
+ node.data.children ? 'tree_box_item_father' : ''
|
|
|
+ ]"
|
|
|
+ >
|
|
|
<span style="margin-right: 10px">{{ node.label }}</span>
|
|
|
</div>
|
|
|
</div></el-tree
|
|
@@ -17,7 +26,7 @@
|
|
|
paddingLeft:
|
|
|
node.is_courseware === 'false'
|
|
|
? node.nodexIndex * 22 + 8 + 'px'
|
|
|
- : '0px',
|
|
|
+ : '0px'
|
|
|
}"
|
|
|
class="tree_box"
|
|
|
slot-scope="{ node, path, tree }"
|
|
@@ -48,7 +57,7 @@
|
|
|
'tree_box_' + node.nodexIndex,
|
|
|
activeIndex !== '' && JSON.stringify(node).indexOf(activeIndex) > -1
|
|
|
? 'tree_box_item_light'
|
|
|
- : '',
|
|
|
+ : ''
|
|
|
]"
|
|
|
@click="tree.toggleFold(node, path)"
|
|
|
v-if="node.is_courseware === 'false'"
|
|
@@ -59,7 +68,7 @@
|
|
|
:class="[
|
|
|
'tree_box_item',
|
|
|
'tree_box_leaf',
|
|
|
- activeIndex == node.id ? 'tree_box_item_active' : '',
|
|
|
+ activeIndex == node.id ? 'tree_box_item_active' : ''
|
|
|
]"
|
|
|
:style="{ paddingLeft: node.nodexIndex * 22 + 12 + 'px' }"
|
|
|
@click="handleNodeClick(node, path)"
|
|
@@ -119,13 +128,15 @@ export default {
|
|
|
defaultProps: {
|
|
|
children: "children",
|
|
|
label: "label",
|
|
|
+ nodeKey: "id",
|
|
|
isLeaf: (data, node) => {
|
|
|
if (data.is_leaf === "true") {
|
|
|
// 实体门店 叶子结点 不展示icon
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ isPhone: false // 是否是移动端打开
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -219,6 +230,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
+ const regExp = /Android|webOS|iPhone|BlackBerry|IEMobile|Opera Mini/i;
|
|
|
+ this.isPhone = regExp.test(navigator.userAgent);
|
|
|
this.getList();
|
|
|
//this.$refs.tree.foldAllAfterMounted = true;
|
|
|
}
|
|
@@ -328,4 +341,32 @@ export default {
|
|
|
font-weight: normal !important;
|
|
|
}
|
|
|
}
|
|
|
+.he_tree_view {
|
|
|
+ .tree_box_item_active {
|
|
|
+ color: #ff9900;
|
|
|
+ }
|
|
|
+ .custom-tree-node {
|
|
|
+ color: #2c2c2c;
|
|
|
+ height: 100%;
|
|
|
+ display: block !important;
|
|
|
+ }
|
|
|
+ .el-tree--highlight-current
|
|
|
+ .el-tree-node.is-current
|
|
|
+ > .el-tree-node__content {
|
|
|
+ background: none;
|
|
|
+ }
|
|
|
+ .tree_box_item {
|
|
|
+ font-weight: 400;
|
|
|
+ -webkit-box-align: center;
|
|
|
+ -ms-flex-align: center;
|
|
|
+ align-items: center;
|
|
|
+ line-height: 44px;
|
|
|
+ overflow: hidden;
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ &_father {
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|