From a653d40c56eb09ee302cefd1a3e3c80a1a7a8bf1 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 17 Jun 2021 17:36:26 +0800
Subject: [PATCH] 目录树调整
---
widgets/LeftNavigationBar/Widget.js | 138 ++++++----------------------------
widgets/LeftNavigationBar/css/style.css | 57 --------------
widgets/LeftNavigationBar/Widget.html | 8 -
3 files changed, 26 insertions(+), 177 deletions(-)
diff --git a/widgets/LeftNavigationBar/Widget.html b/widgets/LeftNavigationBar/Widget.html
index 0272314..2ebcffe 100644
--- a/widgets/LeftNavigationBar/Widget.html
+++ b/widgets/LeftNavigationBar/Widget.html
@@ -17,11 +17,5 @@
<div id="left-tree-list" class="demo-tree demo-tree-box"></div>
</div>
- <div class="tree-layer-opcity">
- <h3>图层透明度控制</h3>
- <i class="close layui-icon">ဆ</i>
- <ul>
-
- </ul>
- </div>
+
</div>
\ No newline at end of file
diff --git a/widgets/LeftNavigationBar/Widget.js b/widgets/LeftNavigationBar/Widget.js
index f820ae3..d12bce2 100644
--- a/widgets/LeftNavigationBar/Widget.js
+++ b/widgets/LeftNavigationBar/Widget.js
@@ -78,9 +78,6 @@
var jqDom = $("#left-tree-list > .layui-tree > div");
for (var i = 0; i < jqDom.length; i++) {
- if ($(jqDom[i]).text().indexOf("三维倾斜数据") != -1) {
- $(jqDom[i]).find('.layui-btn-group').remove()
- }
var textList = $(jqDom[i]).find('.layui-tree-txt');
@@ -99,10 +96,6 @@
if (e.keyCode == 13) {
leftSearchItemLayer()
}
- })
-
- $(".jimu-widget-LeftNavigationBar .tree-layer-opcity .close").click(function () {
- $(".jimu-widget-LeftNavigationBar .tree-layer-opcity").stop().hide();
})
function leftSearchItemLayer() {
@@ -148,9 +141,6 @@
var jqDom = $("#left-tree-list > .layui-tree > div");
for (var i = 0; i < jqDom.length; i++) {
- if ($(jqDom[i]).text().indexOf("三维倾斜数据") != -1) {
- $(jqDom[i]).find('.layui-btn-group').remove()
- }
var textList = $(jqDom[i]).find('.layui-tree-txt');
@@ -253,6 +243,8 @@
}
+
+
b.push(a);
i++;
if (d[k].children && d[k].children.length > 0) {
@@ -285,27 +277,6 @@
var partOfUrl = that.returnStr(small.src).partOfUrl;
//添加S3M图层服务
that[small.id] = scene.open(host + partOfUrl);
- } else {
-
- if (that[small.id]) {
- that[small.id].show = true
- } else {
- $.ajax({
- url: small.src + '/maps.json',
- type: 'get',
- dataType: 'JSON',
- success: function (res) {
-
- that[small.id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
- url: res[0].path,
- }));
- that[small.id].alpha = small.alpha
-
- }
- })
- }
-
-
}
}
@@ -409,7 +380,7 @@
},
showLine: false, //是否开启连接线
oncheck: function (obj) {
-
+
var keyId = that.getUrlKeyId("serviceId");
if (obj.data.children && obj.data.children.length > 0) {
@@ -462,6 +433,7 @@
if (that[item.id]) {
that[item.id].show = true
+ topic.publish('appendItem', 'Layermanagement', item, that[item.id]);
} else {
$.ajax({
url: item.src + '/maps.json',
@@ -469,9 +441,11 @@
dataType: 'JSON',
success: function (res) {
+
that[item.id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
url: res[0].path,
}));
+ topic.publish('appendItem', 'Layermanagement', item, that[item.id]);
that[item.id].alpha = item.alpha
if (keyId && keyId != "") {
@@ -503,7 +477,10 @@
});
} else {
obj.data.children.forEach(item => {
- if (that[item.id]) that[item.id].show = false
+ if (that[item.id]) {
+ topic.publish('removeItem', 'Layermanagement', item);
+ that[item.id].show = false;
+ }
});
}
@@ -557,19 +534,24 @@
} else {
if (that[obj.data.id]) {
- that[obj.data.id].show = true
- } else {
+ that[obj.data.id].show = true;
+ topic.publish('appendItem', 'Layermanagement', obj.data, that[obj.data.id]);
+ } else {
$.ajax({
url: obj.data.src + '/maps.json',
type: 'get',
dataType: 'JSON',
success: function (res) {
-
+
+
that[obj.data.id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
url: res[0].path,
}));
+
+ topic.publish('appendItem', 'Layermanagement', obj.data, that[obj.data.id]);
+
that[obj.data.id].alpha = obj.data.alpha
-
+
if (keyId && keyId != "") {
that[obj.data.id].getViewableRectangle().then(function (rectangle) {
return that.map.camera.flyTo({
@@ -577,12 +559,11 @@
});
});
}
- console.log(that[obj.data.id])
}
})
}
-
+
}
@@ -596,7 +577,10 @@
} else {
- if (that[obj.data.id]) that[obj.data.id].show = false
+ if (that[obj.data.id]) {
+ topic.publish('removeItem', 'Layermanagement', obj.data);
+ that[obj.data.id].show = false;
+ }
}
@@ -628,87 +612,13 @@
}
},
- edit: ['add'],
operate: function (obj) {
var type = obj.type; //得到操作类型: add、edit、 del
var data = obj.data; //得到当前节点的数据
var elem = obj.elem; //得到当前节点元素var deptId = data.id;//得到节点索引var parentId = data.parentId;l/父节点
var depId = data.id;
var parentId = data.parentId;
- if (type == 'add') {
- $(".jimu-widget-LeftNavigationBar .tree-layer-opcity ul").empty();
-
- if (data.children) {
-
- data.children.forEach(item => {
- var liC = `<li>
- <div title="${item.title}">
- ${item.title}
- </div>
- <div id="${item.id + 'Layer'}">
-
- </div>
- </li>`;
-
- $(".jimu-widget-LeftNavigationBar .tree-layer-opcity ul").append(liC)
-
- $(".jimu-widget-LeftNavigationBar .tree-layer-opcity").stop().show();
- slider.render({
- elem: '#' + item.id + 'Layer',
- min: 0,
- max: 10,
- value: item.alpha * 10,
- step: 1,
- theme: '#1E9FFF',
- setTips: function (value) { //自定义提示文本
- return value / 10;
- },
- change: function (value) {
- item.alpha = value / 10
- if (that[item.id]) {
- that[item.id].alpha = item.alpha
- }
- }
- });
- })
-
- } else {
- var liC = `<li>
- <div title="${data.title}">
- ${data.title}
- </div>
- <div id="${data.id + 'Layer'}">
-
- </div>
- </li>`;
-
- $(".jimu-widget-LeftNavigationBar .tree-layer-opcity ul").append(liC)
-
- $(".jimu-widget-LeftNavigationBar .tree-layer-opcity").stop().show();
- slider.render({
- elem: '#' + data.id + 'Layer',
- min: 0,
- max: 10,
- value: data.alpha * 10,
- step: 1,
- theme: '#1E9FFF',
- setTips: function (value) { //自定义提示文本
- return value / 10;
- },
- change: function (value) {
- data.alpha = value / 10
- if (that[data.id]) {
- that[data.id].alpha = data.alpha
- }
- }
- });
-
-
- }
-
-
- }
}
});
diff --git a/widgets/LeftNavigationBar/css/style.css b/widgets/LeftNavigationBar/css/style.css
index e2fe027..8fb6b6f 100644
--- a/widgets/LeftNavigationBar/css/style.css
+++ b/widgets/LeftNavigationBar/css/style.css
@@ -162,63 +162,8 @@
}
.jimu-widget-LeftNavigationBar .layui-tree-txt {
- width: calc(100% - 48px);
+ width: calc(100% - 28px);
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
-}
-
-.jimu-widget-LeftNavigationBar .layui-btn-group {
- visibility: visible;
-}
-
-.jimu-widget-LeftNavigationBar .layui-btn-group .layui-icon {
- margin-top: 4px;
- width: 20px;
- height: 20px;
-
- background: url(../../../images/工具(用以切换图层的透明度).png) no-repeat;
-}
-
-.jimu-widget-LeftNavigationBar .layui-btn-group .layui-icon:before {
- content: "";
-}
-
-.jimu-widget-LeftNavigationBar .tree-layer-opcity {
- display: none;
- position: absolute;
- top: 240px;
- left: 280px;
- width: 260px;
- height: auto;
- background: #Fff;
- border-radius: 5px;
- box-shadow: 0 0 8px #fff;
-}
-
-.jimu-widget-LeftNavigationBar .tree-layer-opcity h3 {
- margin: 0;
- height: 36px;
- line-height: 36px;
- text-align: center;
-}
-
-
-.jimu-widget-LeftNavigationBar .tree-layer-opcity .close {
- position: absolute;
- top: 4px;
- right: 4px;
-}
-
-.jimu-widget-LeftNavigationBar .tree-layer-opcity li>div:first-child {
- padding: 0 10px;
- line-height: 28px;
- overflow: hidden;
- text-overflow:ellipsis;
- white-space: nowrap;
-}
-
-.jimu-widget-LeftNavigationBar .tree-layer-opcity li>div:last-child {
- margin: 10px 10px;
- width: calc(100% - 20px);
}
\ No newline at end of file
--
Gitblit v1.9.3