layoutControl.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /**
  2. * Created by Administrator on 2017/11/21.
  3. */
  4. define([
  5. 'css!styles/meteo/meteo', //css样式
  6. 'meteoDir/c/timeInput', //时间控件
  7. 'html!templates/meteo/controlStation', //站点气象
  8. 'html!templates/meteo/controlT799', //大气
  9. 'html!templates/meteo/controlOcean', //海洋
  10. 'html!templates/meteo/controlCloud', //云图
  11. 'html!templates/meteo/controlCloudList', //云图列表
  12. 'html!templates/meteo/controlTyphoon', //台风列表
  13. 'html!templates/meteo/controlSpaceWeather', //空间天气列表
  14. ], function (css, time, station, t799, ocean, cloud, cloudList, typhoonList, testSpaWea) {
  15. var layout = {
  16. level: {
  17. '地面': '9999',
  18. '925': '0925',
  19. '850': '0850',
  20. '700': '0700',
  21. '500': '0500',
  22. },
  23. oceanLevel: {
  24. '海表': '0000',
  25. '10米': '0010',
  26. '20米': '0020',
  27. '30米': '0030',
  28. '50米': '0050',
  29. },
  30. init: function () {
  31. //快捷方式 start
  32. // $('.tools-toolWheather').append(shortcut);
  33. //hover 气象
  34. // $('.tools-toolWheather').hover(function () {
  35. // $('.meteo-hover-div').show();
  36. // }, function () {
  37. // $('.meteo-hover-div').hide();
  38. // })
  39. //end
  40. layout.initControl();
  41. layout.initButton();
  42. $(".content_scroll").mCustomScrollbar({
  43. advanced: {
  44. autoExpandHorizontalScroll: true,
  45. }
  46. });
  47. //-------------------加载世界地图geoJson(无底图时使用)---------------------------
  48. //L.geoJson(world, {}).addTo(map2DViewer.map);
  49. },
  50. initControl: function () {
  51. //------------------布局填充----------------------
  52. $('#meteo-ul-station').html(station); //站点查询
  53. $('#meteo-ul-799').html(t799); //大气海洋环境
  54. $('#meteo-ul-ocean').html(ocean); //大气海洋环境
  55. $('#meteo-ul-cloud').html(cloud); //云图
  56. $('#sideBarBody').append(cloudList); //云图列表
  57. $('#sideBarBody').append(typhoonList); //台风
  58. $('#sideBarBody').append(testSpaWea); //空间天气
  59. //-------------------布局交互-----------------------
  60. $('.meteo-control-active').click(function (e) {
  61. $(this).parent().siblings().removeClass('active');
  62. $(this).parent().toggleClass('active');
  63. });
  64. //侧边栏展开代码
  65. $('#meteo-bt-controld').click(function () {
  66. //设置zIndex 为最高
  67. var zIndex = ONEMAP.M.sideBar.getZIndex();
  68. $('#meteo-control-typhoon').css({zIndex: zIndex});
  69. ONEMAP.D.currentSideBarMod = 'atlas';
  70. //开启侧栏
  71. ONEMAP.C.publisher.publish('handShow', 'layout::sideBar');
  72. });
  73. //拖动插件
  74. require(['meteoDir/other/jquery.easyui.min'], function () {
  75. // $('#meteo-control').draggable();
  76. $('.meteo-popup').draggable();
  77. });
  78. time.init();
  79. },
  80. initButton: function () {
  81. $('.meteo-button-799').click(function (e) {
  82. var elem = $(this).parent().parent()[0].attributes.meteotype.nodeValue;
  83. var level = $(this).html();
  84. if (meteo.f[elem] && meteo.f[elem].click) meteo.f[elem].click(layout.level[level]);
  85. });
  86. $('.meteo-button-ocean').click(function (e) {
  87. var elem = $(this).parent().parent()[0].attributes.meteotype.nodeValue;
  88. var level = $(this).html();
  89. if (meteo.f[elem] && meteo.f[elem].click) meteo.f[elem].click(layout.oceanLevel[level]);
  90. });
  91. },
  92. showCloudList: function () { //显示云图列表
  93. //设置zIndex 为最高
  94. var zIndex = ONEMAP.M.sideBar.getZIndex();
  95. $('#meteo-control-cloud').css({zIndex: zIndex});
  96. ONEMAP.D.currentSideBarMod = 'atlas';
  97. //开启侧栏
  98. ONEMAP.C.publisher.publish('handShow', 'layout::sideBar');
  99. },
  100. getTimeObject: function () {
  101. return time;
  102. }
  103. }
  104. layout.init();
  105. return layout;
  106. })