liuyg
2021-06-11 96a7cb605dcd16def9a62003686cdfbbe1d102ec
Merge branch 'master' of http://192.168.0.105:10010/r/pyhmap
3 files modified
1 files added
217 ■■■■ changed files
widgets/LeftNavigationBar/Widget.js 89 ●●●●● patch | view | raw | blame | history
widgets/instructions/Widget.js 52 ●●●●● patch | view | raw | blame | history
widgets/instructions/data.json 46 ●●●●● patch | view | raw | blame | history
widgets/searchL/Widget.js 30 ●●●●● patch | view | raw | blame | history
widgets/LeftNavigationBar/Widget.js
@@ -61,6 +61,51 @@
                });
                $('#left-navigation-bar-main-search').click(() => { //搜索事件
                    leftSearchItemLayer()
                })
                $(".jimu-widget-LeftNavigationBar input[type='search']").bind('input propertychange', function () {
                    //做一些事情
                    var val = $(this).val();
                    if (val == '') {
                        that.changeData(that.dataAllArray, val); //重写数据
                        layui.use('tree', function () {
                            layui.tree.reload('demoId1', {
                                data: that.data
                            });
                            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())
                                }
                            }
                        })
                    }
                })
                $(".jimu-widget-LeftNavigationBar input[type='search']").keyup(function (e) {
                    if (e.keyCode == 13) {
                        leftSearchItemLayer()
                    }
                })
                $(".jimu-widget-LeftNavigationBar .tree-layer-opcity .close").click(function () {
                    $(".jimu-widget-LeftNavigationBar .tree-layer-opcity").stop().hide();
                })
                function leftSearchItemLayer() {
                    var val = $('#left-navigation-bar-main-input').val();
                    if (val != '') {
                        var clearOur = () => {
@@ -119,43 +164,8 @@
                            useit(that.data);
                        })
                    } else {}
                })
                $(".jimu-widget-LeftNavigationBar input[type='search']").bind('input propertychange', function () {
                    //做一些事情
                    var val = $(this).val();
                    if (val == '') {
                        that.changeData(that.dataAllArray, val); //重写数据
                        layui.use('tree', function () {
                            layui.tree.reload('demoId1', {
                                data: that.data
                            });
                            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())
                                }
                            }
                        })
                    }
                })
                $(".jimu-widget-LeftNavigationBar .tree-layer-opcity .close").click(function () {
                    $(".jimu-widget-LeftNavigationBar .tree-layer-opcity").stop().hide();
                })
                }
            },
            closeToolBox: function (item) {},
@@ -238,7 +248,7 @@
                            } else {
                                if (that[a.id]) {
                                if (that[a.id]) {
                                    that.map.imageryLayers.remove(that[a.id]);
                                }
@@ -250,7 +260,7 @@
                                b[k].children = [];
                                b[k].who = 'father';
                                inits(d[k].children, b[k].children)
                            }
                            }
                        }
                    };
@@ -454,13 +464,14 @@
                                if (obj.checked == true) {
                                    if (obj.data.model) {
                                        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);
                                        //定位到场景
                                        Cesium.loadJson(host + partOfUrl + '/scenes.json').then(function (scenes) {
                                            // var sname = scenes[0].name;
                                            // Cesium.loadJson(host + partOfUrl + '/scenes/' + sname + '.json').then(function (jsonData) {
widgets/instructions/Widget.js
@@ -42,17 +42,26 @@
                        var data = res.data.data;
                        // console.log(data, 99999);
                        that.beginLayuiDropdown(data)
                    }
                })
            },
            beginLayuiDropdown: function (data) {
                var that = this;
                var d = [];
                for (var k in data) {
                    d.push({
                    var obj = {
                        title: data[k].name,
                        id: data[k].id
                    })
                        id: data[k].id,
                    }
                    if (data[k].seviceUrl) {
                        obj.src = data[k].seviceUrl
                    }
                    d.push(obj)
                }
                layui.use(['dropdown', 'util', 'layer', 'table'], function () {
                    var dropdown = layui.dropdown
@@ -71,9 +80,46 @@
                            //点击事件
                            // layer.tips('点击了:' + obj.title, this.elem, { tips: [1, '#5FB878'] })
                            var str = obj.title;
                            $('.jimu-widget-instructions').find('.instructions-title').empty().append(str);
                            if (that[obj.id]) {
                                that.map.imageryLayers.remove(that[obj.id]);
                            }
                            if (obj.src) {
                                $.ajax({
                                    url: res.data[i].seviceUrl + '/maps.json',
                                    type: 'get',
                                    dataType: 'JSON',
                                    success: function (result) {
                                        console.log(res.data[i])
                                        that[res.data[i].id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
                                            url:  result[0].path,
                                        }));
                                        that[res.data[i].id].alpha = 1
                                    }
                                })
                            } else {
                                layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
                                    //得到各种内置组件
                                    var layer = layui.layer //弹层
                                    // layer.msg('请先填写关键字', { icon: 1, time: 1000, shift: 6 });
                                    layer.tips('暂无该服务', '.jimu-widget-instructions', {
                                        tips: [2, '#FF5722']
                                    });
                                })
                            }
                        }
                    });
                });
