|
@@ -2,7 +2,6 @@
|
|
<div
|
|
<div
|
|
v-if="true"
|
|
v-if="true"
|
|
class="vl-layer-tree flex-align-center"
|
|
class="vl-layer-tree flex-align-center"
|
|
- :style="`width: ${height}px;height: ${height}px;`"
|
|
|
|
>
|
|
>
|
|
<!-- <template v-if="$slots.default">
|
|
<!-- <template v-if="$slots.default">
|
|
<slot />
|
|
<slot />
|
|
@@ -29,6 +28,7 @@
|
|
:render="renderContent"
|
|
:render="renderContent"
|
|
expand-node
|
|
expand-node
|
|
class="layer-tree"
|
|
class="layer-tree"
|
|
|
|
+ @on-toggle-expand="toggleExpandHandle"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</transition>
|
|
</transition>
|
|
@@ -77,13 +77,15 @@ export default {
|
|
mounted() {
|
|
mounted() {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ toggleExpandHandle(node, evt){
|
|
|
|
+ console.log(evt)
|
|
|
|
+ },
|
|
getTreeData() {
|
|
getTreeData() {
|
|
this.expandIdsSet.clear()
|
|
this.expandIdsSet.clear()
|
|
layerConfigEach(this.treeData, (item, hasChild) => {
|
|
layerConfigEach(this.treeData, (item, hasChild) => {
|
|
const { id, expand } = item
|
|
const { id, expand } = item
|
|
expand && this.expandIdsSet.add(id)
|
|
expand && this.expandIdsSet.add(id)
|
|
})
|
|
})
|
|
-
|
|
|
|
this.treeData.splice(0)
|
|
this.treeData.splice(0)
|
|
this.dealTreeData(this.enabledLayers, this.treeData)
|
|
this.dealTreeData(this.enabledLayers, this.treeData)
|
|
},
|
|
},
|
|
@@ -109,64 +111,6 @@ export default {
|
|
},
|
|
},
|
|
renderContent(h, { root, node, data }) {
|
|
renderContent(h, { root, node, data }) {
|
|
const { visible, name, id, isGroup, item } = data
|
|
const { visible, name, id, isGroup, item } = data
|
|
- const btns = [
|
|
|
|
- h('span', {
|
|
|
|
- class: ['btn', 'opacity'],
|
|
|
|
- on: {
|
|
|
|
- click: (e) => {
|
|
|
|
- e.stopPropagation()
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }, [
|
|
|
|
- h('Poptip', {
|
|
|
|
- props: {
|
|
|
|
- placement: 'left',
|
|
|
|
- trigger: 'hover'
|
|
|
|
- }
|
|
|
|
- }, [
|
|
|
|
- h('Icon', {
|
|
|
|
- props: {
|
|
|
|
- type: 'md-contrast'
|
|
|
|
- },
|
|
|
|
- style:{fontSize:'18px'}
|
|
|
|
- }),
|
|
|
|
- h('Slider', {
|
|
|
|
- slot: 'content',
|
|
|
|
- props: {
|
|
|
|
- 'show-tip': 'never',
|
|
|
|
- 'show-input': true,
|
|
|
|
- value: (item.opacity || 1) * 100
|
|
|
|
- },
|
|
|
|
- on: {
|
|
|
|
- input: (value) => {
|
|
|
|
- this.changeOpacity(item, value)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- ])
|
|
|
|
- ]),
|
|
|
|
- h('span', {
|
|
|
|
- class: 'btn',
|
|
|
|
- on: {
|
|
|
|
- click: (e) => {
|
|
|
|
- e.stopPropagation()
|
|
|
|
- this.changeVisible(item)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }, [
|
|
|
|
- h('Icon', {
|
|
|
|
- props: {
|
|
|
|
- type: `${visible ? 'md-eye' : 'md-eye-off'}`
|
|
|
|
- },
|
|
|
|
- class: `${visible ? 'visible' : ''}`,
|
|
|
|
- style:{fontSize:'20px'}
|
|
|
|
- })
|
|
|
|
- ])
|
|
|
|
- ]
|
|
|
|
- if (isBoolean(item.opacity)) {
|
|
|
|
- btns.shift()
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
return h('div', {
|
|
return h('div', {
|
|
class: [
|
|
class: [
|
|
'flex-between',
|
|
'flex-between',
|
|
@@ -179,30 +123,39 @@ export default {
|
|
]
|
|
]
|
|
}, [
|
|
}, [
|
|
h('span', { class: 'flex-1', style: { cursor: 'pointer' }}, [
|
|
h('span', { class: 'flex-1', style: { cursor: 'pointer' }}, [
|
|
|
|
+ isGroup ?
|
|
h('Icon', {
|
|
h('Icon', {
|
|
props: {
|
|
props: {
|
|
- type: `${isGroup ? 'ios-folder-outline' : 'ios-map-outline'}`
|
|
|
|
|
|
+ type: item['icon'],
|
|
|
|
+ color: '#1790EC',
|
|
|
|
+ size: 20
|
|
},
|
|
},
|
|
style: {
|
|
style: {
|
|
marginRight: '4px'
|
|
marginRight: '4px'
|
|
}
|
|
}
|
|
- }),
|
|
|
|
|
|
+ }):
|
|
|
|
+ h('Checkbox', {
|
|
|
|
+ props: {
|
|
|
|
+ value: item['visible']
|
|
|
|
+ },
|
|
|
|
+ style: {
|
|
|
|
+ marginRight: '4px'
|
|
|
|
+ },
|
|
|
|
+ on: {
|
|
|
|
+ 'on-change': (val)=>{
|
|
|
|
+ item['visible'] = val
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }, []),
|
|
h('span', { class: 'label' }, name)
|
|
h('span', { class: 'label' }, name)
|
|
]),
|
|
]),
|
|
- h('div', {
|
|
|
|
- class: `btns`,
|
|
|
|
- on: {
|
|
|
|
- click: (e) => {
|
|
|
|
- e.stopPropagation()
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }, btns)
|
|
|
|
])
|
|
])
|
|
},
|
|
},
|
|
changeVisible(item) {
|
|
changeVisible(item) {
|
|
//
|
|
//
|
|
const { visible } = item
|
|
const { visible } = item
|
|
- item.visible = !visible
|
|
|
|
|
|
+
|
|
|
|
+ item.checked = item.visible = !visible
|
|
},
|
|
},
|
|
changeOpacity(item, value) {
|
|
changeOpacity(item, value) {
|
|
item.opacity = value / 100
|
|
item.opacity = value / 100
|
|
@@ -214,29 +167,21 @@ export default {
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
.vl-layer-tree {
|
|
.vl-layer-tree {
|
|
position: relative;
|
|
position: relative;
|
|
-
|
|
|
|
.layer-dropdown {
|
|
.layer-dropdown {
|
|
- position: absolute;
|
|
|
|
- top: 100%;
|
|
|
|
- right: 0;
|
|
|
|
- margin: 5px 0;
|
|
|
|
- padding: 5px 0;
|
|
|
|
background-color: #fff;
|
|
background-color: #fff;
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
border-radius: 4px;
|
|
border-radius: 4px;
|
|
box-shadow: 0 1px 6px rgb(0 0 0 / 20%);
|
|
box-shadow: 0 1px 6px rgb(0 0 0 / 20%);
|
|
z-index: 900;
|
|
z-index: 900;
|
|
-
|
|
|
|
|
|
+ width: 100%;
|
|
.layer-tree {
|
|
.layer-tree {
|
|
- min-width: 440px;
|
|
|
|
|
|
+ width: 100%;
|
|
max-height: 75vh;
|
|
max-height: 75vh;
|
|
- padding: 0 10px;
|
|
|
|
line-height: 2em;
|
|
line-height: 2em;
|
|
color: #515a6e;
|
|
color: #515a6e;
|
|
cursor: default;
|
|
cursor: default;
|
|
overflow-x: hidden;
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
overflow-y: auto;
|
|
-
|
|
|
|
::v-deep {
|
|
::v-deep {
|
|
.ivu-tree-title {
|
|
.ivu-tree-title {
|
|
width: 100%;
|
|
width: 100%;
|
|
@@ -259,9 +204,9 @@ export default {
|
|
padding: 0.3em;
|
|
padding: 0.3em;
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
-
|
|
|
|
- .visible {
|
|
|
|
-
|
|
|
|
|
|
+ color: #777;
|
|
|
|
+ >.visible {
|
|
|
|
+ color: #2d8cf0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -270,7 +215,7 @@ export default {
|
|
padding: 4px;
|
|
padding: 4px;
|
|
|
|
|
|
.ivu-poptip-body-content {
|
|
.ivu-poptip-body-content {
|
|
- padding: 0 10px;
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
.ivu-slider {
|
|
.ivu-slider {
|
|
@@ -308,26 +253,20 @@ export default {
|
|
|
|
|
|
ul li {
|
|
ul li {
|
|
margin: 3px 0;
|
|
margin: 3px 0;
|
|
|
|
+ position: relative;
|
|
|
|
+ background: #fff;
|
|
}
|
|
}
|
|
-
|
|
|
|
.layer-group {
|
|
.layer-group {
|
|
width: 98%;
|
|
width: 98%;
|
|
height: auto;
|
|
height: auto;
|
|
float: left;
|
|
float: left;
|
|
- height: 40px;
|
|
|
|
- line-height: 40px;
|
|
|
|
- background: #eef3ff;
|
|
|
|
border-radius: 4px 4px 4px 4px;
|
|
border-radius: 4px 4px 4px 4px;
|
|
- padding: 0 10px;
|
|
|
|
- margin-bottom: 8px;
|
|
|
|
-
|
|
|
|
font-weight: normal;
|
|
font-weight: normal;
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
- color: #717C89;
|
|
|
|
|
|
+ color: #171717;
|
|
|
|
|
|
.group-title {
|
|
.group-title {
|
|
height: 30px;
|
|
height: 30px;
|
|
- line-height: 30px;
|
|
|
|
padding-left: 15px;
|
|
padding-left: 15px;
|
|
background: #F4F7FB;
|
|
background: #F4F7FB;
|
|
font-weight: 400;
|
|
font-weight: 400;
|
|
@@ -349,12 +288,6 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- .group-item {
|
|
|
|
- //margin-bottom: 2px;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
.group-item.open > .layer-item {
|
|
.group-item.open > .layer-item {
|
|
display: block;
|
|
display: block;
|
|
}
|
|
}
|
|
@@ -450,20 +383,12 @@ export default {
|
|
width: 98%;
|
|
width: 98%;
|
|
height: auto;
|
|
height: auto;
|
|
float: left;
|
|
float: left;
|
|
- height: 40px;
|
|
|
|
- line-height: 40px;
|
|
|
|
- background: rgba(89, 136, 255, .1);
|
|
|
|
border-radius: 4px 4px 4px 4px;
|
|
border-radius: 4px 4px 4px 4px;
|
|
- padding: 0 10px;
|
|
|
|
- margin-bottom: 8px;
|
|
|
|
-
|
|
|
|
font-weight: normal;
|
|
font-weight: normal;
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
- color: rgba(68, 106, 231, 1);
|
|
|
|
|
|
+ color: #171717;
|
|
|
|
|
|
.group-title {
|
|
.group-title {
|
|
- height: 30px;
|
|
|
|
- line-height: 30px;
|
|
|
|
padding-left: 15px;
|
|
padding-left: 15px;
|
|
background: #F4F7FB;
|
|
background: #F4F7FB;
|
|
font-weight: 400;
|
|
font-weight: 400;
|
|
@@ -486,11 +411,6 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- .group-item {
|
|
|
|
- //margin-bottom: 2px;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
.group-item.open > .layer-item {
|
|
.group-item.open > .layer-item {
|
|
display: block;
|
|
display: block;
|
|
}
|
|
}
|
|
@@ -586,17 +506,10 @@ export default {
|
|
width: 98%;
|
|
width: 98%;
|
|
height: auto;
|
|
height: auto;
|
|
float: left;
|
|
float: left;
|
|
- height: 40px;
|
|
|
|
- line-height: 40px;
|
|
|
|
- background: rgba(89, 136, 255, 1);
|
|
|
|
border-radius: 4px 4px 4px 4px;
|
|
border-radius: 4px 4px 4px 4px;
|
|
- padding: 0 10px;
|
|
|
|
- margin-bottom: 8px;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ color: #171717;
|
|
font-weight: normal;
|
|
font-weight: normal;
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
- color: #fff;
|
|
|
|
|
|
|
|
.group-title {
|
|
.group-title {
|
|
height: 30px;
|
|
height: 30px;
|
|
@@ -622,12 +535,6 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- .group-item {
|
|
|
|
- //margin-bottom: 2px;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
.group-item.open > .layer-item {
|
|
.group-item.open > .layer-item {
|
|
display: block;
|
|
display: block;
|
|
}
|
|
}
|
|
@@ -722,16 +629,11 @@ export default {
|
|
width: 98%;
|
|
width: 98%;
|
|
height: auto;
|
|
height: auto;
|
|
float: left;
|
|
float: left;
|
|
- height: 40px;
|
|
|
|
- line-height: 40px;
|
|
|
|
- background: rgba(89, 136, 255, .1);
|
|
|
|
border-radius: 4px 4px 4px 4px;
|
|
border-radius: 4px 4px 4px 4px;
|
|
- padding: 0 10px;
|
|
|
|
- margin-bottom: 8px;
|
|
|
|
-
|
|
|
|
|
|
+
|
|
font-weight: normal;
|
|
font-weight: normal;
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
- color: rgba(113, 124, 137, 1);
|
|
|
|
|
|
+ color: #171717;
|
|
|
|
|
|
.group-title {
|
|
.group-title {
|
|
height: 30px;
|
|
height: 30px;
|
|
@@ -758,11 +660,6 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- .group-item {
|
|
|
|
- //margin-bottom: 2px;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
.group-item.open > .layer-item {
|
|
.group-item.open > .layer-item {
|
|
display: block;
|
|
display: block;
|
|
}
|
|
}
|
|
@@ -854,9 +751,6 @@ export default {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- .ivu-tree-arrow{
|
|
|
|
- line-height: 40px;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -902,11 +796,6 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- .group-item {
|
|
|
|
- //margin-bottom: 2px;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
.group-item.open > .layer-item {
|
|
.group-item.open > .layer-item {
|
|
display: block;
|
|
display: block;
|
|
}
|
|
}
|
|
@@ -999,4 +888,32 @@ export default {
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+::v-deep {
|
|
|
|
+ .layer-dropdown {
|
|
|
|
+ .layer-tree {
|
|
|
|
+ >ul {
|
|
|
|
+ >li {
|
|
|
|
+ border-bottom: 1px solid #D9E0EB;
|
|
|
|
+ border-left: 2px solid #138EEC;
|
|
|
|
+ padding: 5px 0px;
|
|
|
|
+ padding-left: 20px !important;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .ivu-icon-ios-arrow-forward {
|
|
|
|
+ &:before {
|
|
|
|
+ content: "";
|
|
|
|
+ display: block;
|
|
|
|
+ width: 0px;
|
|
|
|
+ height: 0px;
|
|
|
|
+ border: 5px solid transparent;
|
|
|
|
+ border-left-color: #999;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .ivu-tree-arrow {
|
|
|
|
+ position: absolute;
|
|
|
|
+ right: 20px;
|
|
|
|
+ }
|
|
|
|
+}
|
|
</style>
|
|
</style>
|