liuyg
2021-06-19 66f2854366a59a2194ac51e67e5c6ddc29b20ff3
widgets/instructions/Widget.js
@@ -28,6 +28,7 @@
         name: 'instructions',
         layers: {},
         startup: function () {
            // 暴露在外的接口
            var that = this,
               url = 'http://171.34.76.171:8880/pyh-station/metaWetlandProtect/queryNameAndIdAssembleMap',
@@ -82,25 +83,69 @@
                     $('.jimu-widget-instructions').find('.instructions-title').empty().append(str);
                     for (var i = 0; i < d.length; i++) {
                        if (that['layer' + d[i].id]) {
                           that.map.imageryLayers.remove(that['layer' + d[i].id]);
                                var itemObj = {};
                                itemObj.src = d[i].src;
                                itemObj.title = d[i].title;
                                itemObj.id = 'layer' + d[i].id;
                                if (that[itemObj.id]) {
                                    itemObj.alpha = that[itemObj.id].alpha;
                                    that[itemObj.id].show = false;
                                    topic.publish('removeItem', 'Layermanagement', itemObj);
                        }
                     }
                     if (obj.src) {
                                var itemObj = {};
                                itemObj.src = obj.src;
                                itemObj.title = obj.title;
                                itemObj.id = 'layer' + obj.id;
                                if (that[itemObj.id]) {
                                    itemObj.alpha = that[itemObj.id].alpha;
                                    that[itemObj.id].show = true;
                                    that[itemObj.id].getViewableRectangle().then(function (rectangle) {
                                        return that.map.camera.flyTo({
                                            destination: rectangle
                                        });
                                    });
                                    topic.publish('appendItem', 'Layermanagement', itemObj, that[itemObj.id]);
                                } else {
                                    itemObj.alpha = 1;
                        $.ajax({
                           url: obj.src + '/maps.json',
                                        url: itemObj.src + '/maps.json',
                           type: 'get',
                           dataType: 'JSON',
                           success: function (result) {
                              that['layer' + obj.id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
                                            that[itemObj.id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
                                 url: result[0].path,
                              }));
                              that['layer' + obj.id].alpha = 1;
                                            that[itemObj.id].alpha = 1;
                              that['layer' + obj.id].getViewableRectangle().then(function (rectangle) {
                                            topic.publish('appendItem', 'Layermanagement', itemObj, that[itemObj.id]);
                                            that[itemObj.id].getViewableRectangle().then(function (rectangle) {
                                 return that.map.camera.flyTo({
                                    destination: rectangle
                                 });
@@ -108,6 +153,9 @@
                           }
                        })
                                }
                     } else {
                        layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){