liuyg
2021-06-15 9f60aa23fc863c14b7aa8d8f00cd8c4b5542bb74
widgets/instructions/Widget.js
@@ -3,16 +3,16 @@
// 模块描述:显示坐标
///////////////////////////////////////////////////////////////////////////
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'
],
      '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,
@@ -29,10 +29,9 @@
         layers: {},
         startup: function () {
            // 暴露在外的接口
            var that = this
               , url = 'http://171.34.76.171:8880/pyh-station/metaWetlandProtect/queryNameAndIdAssembleMap'
               , token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJlY2hpc2FuIiwic3ViIjoiYWRtaW4iLCJpYXQiOjE2MjMzOTIwNTcsImV4cCI6MTYyNTk4NDA1N30.wyhtQWDfyBM4Wvu9x_GpzWErqDkZ3J-PWEjyzoaHT9w6mMBenso5q0ZdnFueCZaCOjsHM5AMwLawATT0Zqc4aQ"
               ;
            var that = this,
               url = 'http://171.34.76.171:8880/pyh-station/metaWetlandProtect/queryNameAndIdAssembleMap',
               token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJlY2hpc2FuIiwic3ViIjoiYWRtaW4iLCJpYXQiOjE2MjMzOTIwNTcsImV4cCI6MTYyNTk4NDA1N30.wyhtQWDfyBM4Wvu9x_GpzWErqDkZ3J-PWEjyzoaHT9w6mMBenso5q0ZdnFueCZaCOjsHM5AMwLawATT0Zqc4aQ";
            axios.get(url, {
               headers: {
                  "token": token
@@ -43,7 +42,7 @@
                  // console.log(data, 99999);
                  that.beginLayuiDropdown(data)
               }
            })
@@ -58,48 +57,56 @@
               }
               if (data[k].seviceUrl) {
                  obj.src = data[k].seviceUrl
               }
               }
               d.push(obj)
            }
            layui.use(['dropdown', 'util', 'layer', 'table'], function () {
               var dropdown = layui.dropdown
                  , util = layui.util
                  , layer = layui.layer
                  , table = layui.table
                  , $ = layui.jquery;
               var dropdown = layui.dropdown,
                  util = layui.util,
                  layer = layui.layer,
                  table = layui.table,
                  $ = layui.jquery;
               dropdown.render({
                  elem: '.demo1'
                  , data: d
                  ,trigger: 'hover'
                  , className: 'site-dropdown-demo'
                  , click: function (obj) {
                  elem: '.demo1',
                  data: d,
                  trigger: 'hover',
                  className: 'site-dropdown-demo',
                  click: function (obj) {
                     //点击事件
                     // 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]);
                     console.log(d, obj, 684)
                     for (var i = 0; i < d.length; i++) {
                        if (that['layer' + d[i].id]) {
                           that.map.imageryLayers.remove(that['layer' + d[i].id]);
                        }
                     }
                     if (obj.src) {
                        $.ajax({
                           url: res.data[i].seviceUrl + '/maps.json',
                           url: obj.src + '/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['layer' + obj.id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
                                 url: result[0].path,
                              }));
                              that[res.data[i].id].alpha = 1
                              that['layer' + obj.id].alpha = 1;
                              that['layer' + obj.id].getViewableRectangle().then(function (rectangle) {
                                 return that.map.camera.flyTo({
                                    destination: rectangle
                                 });
                              });
                           }
                        })
@@ -115,17 +122,16 @@
                        })
                     }
                  }
               });
            });
         },
         closeToolBox: function (item) {
         },
         closeToolBox: function (item) {},
         onOpen: function () {
            //面板打开的时候触发 (when open this panel trigger)
@@ -146,8 +152,7 @@
         resize: function () {
         },
         begin: function () {
         },
         begin: function () {},
         destroy: function () {
            //销毁的时候触发