From 25ce610f6ecca7325e7a743dc032c4a76559c63d Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 02 Jul 2021 09:10:26 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/pyhmap

---
 widgets/LeftNavigationBar/Widget.js | 1569 +++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 1,002 insertions(+), 567 deletions(-)

diff --git a/widgets/LeftNavigationBar/Widget.js b/widgets/LeftNavigationBar/Widget.js
index 84bbfc5..86a55ff 100644
--- a/widgets/LeftNavigationBar/Widget.js
+++ b/widgets/LeftNavigationBar/Widget.js
@@ -3,618 +3,1053 @@
 // 模块描述:显示坐标
 ///////////////////////////////////////////////////////////////////////////
 define([
-		'dojo/_base/declare',
-		'dojo/_base/lang',
-		'dojo/_base/array',
-		'dojo/_base/html',
-		'dojo/topic',
-		'jimu/BaseWidget',
-		'jimu/utils',
-		'jimu/css!libs/zTree_v3/css/zTreeStyle/zTreeStyle.css',
-		'libs/zTree_v3/js/jquery.ztree.all'
-	],
-	function (declare,
-		lang,
-		array,
-		html,
-		topic,
-		BaseWidget,
-		aspect,
-		string,
-		utils
-	) {
-		return declare([BaseWidget], {
-			baseClass: 'jimu-widget-LeftNavigationBar',
-			name: 'LeftNavigationBar',
-			layers: {},
-			startup: function () {
-				// 暴露在外的接口
-				// this.begin(this.data);
-				var that = this;
-				this.getData();
+        'dojo/_base/declare',
+        'dojo/_base/lang',
+        'dojo/_base/array',
+        'dojo/_base/html',
+        'dojo/topic',
+        'jimu/BaseWidget',
+        'jimu/utils',
+        'jimu/css!libs/zTree_v3/css/zTreeStyle/zTreeStyle.css',
+        'libs/zTree_v3/js/jquery.ztree.all'
+    ],
+    function (declare,
+        lang,
+        array,
+        html,
+        topic,
+        BaseWidget,
+        aspect,
+        string,
+        utils
+    ) {
+        return declare([BaseWidget], {
+            baseClass: 'jimu-widget-LeftNavigationBar',
+            name: 'LeftNavigationBar',
+            layers: {},
+            dataAllArray: [],
+            startup: function () {
+                // 暴露在外的接口
+                // this.begin(this.data);
+                var that = this;
+                this.getData();
+                topic.subscribe("closeNavigation", lang.hitch(this, this.closeNavigation));
+                // $('.left-navigation-bar-but').click(() => {
+                //     this.changeImg = !this.changeImg;
+                //     if (this.changeImg) {
+                //         $('.l-n-b-b-img').attr("src", "./images/addL/xzuo.png"); //打开
+                //         $('.jimu-widget-LeftNavigationBar').css({
+                //             'left': '0px'
+                //         });
+                //         $('.jimu-widget-instructions').css({
+                //             'left': '260px'
+                //         });
+                //     } else {
+                //         $('.l-n-b-b-img').attr("src", "./images/addL/xyou.png"); //关闭
+                //         $('.jimu-widget-LeftNavigationBar').css({
+                //             'left': '-250px'
+                //         });
+                //         $('.jimu-widget-instructions').css({
+                //             'left': '10px'
+                //         });
+                //     }
+                // })
+                $('.left-navigation-bar-but>div').click(() => {
+                    topic.publish('closeTool', this.name);
+                    topic.publish('closeMap', this.name);
+                    $(".jimu-widget-Layermanagement .layer-list").stop().hide();
 
-				$('.left-navigation-bar-but').click(() => {
-					this.changeImg = !this.changeImg;
-					if (this.changeImg) {
-						$('.l-n-b-b-img').attr("src", "../../images/addL/xzuo.png"); //打开
-						$('.jimu-widget-LeftNavigationBar').css({
-							'left': '0px'
-						});
-						$('.jimu-widget-instructions').css({
-							'left': '260px'
-						});
-					} else {
-						$('.l-n-b-b-img').attr("src", "../../images/addL/xyou.png"); //关闭
-						$('.jimu-widget-LeftNavigationBar').css({
-							'left': '-250px'
-						});
-						$('.jimu-widget-instructions').css({
-							'left': '10px'
-						});
-					}
-				})
+                    if ($(".jimu-widget-Layermanagement .layer-list").is(":hidden")) {
+                        $(".jimu-widget-Layermanagement .tree-layer-opcity").stop().hide();
+                    }
+
+                    if ($('.left-navigation-bar-main').is(":hidden")) {
+                        $('.left-navigation-bar-main').stop().css({
+                            'width': '300px',
+                            'padding': '10px',
+                            'height': 'auto'
+                        }).show();
+
+                        
+                    } else {
+                        $('.left-navigation-bar-main').stop().css({
+                            'width': '0px',
+                            'padding': '0px',
+                            'height': '0px',
+                        }).hide();
+                    }
+
+                })
+                $('#l-n-b-m-search-closeOUR').click(() => {
+
+                    $('.left-navigation-bar-main').stop().css({
+                        'width': '0px',
+                        'padding': '0px',
+                        'height': '0px',
+                    }).hide();
+                })
 
 
-				$('.jimu-widget-instructions').css({
-					'left': '260px'
-				});
-				$('#left-navigation-bar-main-search').click(() => { //搜索事件
-					var val = $('#left-navigation-bar-main-input').val();
-					if (val) {
-						var clearOur = () => {
-								let dom = $(`[data-id]`);
-								// console.log(dom);
-								dom.removeClass('layui-tree-spread');
-								let domDiv = dom.find('.layui-tree-pack');
-								domDiv.css({
-									'display': 'none'
-								})
-							},
-							a, useit = (d) => {
-								for (var k in d) {
-									if (d[k].who == 'father') {
-										that.father = d[k].id;
-									}
-									if (d[k].title.indexOf(val) != -1) { //选中id
-										a = '' + d[k].id;
-										// var b = a.split('');
-										// for (var i in b) {
-										let id = that.father; //选中项的所有父级id
-										// 	// console.log(id)
-										let dom = $(`[data-id='${id}']`);
-										dom.addClass('layui-tree-spread');
-										let domDiv = dom.find('.layui-tree-pack').eq(0);
-										domDiv.css({
-											'display': 'block'
-										})
-										// }
-										console.log(a, that.father)
-									}
-									if (d[k].children) {
-										useit(d[k].children);
-									}
-								}
-							};
-						clearOur();
-						useit(that.data);
-					} else {
+                $('.jimu-widget-instructions').css({
+                    'left': '260px'
+                });
 
-					}
-				})
-			},
+                $('#left-navigation-bar-main-search').click(() => { //搜索事件
+                    leftSearchItemLayer()
+                })
 
-			closeToolBox: function (item) {},
+                $(".jimu-widget-LeftNavigationBar input[type='search']").bind('input propertychange', function () {
+                    //做一些事情
+                    var val = $(this).val();
 
-			onOpen: function () {
-				//面板打开的时候触发 (when open this panel trigger)
-			},
+                    if (val == '') {
+                        that.changeData(that.dataAllArray, val); //重写数据
+                        layui.use('tree', function () {
+                            layui.tree.reload('demoId1', {
+                                data: that.data
+                            });
 
-			onClose: function () {
-				//面板关闭的时候触发 (when this panel is closed trigger)
-			},
+                            var jqDom = $("#left-tree-list > .layui-tree > div");
 
-			onMinimize: function () {
-				this.resize();
-			},
+                            for (var i = 0; i < jqDom.length; i++) {
 
-			onMaximize: function () {
-				this.resize();
-			},
+                                var textList = $(jqDom[i]).find('.layui-tree-txt');
 
-			resize: function () {
+                                for (var j = 0; j < textList.length; j++) {
+                                    $(textList[j]).attr('title', $(textList[j]).text())
 
-			},
-			getData: function () {
-				var url = 'http://171.34.76.171:8880/pyh-wetResource/GeoData/queryGeoDataTree',
-					that = this;
+                                }
 
-				axios.get(url, {
-					headers: {
-						"token": 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJlY2hpc2FuIiwic3ViIjoiYWRtaW4iLCJpYXQiOjE2MjI4Nzc0MTIsImV4cCI6MTYyNTQ2OTQxMn0.f2GhYYINfYgSbyKTqqGluyU3rdy_TT8mf15iLILS1l2EUSye_h9O6CSUVWpLYMrdrjzqDWwrbROxfhy-8ly0uA'
-					}
-				}).then((res) => {
-					if (res.data.code == '200') {
-						console.log(res, 'open', 898998)
-						that.changeData(res.data.data); //重写数据
-					}
-				})
-			},
-			changeData: function (val) { //重写数据
-				var data = [],
-					i = 1,
-					inits = (d, childData) => {
-						var b = childData || [];
-						for (var k in d) {
+                            }
+                        })
+                    }
 
-							let a = {
-								title: d[k].name,
-								// id: d[k].id,
-								// field: String(d[k].id),
-								id: i,
-								field: String(i),
-								src: d[k].serviceUrl,
-								id: d[k].id,
-								serviceName: d[k].serviceName
-							}
-							b.push(a);
-							i++;
-							if (d[k].children.length != 0) {
-								b[k].children = [];
-								b[k].who = 'father';
-								inits(d[k].children, b[k].children)
-							}
-						}
+                })
 
-					};
-				inits(val, data);
-				// console.log(data)
+                $(".jimu-widget-LeftNavigationBar input[type='search']").keyup(function (e) {
+                    if (e.keyCode == 13) {
+                        leftSearchItemLayer()
+                    }
+                })
 
-				// var i = 0,
-				// 	ccinit = (a) => {
-				// 		i++;
-				// 		for (let k in a) {
-				// 			if (a[k].children) {
-				// 				a[k].who = i;
-				// 				// console.log(a[k].id)
-				// 				ccinit(a[k].children)
-				// 			}
-				// 		}
-				// 	};
-				// ccinit(this.data);
-				// console.log(this.data)
-				this.data = data;
-				this.begin(this.data);
-			},
-			begin: function (data) {
-				var that = this;
+                function leftSearchItemLayer() {
+                    var val = $('#left-navigation-bar-main-input').val();
+                    if (val != '') {
+                        var clearOur = () => {
+                                let dom = $(`[data-id]`);
+                                dom.removeClass('layui-tree-spread');
+                                let domDiv = dom.find('.layui-tree-pack');
+                                domDiv.css({
+                                    'display': 'none'
+                                })
+                            },
+                            a, useit = (d) => {
+                                for (var k in d) {
+                                    if (d[k].who == 'father') {
+                                        that.father = d[k].id;
+                                    }
+                                    if (d[k].title && d[k].title.indexOf(val) != -1) { //选中id
+                                        a = '' + d[k].id;
+                                        // var b = a.split('');
+                                        // for (var i in b) {
+                                        let id = that.father; //选中项的所有父级id
+                                        let dom = $(`[data-id='${id}']`);
+                                        dom.addClass('layui-tree-spread');
+                                        let domDiv = dom.find('.layui-tree-pack').eq(0);
+                                        domDiv.css({
+                                            'display': 'block'
+                                        })
+                                        // }
+                                    }
+                                    if (d[k].children && d[k].children.length > 0) {
+                                        useit(d[k].children);
+                                    }
+                                }
+                            };
 
-				var a = null;
+                        that.changeData(that.dataAllArray, val); //重写数据
+                        layui.use('tree', function () {
+                            layui.tree.reload('demoId1', {
+                                data: that.data
+                            });
+                            var jqDom = $("#left-tree-list > .layui-tree > div");
 
-				layui.use(function () {
-					var tree = layui.tree,
-						layer = layui.layer,
-						util = layui.util,
-						$ = layui.$;
-					tree.render({
-						elem: '#test1' //默认是点击节点可进行收缩
-							,
-						data: data,
-						id: 'demoId1',
-						showCheckbox: true //是否显示复选框
-							,
-						click: function (obj) {
-							var data = obj.data; //获取当前点击的节点数据
-							// layer.msg('状态:' + obj.state + '<br>节点数据:' + JSON.stringify(data));
-							console.log(obj);
-							// 树点击三角形样式修改
-							// var ot = $('.layui-tree-iconArrow');
-							// ot.removeClass("left-navigation-bar-main-down");
-							// var jt = $(`[data-id='${data.id}']`).find('.layui-tree-iconArrow').eq(0);
-							// jt.addClass('left-navigation-bar-main-down');
-							// 树点击样式修改
-							// var ot = $('.layui-tree-entry');
-							// ot.removeClass("left-navigation-bar-main-current");
-							// var jh = $(`[data-id='${data.id}']`).find('.layui-tree-entry').eq(0);
-							// jh.addClass('left-navigation-bar-main-current');
-						},
-						showLine: false //是否开启连接线
-							,
-						oncheck: function (obj) {
-							console.log(obj.data.id, '--', obj.checked, obj); //得到当前点击的节点数据
-							// console.log(obj.checked); //得到当前节点的展开状态:open、close、normal
-							// console.log(obj.elem); //得到当前节点元素
+                            for (var i = 0; i < jqDom.length; i++) {
 
-							if (obj.data.children && obj.data.children.length > 0) {
+                                var textList = $(jqDom[i]).find('.layui-tree-txt');
 
-								// 点击的父
+                                for (var j = 0; j < textList.length; j++) {
+                                    $(textList[j]).attr('title', $(textList[j]).text())
+
+                                }
+
+                            }
+
+                            clearOur();
+                            useit(that.data);
+                        })
+
+                    }
+                }
+            },
+
+            closeNavigation: function (item) {
+                if (item != this.name) {
+
+                    if (!$('.left-navigation-bar-main').is(":hidden")) {
+                        $('.left-navigation-bar-main').stop().css({
+                            'width': '0px',
+                            'padding': '0px',
+                            'height': '0px',
+                        }).hide();
+                    }
+
+                }
+            },
+
+            onOpen: function () {
+                //面板打开的时候触发 (when open this panel trigger)
+
+            },
+
+            onClose: function () {
+                //面板关闭的时候触发 (when this panel is closed trigger)
+            },
+
+            onMinimize: function () {
+                this.resize();
+            },
+
+            onMaximize: function () {
+                this.resize();
+            },
+
+            resize: function () {
+
+            },
+            getData: function () {
+                var that = this;
+                var url = 'http://171.34.76.171:8880/pyh-wetResource/GeoData/queryGeoDataTree',
+                    that = this;
+
+                axios.get(url, {
+                    headers: {
+                        "token": 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJlY2hpc2FuIiwic3ViIjoiYWRtaW4iLCJpYXQiOjE2MjI4Nzc0MTIsImV4cCI6MTYyNTQ2OTQxMn0.f2GhYYINfYgSbyKTqqGluyU3rdy_TT8mf15iLILS1l2EUSye_h9O6CSUVWpLYMrdrjzqDWwrbROxfhy-8ly0uA'
+                    }
+                }).then((res) => {
+                    if (res.data.code == '200') {
+                        that.dataAllArray = res.data.data;
+                        that.changeData(res.data.data, ''); //重写数据
+                        that.begin(this.data);
+                    }
+                })
+            },
+            changeData: function (val, type) { //重写数据
+                var that = this;
+                var data = [],
+                    i = 1,
+                    inits = (d, childData) => {
+                        var b = childData || [];
+                        for (var k in d) {
 
 
 
+                            let a = {
+                                title: d[k].name,
+                                // id: d[k].id,
+                                // field: String(d[k].id),
+                                id: i,
+                                field: String(i),
+                                src: d[k].serviceUrl,
+                                id: d[k].id,
+                                serviceName: d[k].serviceName,
+                                alpha: 1,
+                                checked: d[k].menuStatus,
+                                attList: d[k].attList
+                            }
 
-								if (obj.checked == true) {
+                            if (that[d[k].id]) {
+                                a.alpha = that[d[k].id].alpha
+                            }
 
-									obj.data.children.forEach(item => {
-										$.ajax({
-											url: item.src + '/maps.json',
-											type: 'get',
-											dataType: 'JSON',
-											success: function (res) {
-	
-												that[item.id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
-													url: res[0].path,
-												}));
-	
-											}
-										})
-									});
+                            if (d[k].serviceUrl && d[k].serviceUrl.length > 0 && d[k].serviceUrl.indexOf('.openrealspace') != -1) {
+                                a.model = true;
+                                a.lat = d[k].lat;
+                                a.lon = d[k].lon;
+                                a.height = d[k].height;
+                                a.yawAngle = d[k].yawAngle;
+                                a.pitchAngle = d[k].pitchAngle;
+                                a.rollAngle = d[k].rollAngle;
+                            }
 
-									
+                            if (d[k].name == '三维倾斜数据') {
+                                a.model = true
+                            }
 
-								} else {
-									obj.data.children.forEach(item => {
-										if (that[item.id]) that.map.imageryLayers.remove(that[item.id]);
-									});
+                            b.push(a);
+                            i++;
+                            if (d[k].children && d[k].children.length > 0) {
+                                b[k].children = [];
+                                b[k].who = 'father';
+                                inits(d[k].children, b[k].children)
+                            }
+                        }
 
+                    };
+                inits(val, data);
 
-									
-								}
+                if (type != '') {
 
+                    for (var i = 0; i < data.length; i++) {
 
-							} else {
+                        if (data[i].children && data[i].children.length > 0) {
 
+                            deWeight()
 
-								// 点击的子
+                            function deWeight() {
+                                for (var j = 0; j < data[i].children.length; j++) {
 
-								if (obj.checked == true) {
+                                    if (data[i].children[j].title && data[i].children[j].title.indexOf(type) == -1) {
+                                        data[i].children.splice(j, 1);
+                                        deWeight();
+                                        break;
 
-									$.ajax({
-										url: obj.data.src + '/maps.json',
-										type: 'get',
-										dataType: 'JSON',
-										success: function (res) {
-											console.log(res, 123)
+                                    }
 
-											that[obj.data.id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
-												url: res[0].path,
-											}));
+                                }
+                            }
 
-										}
-									})
+                        }
 
+                    }
+                    deParentWeight()
 
-								} else {
+                    function deParentWeight() {
+                        for (var i = 0; i < data.length; i++) {
+
+                            if (data[i].children && data[i].children.length == 0) {
+                                data.splice(i, 1)
+                                deParentWeight();
+                                break;
+                            }
+
+                            if (data[i].children == undefined && data[i].title.indexOf(type) == -1) {
+                                data.splice(i, 1)
+                                deParentWeight();
+                                break;
+
+                            }
+
+                        }
+                    }
+
+                }
+
+                var keyId = this.getUrlKeyId("serviceId");
+
+                if (keyId && keyId != "") {
+                    for (var i = 0; i < data.length; i++) {
+
+                        if (data[i].id == keyId) {
+                            data[i].checked = true
+                        }
+
+                        if (data[i].children && data[i].children.length > 0) {
+
+                            for (var j = 0; j < data[i].children.length; j++) {
+
+                                if (data[i].children[j].id == keyId) {
+                                    data[i].children[j].checked = true
+                                }
+
+                            }
+
+                        }
+
+                    }
+                }
 
 
 
-									that.map.imageryLayers.remove(that[obj.data.id]);
-
-								}
+                this.data = data;
 
 
-							}
-						}
-					});
+            },
+            begin: function (data) {
+                var that = this;
+                window.mySanweiShujuOpens = {}; //全局scene.open资源
+                var a = null;
 
-					//按钮事件
-					util.event('lay-demo', {
-						getChecked: function (othis) {
-							var checkedData = tree.getChecked('demoId1'); //获取选中节点的数据
+                layui.use(function () {
+                    var tree = layui.tree,
+                        layer = layui.layer,
+                        util = layui.util,
+                        $ = layui.$;
+                    var slider = layui.slider;
 
-							layer.alert(JSON.stringify(checkedData), {
-								shade: 0
-							});
-							console.log(checkedData);
-						},
-						setChecked: function () {
-							tree.setChecked('demoId1', [12, 114]); //勾选指定节点
-						},
-						reload: function () {
-							//重载实例
-							tree.reload('demoId1', {
+                    tree.render({
+                        elem: '#left-tree-list' //默认是点击节点可进行收缩
+                            ,
+                        data: data,
+                        id: 'demoId1',
+                        showCheckbox: true, //是否显示复选框
+                        customOperate: true,
+                        click: function (obj) {
+                            var data = obj.data; //获取当前点击的节点数据
+                            // layer.msg('状态:' + obj.state + '<br>节点数据:' + JSON.stringify(data));
+                            // 树点击三角形样式修改
+                            // var ot = $('.layui-tree-iconArrow');
+                            // ot.removeClass("left-navigation-bar-main-down");
+                            // var jt = $(`[data-id='${data.id}']`).find('.layui-tree-iconArrow').eq(0);
+                            // jt.addClass('left-navigation-bar-main-down');
+                            // 树点击样式修改
+                            // var ot = $('.layui-tree-entry');
+                            // ot.removeClass("left-navigation-bar-main-current");
+                            // var jh = $(`[data-id='${data.id}']`).find('.layui-tree-entry').eq(0);
+                            // jh.addClass('left-navigation-bar-main-current');
+                        },
+                        showLine: false, //是否开启连接线
+                        oncheck: function (obj) {
 
-							});
 
-						}
-					});
-				})
-			},
-			changeImg: true,
-			father: [],
-			data: [{
-				title: '采集站点',
-				id: 1,
-				field: '1'
-					// , checked: true
-					,
-				spread: true,
-				children: [{
-					title: '南矶山保护区',
-					id: 11,
-					field: '1-1'
-						// , checked: true
-						,
-					spread: true,
-					children: [{
-						title: '北深渊',
-						id: 111,
-						field: '1-1-1',
-						checked: true
-					}, {
-						title: '东湖',
-						id: 112,
-						field: '1-1-2',
-						checked: true
-					}, {
-						title: '矶山',
-						id: 113,
-						field: '1-1-3',
-						checked: true
-					}, {
-						title: '打钟山',
-						id: 114,
-						field: '1-1-4',
-						checked: false
-						// , spread: true
-					}]
-				}, {
-					title: '五星白鹤保护区',
-					id: 12,
-					field: '1-2',
-					checked: false,
-					spread: false,
-					children: [{
-						title: '北深渊',
-						id: 121,
-						field: '1-2-1'
-					}, {
-						title: '东湖',
-						id: 122,
-						field: '1-2-2'
-					}, {
-						title: '矶山',
-						id: 123,
-						field: '1-2-3'
-					}, {
-						title: '打钟山',
-						id: 124,
-						field: '1-2-4'
-					}]
-				}, {
-					title: '都昌候鸟省级自然保护区',
-					id: 13,
-					field: '1-3',
-					checked: false,
-					spread: false,
-					children: [{
-						title: '北深渊',
-						id: 131,
-						field: '1-3-1'
-					}, {
-						title: '东湖',
-						id: 132,
-						field: '1-3-2'
-					}, {
-						title: '矶山',
-						id: 133,
-						field: '1-3-3'
-					}, {
-						title: '打钟山',
-						id: 134,
-						field: '1-3-4'
-					}]
-				}, {
-					title: '都昌北鄱阳湿地公园',
-					id: 14,
-					field: '1-4',
-					checked: false,
-					spread: false,
-					children: [{
-						title: '北深渊',
-						id: 141,
-						field: '1-4-1'
-					}, {
-						title: '东湖',
-						id: 142,
-						field: '1-4-2'
-					}, {
-						title: '矶山',
-						id: 143,
-						field: '1-4-3'
-					}, {
-						title: '打钟山',
-						id: 144,
-						field: '1-4-4'
-					}]
-				}],
-			}, {
-				title: '检测站点',
-				id: 2,
-				field: '2',
-				checked: true,
-				spread: false,
-				children: [{
-					title: '南矶山保护区',
-					id: 21,
-					field: '2-1',
-					children: [{
-						title: '北深渊',
-						id: 211,
-						field: '2-1-1'
-					}, {
-						title: '东湖',
-						id: 212,
-						field: '2-1-2'
-					}, {
-						title: '矶山',
-						id: 213,
-						field: '2-1-3'
-					}, {
-						title: '打钟山',
-						id: 214,
-						field: '2-1-4'
-					}]
-				}, {
-					title: '五星白鹤保护区',
-					id: 22,
-					field: '2-2',
-					children: [{
-						title: '北深渊4',
-						id: 221,
-						field: '2-2-1'
-					}, {
-						title: '东湖',
-						id: 222,
-						field: '2-2-2'
-					}, {
-						title: '矶山',
-						id: 223,
-						field: '2-2-3'
-					}, {
-						title: '打钟山',
-						id: 224,
-						field: '2-2-4'
-					}]
-				}, {
-					title: '都昌候鸟省级自然保护区',
-					id: 23,
-					field: '2-3',
-					children: [{
-						title: '北深渊',
-						id: 231,
-						field: '2-3-1'
-					}, {
-						title: '东湖',
-						id: 232,
-						field: '2-3-2'
-					}, {
-						title: '矶山',
-						id: 233,
-						field: '2-3-3'
-					}, {
-						title: '打钟山',
-						id: 234,
-						field: '2-3-4'
-					}]
-				}, {
-					title: '都昌北鄱阳湿地公园',
-					id: 24,
-					field: '2-4',
-					children: [{
-						title: '北深渊5',
-						id: 241,
-						field: '2-4-1'
-					}, {
-						title: '东湖',
-						id: 242,
-						field: '2-4-2'
-					}, {
-						title: '矶山',
-						id: 243,
-						field: '2-4-3'
-					}, {
-						title: '打钟山',
-						id: 244,
-						field: '2-4-4'
-					}]
-				}],
-			}, {
-				title: '监控站点',
-				id: 3,
-				field: '3',
-				checked: true,
-				spread: false,
-				children: [{
-					title: '南矶山保护区',
-					id: 31,
-					field: '3-1',
-					children: [{
-						title: '北深渊2',
-						id: 311,
-						field: '3-1-1'
-					}, {
-						title: '东湖',
-						id: 312,
-						field: '3-1-2'
-					}, {
-						title: '矶山',
-						id: 313,
-						field: '3-1-3'
-					}, {
-						title: '打钟山',
-						id: 314,
-						field: '3-1-4'
-					}]
-				}, {
-					title: '五星白鹤保护区',
-					id: 32,
-					field: '3-2',
-					children: [{
-						title: '北深渊3',
-						id: 321,
-						field: '3-2-1'
-					}, {
-						title: '东湖',
-						id: 322,
-						field: '3-2-2'
-					}, {
-						title: '矶山',
-						id: 323,
-						field: '3-2-3'
-					}, {
-						title: '打钟山',
-						id: 324,
-						field: '3-2-4'
-					}]
-				}, {
-					title: '都昌候鸟省级自然保护区',
-					id: 33,
-					field: '3-3',
-					children: [{
-						title: '北深渊',
-						id: 331,
-						field: '3-3-1'
-					}, {
-						title: '东湖',
-						id: 332,
-						field: '3-3-2'
-					}, {
-						title: '矶山',
-						id: 333,
-						field: '3-3-3'
-					}, {
-						title: '打钟山',
-						id: 334,
-						field: '3-3-4'
-					}]
-				}, {
-					title: '都昌北鄱阳湿地公园',
-					id: 34,
-					field: '3-4',
-					children: [{
-						title: '北深渊1',
-						id: 341,
-						field: '3-4-1'
-					}, {
-						title: '东湖',
-						id: 342,
-						field: '3-4-2'
-					}, {
-						title: '矶山',
-						id: 343,
-						field: '3-4-3'
-					}, {
-						title: '打钟山',
-						id: 344,
-						field: '3-4-4'
-					}]
-				}],
-			}],
-			destroy: function () {
-				//销毁的时候触发
-				//todo
-				//do something before this func
-				this.inherited(arguments);
-			}
+                            if (obj.data.children && obj.data.children.length > 0) {
 
-		});
-	});
\ No newline at end of file
+                                // 点击的父
+
+                                if (obj.checked == true) {
+
+                                    if (obj.data.model) {
+                                        that.map.scene.globe.depthTestAgainstTerrain = false;
+                                        obj.data.children.forEach(item => {
+                                            Cesium.when(that[item.id], function (layer) {
+                                                topic.publish('removeTilt', 'Layermanagement', item);
+                                                topic.publish('removeTiltS', 'spatialAnalysis', item);
+                                                topic.publish('removeLayersLegends', 'legends', item);
+                                                that.map.scene.layers.remove(layer[0].name)
+                                            })
+                                            var host = that.returnStr(item.src).host;
+                                            var scene = that.map.scene;
+                                            var partOfUrl = that.returnStr(item.src).partOfUrl;
+                                            //添加S3M图层服务
+                                            that[item.id] = scene.open(host + partOfUrl, undefined, {
+                                                autoSetView: false //不自动定位
+                                            });
+
+                                            window.mySanweiShujuOpens[item.id] = that[item.id];
+                                            // console.log(222)
+                                            topic.publish('appendTilt', 'Layermanagement', item);
+                                            topic.publish('appendTiltS', 'spatialAnalysis', item);
+                                            topic.publish('addLayersLegends', 'legends', item);
+                                            //定位到场景
+                                            Cesium.loadJson(host + partOfUrl + '/scenes.json').then(function (scenes) {
+                                                var sname = scenes[0].name;
+                                                Cesium.loadJson(host + partOfUrl + '/scenes/' + sname + '.json').then(function (jsonData) {
+                                                    Cesium.when(that[item.id], function (layer) {
+
+                                                        //设置相机位置、视角,便于观察场景
+                                                        scene.camera.setView({
+                                                            destination: new Cesium.Cartesian3.fromDegrees(Number(item.lon), Number(item.lat), Number(item.height)),
+                                                            orientation: {
+                                                                heading: Cesium.Math.toRadians(Number(item.yawAngle)),
+                                                                pitch: Cesium.Math.toRadians(Number(item.pitchAngle)),
+                                                                roll: Cesium.Math.toRadians(Number(item.rollAngle))
+                                                            }
+                                                        });
+                                                        if (!scene.pickPositionSupported) {
+                                                            alert('不支持深度纹理,无法拾取位置!');
+                                                        }
+                                                    }, function (e) {
+                                                        if (widget._showRenderLoopErrors) {
+                                                            var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?';
+                                                            widget.showErrorPanel(title, undefined, e);
+                                                        }
+                                                    });
+                                                });
+                                            });
+
+
+                                        });
+                                    } else {
+
+                                        obj.data.children.forEach(item => {
+
+                                            if (that[item.id]) {
+                                                that[item.id].show = true
+                                                that[item.id].getViewableRectangle().then(function (rectangle) {
+                                                    return that.map.camera.flyTo({
+                                                        destination: rectangle
+                                                    });
+                                                });
+                                                // console.log(444)
+                                                topic.publish('appendItem', 'Layermanagement', item, that[item.id]);
+                                                topic.publish('appendItemS', 'spatialAnalysis', item, that[item.id]);
+                                                topic.publish('addLayersLegends', 'legends', item);
+                                            } else {
+                                                $.ajax({
+                                                    url: item.src + '/maps.json',
+                                                    type: 'get',
+                                                    dataType: 'JSON',
+                                                    success: function (res) {
+
+                                                        // console.log(111)
+                                                        that[item.id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
+                                                            url: res[0].path,
+                                                        }));
+                                                        topic.publish('appendItem', 'Layermanagement', item, that[item.id]);
+                                                        topic.publish('appendItemS', 'spatialAnalysis', item, that[item.id]);
+                                                        topic.publish('addLayersLegends', 'legends', item);
+                                                        that[item.id].alpha = item.alpha;
+                                                        that[item.id].getViewableRectangle().then(function (rectangle) {
+                                                            return that.map.camera.flyTo({
+                                                                destination: rectangle
+                                                            });
+                                                        });
+                                                    }
+                                                })
+                                            }
+                                        });
+
+
+                                    }
+
+
+                                } else {
+
+                                    if (obj.data.model) {
+                                        obj.data.children.forEach(item => {
+                                            Cesium.when(that[item.id], function (layer) {
+                                                topic.publish('removeTilt', 'Layermanagement', item);
+                                                topic.publish('removeTiltS', 'spatialAnalysis', item);
+                                                topic.publish('removeLayersLegends', 'legends', item);
+                                                that.map.scene.layers.remove(layer[0].name)
+                                            })
+                                        });
+                                    } else {
+                                        obj.data.children.forEach(item => {
+                                            if (that[item.id]) {
+                                                topic.publish('removeItem', 'Layermanagement', item);
+                                                topic.publish('removeItemS', 'spatialAnalysis', item);
+                                                topic.publish('removeLayersLegends', 'legends', item);
+                                                that[item.id].show = false;
+                                            }
+                                        });
+
+                                    }
+
+                                }
+
+
+                            } else {
+
+                                // 点击的子
+                                if (obj.checked == true) {
+
+                                    if (obj.data.model) {
+                                        Cesium.when(that[obj.data.id], function (layer) {
+                                            topic.publish('removeTilt', 'Layermanagement', obj.data);
+                                            topic.publish('removeTiltS', 'spatialAnalysis', obj.data);
+                                            topic.publish('removeLayersLegends', 'legends', obj.data);
+                                            that.map.scene.layers.remove(layer[0].name)
+                                        })
+
+                                        that.map.scene.globe.depthTestAgainstTerrain = false;
+                                        var host = that.returnStr(obj.data.src).host;
+                                        var scene = that.map.scene;
+                                        var partOfUrl = that.returnStr(obj.data.src).partOfUrl;
+                                        //添加S3M图层服务
+
+                                        that[obj.data.id] = scene.open(host + partOfUrl, undefined, {
+                                            autoSetView: false //不自动定位
+                                        });
+                                        window.mySanweiShujuOpens[obj.data.id] = that[obj.data.id];
+
+                                        topic.publish('appendTilt', 'Layermanagement', obj.data);
+                                        topic.publish('appendTiltS', 'spatialAnalysis', obj.data);
+                                        topic.publish('addLayersLegends', 'legends', obj.data);
+                                        //定位到场景
+                                        Cesium.loadJson(host + partOfUrl + '/scenes.json').then(function (scenes) {
+                                            var sname = scenes[0].name;
+                                            Cesium.loadJson(host + partOfUrl + '/scenes/' + sname + '.json').then(function (jsonData) {
+                                                Cesium.when(that[obj.data.id], function (layer) {
+                                                    //设置相机位置、视角,便于观察场景
+                                                    scene.camera.setView({
+                                                        destination: new Cesium.Cartesian3.fromDegrees(Number(obj.data.lon), Number(obj.data.lat), Number(obj.data.height)),
+                                                        orientation: {
+                                                            heading: Cesium.Math.toRadians(Number(obj.data.yawAngle)),
+                                                            pitch: Cesium.Math.toRadians(Number(obj.data.pitchAngle)),
+                                                            roll: Cesium.Math.toRadians(Number(obj.data.rollAngle))
+                                                        }
+                                                    });
+                                                    if (!scene.pickPositionSupported) {
+                                                        alert('不支持深度纹理,无法拾取位置!');
+                                                    }
+                                                }, function (e) {
+                                                    if (widget._showRenderLoopErrors) {
+                                                        var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?';
+                                                        widget.showErrorPanel(title, undefined, e);
+                                                    }
+                                                });
+                                            });
+                                        });
+
+                                    } else {
+
+                                        if (that[obj.data.id]) {
+                                            that[obj.data.id].show = true;
+                                            that[obj.data.id].getViewableRectangle().then(function (rectangle) {
+                                                return that.map.camera.flyTo({
+                                                    destination: rectangle
+                                                });
+                                            });
+                                            // console.log(555)
+                                            topic.publish('appendItem', 'Layermanagement', obj.data, that[obj.data.id]);
+                                            topic.publish('appendItemS', 'spatialAnalysis', obj.data, that[obj.data.id]);
+                                            topic.publish('addLayersLegends', 'legends', obj.data);
+                                        } 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]);
+                                                    topic.publish('appendItemS', 'spatialAnalysis', obj.data, that[obj.data.id]);
+                                                    topic.publish('addLayersLegends', 'legends', obj.data);
+
+                                                    that[obj.data.id].alpha = obj.data.alpha
+
+                                                    that[obj.data.id].getViewableRectangle().then(function (rectangle) {
+                                                        return that.map.camera.flyTo({
+                                                            destination: rectangle
+                                                        });
+                                                    });
+                                                }
+                                            })
+                                        }
+
+
+
+                                    }
+
+                                } else {
+
+
+                                    if (obj.data.model) {
+                                        Cesium.when(that[obj.data.id], function (layer) {
+
+                                            topic.publish('removeTilt', 'Layermanagement', obj.data);
+                                            topic.publish('removeTiltS', 'spatialAnalysis', obj.data);
+                                            topic.publish('removeLayersLegends', 'legends', obj.data);
+                                            that.map.scene.layers.remove(layer[0].name)
+                                        })
+
+                                    } else {
+
+                                        if (that[obj.data.id]) {
+                                            topic.publish('removeItem', 'Layermanagement', obj.data);
+                                            topic.publish('removeItemS', 'spatialAnalysis', obj.data);
+                                            topic.publish('removeLayersLegends', 'legends', obj.data);
+                                            that[obj.data.id].show = false;
+                                        }
+
+                                    }
+
+
+
+                                }
+
+
+                            }
+
+
+                            for (var i = 0; i < that.dataAllArray.length; i++) {
+
+                                if (obj.data.id == that.dataAllArray[i].id) {
+                                    that.dataAllArray[i].menuStatus = 1;
+                                    break
+                                }
+
+                                if (that.dataAllArray[i].children && that.dataAllArray[i].children.length > 0) {
+
+                                    for (var j = 0; j < that.dataAllArray[i].children.length; j++) {
+
+                                        if (obj.data.id == that.dataAllArray[i].children[j].id) {
+                                            that.dataAllArray[i].children[j].menuStatus = 1;
+                                            break
+                                        }
+
+                                    }
+                                }
+
+                            }
+                        },
+                        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;
+
+                        }
+
+                    });
+
+                    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');
+
+                        for (var j = 0; j < textList.length; j++) {
+                            $(textList[j]).attr('title', $(textList[j]).text())
+
+                        }
+
+                    }
+
+
+
+                    //按钮事件
+                    util.event('lay-demo', {
+                        getChecked: function (othis) {
+                            var checkedData = tree.getChecked('demoId1'); //获取选中节点的数据
+
+                            layer.alert(JSON.stringify(checkedData), {
+                                shade: 0
+                            });
+                        },
+                        setChecked: function () {
+                            tree.setChecked('demoId1', [12, 114]); //勾选指定节点
+                        },
+                        reload: function () {
+                            //重载实例
+                            tree.reload('demoId1', {
+
+                            });
+
+                        }
+                    });
+                })
+            },
+            returnStr: function (url) {
+                var startIndex = url.indexOf("/iserver");
+                var endIndex = url.indexOf("/scenes");
+                return {
+                    host: url.substring(0, startIndex),
+                    partOfUrl: url.substring(startIndex, endIndex)
+                }
+            },
+            changeImg: true,
+            father: [],
+            data: [{
+                title: '采集站点',
+                id: 1,
+                field: '1'
+                    // , checked: true
+                    ,
+                spread: true,
+                children: [{
+                    title: '南矶山保护区',
+                    id: 11,
+                    field: '1-1'
+                        // , checked: true
+                        ,
+                    spread: true,
+                    children: [{
+                        title: '北深渊',
+                        id: 111,
+                        field: '1-1-1',
+                        checked: true
+                    }, {
+                        title: '东湖',
+                        id: 112,
+                        field: '1-1-2',
+                        checked: true
+                    }, {
+                        title: '矶山',
+                        id: 113,
+                        field: '1-1-3',
+                        checked: true
+                    }, {
+                        title: '打钟山',
+                        id: 114,
+                        field: '1-1-4',
+                        checked: false
+                        // , spread: true
+                    }]
+                }, {
+                    title: '五星白鹤保护区',
+                    id: 12,
+                    field: '1-2',
+                    checked: false,
+                    spread: false,
+                    children: [{
+                        title: '北深渊',
+                        id: 121,
+                        field: '1-2-1'
+                    }, {
+                        title: '东湖',
+                        id: 122,
+                        field: '1-2-2'
+                    }, {
+                        title: '矶山',
+                        id: 123,
+                        field: '1-2-3'
+                    }, {
+                        title: '打钟山',
+                        id: 124,
+                        field: '1-2-4'
+                    }]
+                }, {
+                    title: '都昌候鸟省级自然保护区',
+                    id: 13,
+                    field: '1-3',
+                    checked: false,
+                    spread: false,
+                    children: [{
+                        title: '北深渊',
+                        id: 131,
+                        field: '1-3-1'
+                    }, {
+                        title: '东湖',
+                        id: 132,
+                        field: '1-3-2'
+                    }, {
+                        title: '矶山',
+                        id: 133,
+                        field: '1-3-3'
+                    }, {
+                        title: '打钟山',
+                        id: 134,
+                        field: '1-3-4'
+                    }]
+                }, {
+                    title: '都昌北鄱阳湿地公园',
+                    id: 14,
+                    field: '1-4',
+                    checked: false,
+                    spread: false,
+                    children: [{
+                        title: '北深渊',
+                        id: 141,
+                        field: '1-4-1'
+                    }, {
+                        title: '东湖',
+                        id: 142,
+                        field: '1-4-2'
+                    }, {
+                        title: '矶山',
+                        id: 143,
+                        field: '1-4-3'
+                    }, {
+                        title: '打钟山',
+                        id: 144,
+                        field: '1-4-4'
+                    }]
+                }],
+            }, {
+                title: '检测站点',
+                id: 2,
+                field: '2',
+                checked: true,
+                spread: false,
+                children: [{
+                    title: '南矶山保护区',
+                    id: 21,
+                    field: '2-1',
+                    children: [{
+                        title: '北深渊',
+                        id: 211,
+                        field: '2-1-1'
+                    }, {
+                        title: '东湖',
+                        id: 212,
+                        field: '2-1-2'
+                    }, {
+                        title: '矶山',
+                        id: 213,
+                        field: '2-1-3'
+                    }, {
+                        title: '打钟山',
+                        id: 214,
+                        field: '2-1-4'
+                    }]
+                }, {
+                    title: '五星白鹤保护区',
+                    id: 22,
+                    field: '2-2',
+                    children: [{
+                        title: '北深渊4',
+                        id: 221,
+                        field: '2-2-1'
+                    }, {
+                        title: '东湖',
+                        id: 222,
+                        field: '2-2-2'
+                    }, {
+                        title: '矶山',
+                        id: 223,
+                        field: '2-2-3'
+                    }, {
+                        title: '打钟山',
+                        id: 224,
+                        field: '2-2-4'
+                    }]
+                }, {
+                    title: '都昌候鸟省级自然保护区',
+                    id: 23,
+                    field: '2-3',
+                    children: [{
+                        title: '北深渊',
+                        id: 231,
+                        field: '2-3-1'
+                    }, {
+                        title: '东湖',
+                        id: 232,
+                        field: '2-3-2'
+                    }, {
+                        title: '矶山',
+                        id: 233,
+                        field: '2-3-3'
+                    }, {
+                        title: '打钟山',
+                        id: 234,
+                        field: '2-3-4'
+                    }]
+                }, {
+                    title: '都昌北鄱阳湿地公园',
+                    id: 24,
+                    field: '2-4',
+                    children: [{
+                        title: '北深渊5',
+                        id: 241,
+                        field: '2-4-1'
+                    }, {
+                        title: '东湖',
+                        id: 242,
+                        field: '2-4-2'
+                    }, {
+                        title: '矶山',
+                        id: 243,
+                        field: '2-4-3'
+                    }, {
+                        title: '打钟山',
+                        id: 244,
+                        field: '2-4-4'
+                    }]
+                }],
+            }, {
+                title: '监控站点',
+                id: 3,
+                field: '3',
+                checked: true,
+                spread: false,
+                children: [{
+                    title: '南矶山保护区',
+                    id: 31,
+                    field: '3-1',
+                    children: [{
+                        title: '北深渊2',
+                        id: 311,
+                        field: '3-1-1'
+                    }, {
+                        title: '东湖',
+                        id: 312,
+                        field: '3-1-2'
+                    }, {
+                        title: '矶山',
+                        id: 313,
+                        field: '3-1-3'
+                    }, {
+                        title: '打钟山',
+                        id: 314,
+                        field: '3-1-4'
+                    }]
+                }, {
+                    title: '五星白鹤保护区',
+                    id: 32,
+                    field: '3-2',
+                    children: [{
+                        title: '北深渊3',
+                        id: 321,
+                        field: '3-2-1'
+                    }, {
+                        title: '东湖',
+                        id: 322,
+                        field: '3-2-2'
+                    }, {
+                        title: '矶山',
+                        id: 323,
+                        field: '3-2-3'
+                    }, {
+                        title: '打钟山',
+                        id: 324,
+                        field: '3-2-4'
+                    }]
+                }, {
+                    title: '都昌候鸟省级自然保护区',
+                    id: 33,
+                    field: '3-3',
+                    children: [{
+                        title: '北深渊',
+                        id: 331,
+                        field: '3-3-1'
+                    }, {
+                        title: '东湖',
+                        id: 332,
+                        field: '3-3-2'
+                    }, {
+                        title: '矶山',
+                        id: 333,
+                        field: '3-3-3'
+                    }, {
+                        title: '打钟山',
+                        id: 334,
+                        field: '3-3-4'
+                    }]
+                }, {
+                    title: '都昌北鄱阳湿地公园',
+                    id: 34,
+                    field: '3-4',
+                    children: [{
+                        title: '北深渊1',
+                        id: 341,
+                        field: '3-4-1'
+                    }, {
+                        title: '东湖',
+                        id: 342,
+                        field: '3-4-2'
+                    }, {
+                        title: '矶山',
+                        id: 343,
+                        field: '3-4-3'
+                    }, {
+                        title: '打钟山',
+                        id: 344,
+                        field: '3-4-4'
+                    }]
+                }],
+            }],
+            getUrlKeyId: function (name) {
+                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
+                var r = window.location.search.substr(1).match(reg);
+                if (r != null) return decodeURI(r[2]);
+                return null;
+            },
+            destroy: function () {
+                //销毁的时候触发
+                //todo
+                //do something before this func
+                this.inherited(arguments);
+            }
+
+        });
+    });
\ No newline at end of file

--
Gitblit v1.9.3