widgets/instructions/data.json
New file
@@ -0,0 +1,46 @@
{
    "code": "200",
    "data": [{
            "id": "1",
            "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
            "NAME": "余干康山候鸟县级自然保护区"
        },
        {
            "id": "2",
            "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
            "NAME": "东鄱阳湖国家湿地公园"
        },
        {
            "id": "3",
            "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
            "NAME": "鄱阳湖南矶湿地国家级自然保护区"
        },
        {
            "id": "4",
            "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
            "NAME": "鄱阳湖国家级自然保护区"
        },
        {
            "id": "6",
            "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
            "NAME": "都昌候鸟省级自然保护区"
        },
        {
            "id": "7",
            "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
            "NAME": "庐山星湖湾省级湿地公园"
        },
        {
            "id": "8",
            "seviceUrl": "http://171.34.76.172:8090/iserver/services/map-PYHBHD_BJ/rest",
            "NAME": "都昌北鄱阳湖省级湿地公园"
        },
        {
            "id": "9",
            "seviceUrl": "",
            "NAME": "五星白鹤保护小区"
        }
    ],
    "success": true,
    "message": "查询成功"
}
widgets/searchL/Widget.js
@@ -75,6 +75,11 @@
                        }
                    } else {
                        if (that.searchDatas[0] && that.searchDatas[1]) {
                            that.map.camera.flyTo({
                                // destination: Cesium.Cartesian3.fromDegrees(Number(lng), Number(lat), Number(gaodu))
                                destination: Cesium.Cartesian3.fromDegrees(Number(that.searchDatas[0]), Number(that.searchDatas[1]), Number(8000))
                            });
                        } else {
                            layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
                                //得到各种内置组件
@@ -92,6 +97,31 @@
                    that.map.entities.removeAll();
                })
                $("#local_data").keyup(function (e) {
                    console.log(e);
                    that.getInputData();
                    if (e.keyCode == 13 && typeof that.searchDatas == 'string') {
                        var han = /^[\u4e00-\u9fa5]+$/;
                        if (han.test(that.searchDatas) || that.searchDatas == '  ') {
                            that.getData(0, that.searchDatas);
                            $('.searchLMain').show();
                            $('.searchLMain').find('ul.layui-tab-title li:eq(0)').addClass('layui-this').siblings().removeClass('layui-this');
                            $('.searchLMain').find('div.layui-tab-content > div.layui-tab-item:eq(0)').addClass('layui-show').siblings().removeClass('layui-show');
                        } else {
                            layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
                                //得到各种内置组件
                                var layer = layui.layer //弹层
                                // layer.msg('请先填写关键字', { icon: 1, time: 1000, shift: 6 });
                                layer.tips('请先填写关键字', '.searchImg', {
                                    tips: [2, '#FF5722']
                                });
                            })
                            $('.searchLMain').hide();
                        }
                    }
                })
            },
            getInputData: function () {
                if (this.states == 'one') {