shuishen
2021-06-17 a653d40c56eb09ee302cefd1a3e3c80a1a7a8bf1
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
                                 }
                              }
                           });
                        }
                     }
                  }
               });