popup_1.js 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326
  1. /**
  2. * 弹窗类
  3. */
  4. define([
  5. 'html!templates/meteo/popup1', //弹窗
  6. 'html!templates/meteo/popup_surf', //弹窗
  7. 'html!templates/meteo/popup_global', //弹窗
  8. 'html!templates/meteo/popup_army', //弹窗
  9. 'html!templates/meteo/popup_auto', //弹窗
  10. ], function (html, surfHtml, globalHtml, armyHtml, autoHtml) {
  11. var popup = {
  12. options: [],
  13. length: [],
  14. chart: null,
  15. initImage: function () {
  16. for (var i = 0; i < 100; i++) {
  17. var image = new Image();
  18. var dayUrl = "";
  19. if (i < 10) {
  20. dayUrl = 'images/meteo/weatherIcon/cww0' + i + '.png';
  21. } else {
  22. dayUrl = 'images/meteo/weatherIcon/cww' + i + '.png';
  23. }
  24. image.src = dayUrl;
  25. }
  26. var dayAndNightImageId = [0, 1, 2, 3, 25, 26, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90];
  27. for (var j = 0; j < dayAndNightImageId.length; j++) {
  28. var image = new Image();
  29. var nightUrl = "";
  30. if (dayAndNightImageId[i] < 10) {
  31. nightUrl = 'images/meteo/weatherIcon/cww0' + i + 'n.png';
  32. } else {
  33. nightUrl = 'images/meteo/weatherIcon/cww' + i + 'n.png';
  34. }
  35. image.src = nightUrl;
  36. }
  37. },
  38. init: function () {
  39. // $('.meteo-popup').remove();
  40. $('.meteo-popup-surf').remove();
  41. $('.meteo-popup-global').remove();
  42. $('.meteo-popup-army').remove();
  43. $('.meteo-popup-auto').remove();
  44. if ($('#meteo-popup-title').html()) {
  45. return;
  46. }
  47. //初始化弹窗
  48. $('body').append(html);
  49. require(['meteoDir/other/jquery.easyui.min'], function () {
  50. $('.meteo-popup').draggable();
  51. });
  52. ONEMAP.C.publisher.subscribe(popup.popup_html_css, 'change23D');
  53. //滚动条
  54. $(".content_scrollx").mCustomScrollbar({
  55. axis: "x",
  56. advanced: {
  57. autoExpandHorizontalScroll: true,
  58. }
  59. });
  60. //------------添加/删除TD为星图添加(用于3D地图显示弹窗)---------------
  61. $('.meteo-weather-dot').click(function (event) {
  62. $('.meteo-popup').show();
  63. if (map23DData.display.map2D) {
  64. $(".meteo-popup .popup_html").removeClass('TD');
  65. } else {
  66. $(".meteo-popup .popup_html").addClass('TD');
  67. }
  68. });
  69. //----------------------------------------------------------------------
  70. //实况 菜单切换
  71. $('.meteo-popup #meteo-popup-bt1').addClass('current');
  72. $('.meteo-popup .meteo-popup-chart>div').eq(0).show().siblings().hide();
  73. $('.meteo-popup .meteo-popup-buttons a').click(function () {
  74. $(this).addClass('current').siblings().removeClass('current');
  75. $('.meteo-popup .meteo-popup-chart>div').eq($(this).index()).show().siblings().hide();
  76. })
  77. $('.meteo-popup .metie-popup-buttons-main').click(function (event) {
  78. $(this).addClass('current').siblings().removeClass('current');
  79. $('.meteo-popup .meteo-popup-main-warp').addClass('current').siblings().removeClass('current');
  80. });
  81. $('.meteo-popup .metie-popup-buttons-chart').click(function (event) {
  82. $(this).addClass('current').siblings().removeClass('current');
  83. $('.meteo-popup .meteo-popup-chart').addClass('current').siblings().removeClass('current');
  84. });
  85. //关闭按钮可关闭弹窗
  86. $('.meteo-popup .meteo-delete').click(function (event) {
  87. $('.meteo-popup').hide();
  88. $('.meteo-popup .meteo-popup-main-warp,.meteo-popup .metie-popup-buttons-main').addClass('current').siblings().removeClass('current');
  89. });
  90. //点击地图关闭弹窗 2D
  91. map2DViewer.map.on('click', function () {
  92. $('.meteo-popup').hide();
  93. })
  94. //todo 点击地图关闭弹窗 3D
  95. // locaSpaceMap.attachEvent('Click', function () {
  96. // PubSub.publish('map3D.click', {
  97. // from:'3D'
  98. // });
  99. // // $('#meteo-popup').hide();
  100. // })
  101. },
  102. initSurf: function () {
  103. // $('.meteo-popup-surf').remove();
  104. $('.meteo-popup').remove();
  105. $('.meteo-popup-global').remove();
  106. $('.meteo-popup-army').remove();
  107. $('.meteo-popup-auto').remove();
  108. if ($('#meteo-popup-surf-title').html()) {
  109. return;
  110. }
  111. //初始化弹窗
  112. $('body').append(surfHtml);
  113. if (meteo.c.map.mapType == '3d') {
  114. $(".meteo-popup-surf .popup_html").addClass('TD');
  115. } else {
  116. $(".meteo-popup-surf .popup_html").removeClass('TD');
  117. }
  118. require(['meteoDir/other/jquery.easyui.min'], function () {
  119. $('.meteo-popup-surf').draggable();
  120. });
  121. ONEMAP.C.publisher.subscribe(popup.popup_html_surf_css, 'change23D');
  122. //滚动条
  123. $(".content_scrollx").mCustomScrollbar({
  124. axis: "x",
  125. advanced: {
  126. autoExpandHorizontalScroll: true,
  127. }
  128. });
  129. //------------添加/删除TD为星图添加(用于3D地图显示弹窗)---------------
  130. $('.meteo-weather-dot').click(function (event) {
  131. $('.meteo-popup-surf').show();
  132. if (map23DData.display.map2D) {
  133. $(".meteo-popup-surf .popup_html").removeClass('TD');
  134. } else {
  135. $(".meteo-popup-surf .popup_html").addClass('TD');
  136. }
  137. });
  138. //----------------------------------------------------------------------
  139. //实况 菜单切换
  140. $('.meteo-popup-surf #meteo-popup-surf-bt1').addClass('current');
  141. $('.meteo-popup-surf .meteo-popup-chart>div').eq(0).show().siblings().hide();
  142. $('.meteo-popup-surf .meteo-popup-buttons a').click(function () {
  143. $(this).addClass('current').siblings().removeClass('current');
  144. $('.meteo-popup-surf .meteo-popup-chart>div').eq($(this).index()).show().siblings().hide();
  145. })
  146. $('.meteo-popup-surf .meteo-popup-buttons-main').click(function (event) {
  147. $(this).addClass('current').siblings().removeClass('current');
  148. $('.meteo-popup-surf .meteo-popup-main-warp').addClass('current').siblings().removeClass('current');
  149. });
  150. $('.meteo-popup-surf .meteo-popup-buttons-chart').click(function (event) {
  151. $(this).addClass('current').siblings().removeClass('current');
  152. $('.meteo-popup-surf .meteo-popup-chart').addClass('current').siblings().removeClass('current');
  153. });
  154. //关闭按钮可关闭弹窗
  155. $('.meteo-popup-surf .meteo-delete').click(function (event) {
  156. $('.meteo-popup-surf').hide();
  157. $('.meteo-popup-surf .meteo-popup-main-warp,.meteo-popup-surf .metie-popup-buttons-main').addClass('current').siblings().removeClass('current');
  158. });
  159. //点击地图关闭弹窗 2D
  160. map2DViewer.map.on('click', function () {
  161. $('.meteo-popup-surf').hide();
  162. })
  163. //todo 点击地图关闭弹窗 3D
  164. // locaSpaceMap.attachEvent('Click', function () {
  165. // PubSub.publish('map3D.click', {
  166. // from:'3D'
  167. // });
  168. // // $('#meteo-popup').hide();
  169. // })
  170. },
  171. initGlobal: function () {
  172. $('.meteo-popup').remove();
  173. $('.meteo-popup-surf').remove();
  174. // $('.meteo-popup-global').remove();
  175. $('.meteo-popup-army').remove();
  176. $('.meteo-popup-auto').remove();
  177. if ($('#meteo-popup-global-title').html()) {
  178. return;
  179. }
  180. //初始化弹窗
  181. $('body').append(globalHtml);
  182. if (meteo.c.map.mapType == '3d') {
  183. $(".meteo-popup-global .popup_html").addClass('TD');
  184. } else {
  185. $(".meteo-popup-global .popup_html").removeClass('TD');
  186. }
  187. require(['meteoDir/other/jquery.easyui.min'], function () {
  188. $('.meteo-popup-global').draggable();
  189. });
  190. ONEMAP.C.publisher.subscribe(popup.popup_html_global_css, 'change23D');
  191. //滚动条
  192. $(".content_scrollx").mCustomScrollbar({
  193. axis: "x",
  194. advanced: {
  195. autoExpandHorizontalScroll: true,
  196. }
  197. });
  198. //------------添加/删除TD为星图添加(用于3D地图显示弹窗)---------------
  199. $('.meteo-weather-dot').click(function (event) {
  200. $('.meteo-popup-global').show();
  201. if (map23DData.display.map2D) {
  202. $(".meteo-popup-global .popup_html").removeClass('TD');
  203. } else {
  204. $(".meteo-popup-global .popup_html").addClass('TD');
  205. }
  206. });
  207. //----------------------------------------------------------------------
  208. //实况 菜单切换
  209. $('.meteo-popup-global #meteo-popup-global-bt1').addClass('current');
  210. $('.meteo-popup-global .meteo-popup-chart>div').eq(0).show().siblings().hide();
  211. $('.meteo-popup-global .meteo-popup-buttons a').click(function () {
  212. $(this).addClass('current').siblings().removeClass('current');
  213. $('.meteo-popup-global .meteo-popup-chart>div').eq($(this).index()).show().siblings().hide();
  214. })
  215. $('.meteo-popup-global .metie-popup-buttons-main').click(function (event) {
  216. $(this).addClass('current').siblings().removeClass('current');
  217. $('.meteo-popup-global .meteo-popup-main-warp').addClass('current').siblings().removeClass('current');
  218. });
  219. $('.meteo-popup-global .metie-popup-buttons-chart').click(function (event) {
  220. $(this).addClass('current').siblings().removeClass('current');
  221. $('.meteo-popup-global .meteo-popup-chart').addClass('current').siblings().removeClass('current');
  222. });
  223. //关闭按钮可关闭弹窗
  224. $('.meteo-popup-global .meteo-delete').click(function (event) {
  225. $('.meteo-popup-global').hide();
  226. $('.meteo-popup-global .meteo-popup-main-warp,.meteo-popup-global .metie-popup-buttons-main').addClass('current').siblings().removeClass('current');
  227. });
  228. //点击地图关闭弹窗 2D
  229. map2DViewer.map.on('click', function () {
  230. $('.meteo-popup-global').hide();
  231. })
  232. //todo 点击地图关闭弹窗 3D
  233. // locaSpaceMap.attachEvent('Click', function () {
  234. // PubSub.publish('map3D.click', {
  235. // from:'3D'
  236. // });
  237. // // $('#meteo-popup').hide();
  238. // })
  239. },
  240. initArmy: function () {
  241. $('.meteo-popup').remove();
  242. $('.meteo-popup-surf').remove();
  243. $('.meteo-popup-global').remove();
  244. // $('.meteo-popup-army').remove();
  245. $('.meteo-popup-auto').remove();
  246. if ($('#meteo-popup-army-title').html()) {
  247. return;
  248. }
  249. //初始化弹窗
  250. $('body').append(armyHtml);
  251. if (meteo.c.map.mapType == '3d') {
  252. $(".meteo-popup-army .popup_html").addClass('TD');
  253. } else {
  254. $(".meteo-popup-army .popup_html").removeClass('TD');
  255. }
  256. require(['meteoDir/other/jquery.easyui.min'], function () {
  257. $('.meteo-popup-army').draggable();
  258. });
  259. ONEMAP.C.publisher.subscribe(popup.popup_html_army_css, 'change23D');
  260. //滚动条
  261. $(".content_scrollx").mCustomScrollbar({
  262. axis: "x",
  263. advanced: {
  264. autoExpandHorizontalScroll: true,
  265. }
  266. });
  267. //------------添加/删除TD为星图添加(用于3D地图显示弹窗)---------------
  268. $('.meteo-weather-dot').click(function (event) {
  269. $('.meteo-popup-army').show();
  270. if (map23DData.display.map2D) {
  271. $(".meteo-popup-army .popup_html").removeClass('TD');
  272. } else {
  273. $(".meteo-popup-army .popup_html").addClass('TD');
  274. }
  275. });
  276. //----------------------------------------------------------------------
  277. //实况 菜单切换
  278. $('.meteo-popup-army #meteo-popup-army-bt1').addClass('current');
  279. $('.meteo-popup-army .meteo-popup-chart>div').eq(0).show().siblings().hide();
  280. $('.meteo-popup-army .meteo-popup-buttons a').click(function () {
  281. $(this).addClass('current').siblings().removeClass('current');
  282. $('.meteo-popup-army .meteo-popup-chart>div').eq($(this).index()).show().siblings().hide();
  283. })
  284. $('.meteo-popup-army .metie-popup-buttons-main').click(function (event) {
  285. $(this).addClass('current').siblings().removeClass('current');
  286. $('.meteo-popup-global .meteo-popup-main-warp').addClass('current').siblings().removeClass('current');
  287. });
  288. $('.meteo-popup-army .metie-popup-buttons-chart').click(function (event) {
  289. $(this).addClass('current').siblings().removeClass('current');
  290. $('.meteo-popup-army .meteo-popup-chart').addClass('current').siblings().removeClass('current');
  291. });
  292. //关闭按钮可关闭弹窗
  293. $('.meteo-popup-army .meteo-delete').click(function (event) {
  294. $('.meteo-popup-army').hide();
  295. $('.meteo-popup-army .meteo-popup-main-warp,.meteo-popup-army .metie-popup-buttons-main').addClass('current').siblings().removeClass('current');
  296. });
  297. //点击地图关闭弹窗 2D
  298. map2DViewer.map.on('click', function () {
  299. $('.meteo-popup-army').hide();
  300. })
  301. //todo 点击地图关闭弹窗 3D
  302. // locaSpaceMap.attachEvent('Click', function () {
  303. // PubSub.publish('map3D.click', {
  304. // from:'3D'
  305. // });
  306. // // $('#meteo-popup').hide();
  307. // })
  308. },
  309. initAuto: function () {
  310. $('.meteo-popup').remove();
  311. $('.meteo-popup-surf').remove();
  312. $('.meteo-popup-global').remove();
  313. $('.meteo-popup-army').remove();
  314. // $('.meteo-popup-auto').remove();
  315. if ($('#meteo-popup-auto-title').html()) {
  316. return;
  317. }
  318. //初始化弹窗
  319. $('body').append(autoHtml);
  320. if (meteo.c.map.mapType == '3d') {
  321. $(".meteo-popup-auto .popup_html").addClass('TD');
  322. } else {
  323. $(".meteo-popup-auto .popup_html").removeClass('TD');
  324. }
  325. require(['meteoDir/other/jquery.easyui.min'], function () {
  326. $('.meteo-popup-auto').draggable();
  327. });
  328. ONEMAP.C.publisher.subscribe(popup.popup_html_auto_css, 'change23D');
  329. //滚动条
  330. $(".content_scrollx").mCustomScrollbar({
  331. axis: "x",
  332. advanced: {
  333. autoExpandHorizontalScroll: true,
  334. }
  335. });
  336. //------------添加/删除TD为星图添加(用于3D地图显示弹窗)---------------
  337. $('.meteo-weather-dot').click(function (event) {
  338. $('.meteo-popup-auto').show();
  339. if (map23DData.display.map2D) {
  340. $(".meteo-popup-auto .popup_html").removeClass('TD');
  341. } else {
  342. $(".meteo-popup-auto .popup_html").addClass('TD');
  343. }
  344. });
  345. //----------------------------------------------------------------------
  346. //实况 菜单切换
  347. $('.meteo-popup-auto #meteo-popup-auto-bt1').addClass('current');
  348. $('.meteo-popup-auto .meteo-popup-chart>div').eq(0).show().siblings().hide();
  349. $('.meteo-popup-auto .meteo-popup-buttons a').click(function () {
  350. $(this).addClass('current').siblings().removeClass('current');
  351. $('.meteo-popup-auto .meteo-popup-chart>div').eq($(this).index()).show().siblings().hide();
  352. })
  353. $('.meteo-popup-auto .metie-popup-buttons-main').click(function (event) {
  354. $(this).addClass('current').siblings().removeClass('current');
  355. $('.meteo-popup-auto .meteo-popup-main-warp').addClass('current').siblings().removeClass('current');
  356. });
  357. $('.meteo-popup-auto .metie-popup-buttons-chart').click(function (event) {
  358. $(this).addClass('current').siblings().removeClass('current');
  359. $('.meteo-popup-auto .meteo-popup-chart').addClass('current').siblings().removeClass('current');
  360. });
  361. //关闭按钮可关闭弹窗
  362. $('.meteo-popup-auto .meteo-delete').click(function (event) {
  363. $('.meteo-popup-auto').hide();
  364. $('.meteo-popup-auto .meteo-popup-main-warp,.meteo-popup-auto .metie-popup-buttons-main').addClass('current').siblings().removeClass('current');
  365. });
  366. //点击地图关闭弹窗 2D
  367. map2DViewer.map.on('click', function () {
  368. $('.meteo-popup-auto').hide();
  369. })
  370. //todo 点击地图关闭弹窗 3D
  371. // locaSpaceMap.attachEvent('Click', function () {
  372. // PubSub.publish('map3D.click', {
  373. // from:'3D'
  374. // });
  375. // // $('#meteo-popup').hide();
  376. // })
  377. },
  378. popup_html_css: function (type) {
  379. if (type == '2d') {
  380. $(".meteo-popup .popup_html").removeClass('TD');
  381. } else if (type == '3d') {
  382. $(".meteo-popup .popup_html").addClass('TD');
  383. }
  384. },
  385. popup_html_surf_css: function (type) {
  386. if (type == '2d') {
  387. $(".meteo-popup-surf .popup_html").removeClass('TD');
  388. } else if (type == '3d') {
  389. $(".meteo-popup-surf .popup_html").addClass('TD');
  390. }
  391. },
  392. popup_html_global_css: function (type) {
  393. if (type == '2d') {
  394. $(".meteo-popup-global .popup_html").removeClass('TD');
  395. } else if (type == '3d') {
  396. $(".meteo-popup-global .popup_html").addClass('TD');
  397. }
  398. },
  399. popup_html_army_css: function (type) {
  400. if (type == '2d') {
  401. $(".meteo-popup-army .popup_html").removeClass('TD');
  402. } else if (type == '3d') {
  403. $(".meteo-popup-army .popup_html").addClass('TD');
  404. }
  405. },
  406. popup_html_auto_css: function (type) {
  407. if (type == '2d') {
  408. $(".meteo-popup-auto .popup_html").removeClass('TD');
  409. } else if (type == '3d') {
  410. $(".meteo-popup-auto .popup_html").addClass('TD');
  411. }
  412. },
  413. getUrlForType: function (type) {
  414. var urls =
  415. //地面站
  416. type == 0 ? [meteo.c.http.stationInfo, meteo.c.http.stationReal,
  417. meteo.c.http.stationFcst, meteo.c.http.stationFcstDay] :
  418. //5000站点
  419. type == 1 ? [meteo.c.http.stationGInfo, meteo.c.http.stationGReal, meteo.c.http.stationGFcst] :
  420. //JD站
  421. type == 2 ? [meteo.c.http.amsuInfo, meteo.c.http.amsuReal, meteo.c.http.amsuFcst] :
  422. //自动站
  423. type == 3 ? [meteo.c.http.awsInfo, meteo.c.http.awsReal, meteo.c.http.amsuFcst] :
  424. //船舶报
  425. type == 4 ? [meteo.c.http.shipInfo] :
  426. null;
  427. return urls;
  428. },
  429. showPopup: function (station, name, type, day, day2) {
  430. day = null;
  431. day2 = null;
  432. popup.count = 0;
  433. $(".meteo-popup-button").hide(); //隐藏所有按钮
  434. var urls = popup.getUrlForType(type);
  435. if (!urls) return;
  436. if (type == 0) {////地面站
  437. //弹框 实况按钮选中
  438. this.initSurf();
  439. $('.meteo-popup-surf').css('left', '260px');
  440. $('.meteo-popup-surf').css('top', '100px');
  441. $('.meteo-popup-surf #meteo-popup-surf-bt1').addClass('current').siblings().removeClass('current');
  442. popup.setSurfContent(station, name, urls[0], function () {
  443. $('.meteo-popup-button').removeClass('.current');
  444. $('.meteo-popup-chart-list').hide();
  445. $('.meteo-shikuang-div').show();
  446. $('.meteo-popup-surf').show();
  447. $('#meteo-popup-surf-bt2').hide();
  448. $('#meteo-popup-surf-bt3').hide();
  449. popup.setSurfFcst(station, urls[2], day2);
  450. popup.setSurfFcstD(station, urls[3], day2);
  451. }, day, type);
  452. } else if (type == 1) {//5000站点
  453. //弹框 实况按钮选中
  454. $('.meteo-popup-global #meteo-popup-global-bt1').addClass('current').siblings().removeClass('current');
  455. this.initGlobal();
  456. $('.meteo-popup-global').css('left', '260px');
  457. $('.meteo-popup-global').css('top', '100px');
  458. popup.setGlobalContent(station, name, urls[0], function () {
  459. }, day, type);
  460. $('.meteo-popup-button').removeClass('.current');
  461. $('.meteo-popup-chart-list').hide();
  462. $('.meteo-shikuang-div').show();
  463. $('.meteo-popup-global').show();
  464. $('#meteo-popup-global-bt3').hide();
  465. popup.setGlobalFcstD(station, urls[2], day2);
  466. } else if (type == 2) {//JD站
  467. //弹框 实况按钮选中
  468. $('.meteo-popup-army #meteo-popup-army-bt1').addClass('current').siblings().removeClass('current');
  469. this.initArmy();
  470. $('.meteo-popup-army').css('left', '260px');
  471. $('.meteo-popup-army').css('top', '100px');
  472. popup.setArmyContent(station, name, urls[0], function () {
  473. }, day, type);
  474. $('.meteo-popup-button').removeClass('.current');
  475. $('.meteo-popup-chart-list').hide();
  476. $('.meteo-popup-army').show();
  477. // popup.setArmyFcst(station, urls[1], day2);
  478. } else if (type == 3) {//自动站
  479. //弹框 实况按钮选中
  480. $('.meteo-popup-auto #meteo-popup-auto-bt1').addClass('current').siblings().removeClass('current');
  481. this.initAuto();
  482. $('.meteo-popup-auto').css('left', '260px');
  483. $('.meteo-popup-auto ').css('top', '100px');
  484. popup.setAutoContent(station, name, urls[0], function () {
  485. }, day, type);
  486. $('.meteo-popup-button').removeClass('.current');
  487. $('.meteo-popup-chart-list').hide();
  488. $('.meteo-popup-auto').show();
  489. } else if (type == 4) {
  490. $('.meteo-popup #meteo-popup-bt1').addClass('current').siblings().removeClass('current');
  491. this.init();
  492. popup.setContent(station, name, urls[0], function () {
  493. }, day, type);
  494. $('.meteo-popup').show();
  495. } else {
  496. $('.meteo-popup #meteo-popup-bt1').addClass('current').siblings().removeClass('current');
  497. this.init();
  498. popup.setContent(station, name, urls[0], function () {}, day, type);
  499. $('.meteo-popup').show();
  500. }
  501. },
  502. setContent: function (station, name, url, callback, day, type) {
  503. var par = null;
  504. if (day) {
  505. par = {
  506. odate: day
  507. }
  508. }
  509. meteo.c.http.httpFunction(url, station, par, function (json) {
  510. if (json) {
  511. var date = json.ldate;
  512. if (type == 0) date = "01/09";
  513. popup.setTitle('#meteo-popup-title', name, station, date);
  514. var wth = meteo.c.process.setWth(json.wth);
  515. popup.setPopupData('#meteo-popup-wth', wth);
  516. var tt = meteo.c.process.setTt(json.tt);
  517. popup.setPopupData('#meteo-popup-tt', tt);
  518. var wth1 = meteo.c.process.setWth(json.wth1);
  519. popup.setPopupData('#meteo-popup-wth1', wth1);
  520. var wth2 = meteo.c.process.setWth(json.wth2);
  521. popup.setPopupData('#meteo-popup-wth2', wth2);
  522. var td = meteo.c.process.setTt(json.td);
  523. popup.setPopupData('#meteo-popup-td', td);
  524. var pr = meteo.c.process.setPr(json.pr);
  525. popup.setPopupData('#meteo-popup-pr', pr);
  526. var vis = meteo.c.process.setVis(json.vis);
  527. popup.setPopupData('#meteo-popup-vis', vis);
  528. var rh = meteo.c.process.setRh(json.rh);
  529. popup.setPopupData('#meteo-popup-rh', rh);
  530. var rn = meteo.c.process.setRn(json.rn06);
  531. popup.setPopupData('#meteo-popup-rn06', rn);
  532. var cn = meteo.c.process.setCn(json.cn);
  533. popup.setPopupData('#meteo-popup-cn', cn);
  534. var wd = meteo.c.process.setWd(json.wd);
  535. var ws = meteo.c.process.setWs(json.ws);
  536. popup.setPopupData('#meteo-popup-wd', wd + " " + ws);
  537. // popup.setPopupData('#meteo-popup-ws', wd, '');
  538. var dp = meteo.c.process.setPr(json.dp03);
  539. popup.setPopupData('#meteo-popup-dp03', dp);
  540. var cm = meteo.c.process.setCn(json.cm);
  541. popup.setPopupData('#meteo-popup-cm', cm);
  542. var ch = meteo.c.process.setCh(json.ch);
  543. popup.setPopupData('#meteo-popup-ch', ch);
  544. callback ? callback() : null;
  545. } else {
  546. alert('暂无数据');
  547. }
  548. })
  549. },
  550. setSurfContent: function (station, name, url, callback, day, type) {
  551. var par = null;
  552. if (day) {
  553. par = {
  554. odate: day
  555. }
  556. }
  557. meteo.c.http.httpFunction(url, station, par, function (json) {
  558. var date = json.ldate;
  559. // if (type == 0) date = "01/09";
  560. popup.setTitle('#meteo-popup-surf-title', name, station, date);
  561. var wth = meteo.c.process.setWth(json.wth);
  562. popup.setPopupData('#meteo-popup-surf-wth', wth);
  563. var tt = meteo.c.process.setTt(json.tt);
  564. popup.setPopupData('#meteo-popup-surf-tt', tt);
  565. var wth1 = meteo.c.process.setWth(json.wth1);
  566. popup.setPopupData('#meteo-popup-surf-wth1', wth1);
  567. var wth2 = meteo.c.process.setWth(json.wth2);
  568. popup.setPopupData('#meteo-popup-surf-wth2', wth2);
  569. var td = meteo.c.process.setTt(json.td);
  570. popup.setPopupData('#meteo-popup-surf-td', td);
  571. var pr = meteo.c.process.setPr(json.pr);
  572. popup.setPopupData('#meteo-popup-surf-pr', pr);
  573. var vis = meteo.c.process.setVis(json.vis);
  574. popup.setPopupData('#meteo-popup-surf-vis', vis);
  575. var rh = meteo.c.process.setRh(json.rh);
  576. popup.setPopupData('#meteo-popup-surf-rh', rh);
  577. var rn = meteo.c.process.setRn(json.rn06);
  578. popup.setPopupData('#meteo-popup-surf-rn06', rn);
  579. var cn = meteo.c.process.setCn(json.cn);
  580. popup.setPopupData('#meteo-popup-surf-cn', cn);
  581. var wd = meteo.c.process.setWd(json.wd);
  582. var ws = meteo.c.process.setWs(json.ws);
  583. popup.setPopupData('#meteo-popup-surf-wd', wd + " " + ws);
  584. // popup.setPopupData('#meteo-popup-ws', wd, '');
  585. var dp = meteo.c.process.setPr(json.dp03);
  586. popup.setPopupData('#meteo-popup-surf-dp03', dp);
  587. var cm = meteo.c.process.setCn(json.cm);
  588. popup.setPopupData('#meteo-popup-surf-cm', cm);
  589. var ch = meteo.c.process.setCh(json.ch);
  590. popup.setPopupData('#meteo-popup-surf-ch', ch);
  591. callback ? callback() : null;
  592. }, function () {
  593. ONEMAP.C.publisher.publish({type: 'warning', message: '暂无当前站点数据'}, 'noteBar::add');
  594. $('.meteo-popup-surf').remove();
  595. })
  596. },
  597. setGlobalContent: function (station, name, url, callback, day, type) {
  598. var par = null;
  599. if (day) {
  600. par = {
  601. odate: day
  602. }
  603. }
  604. meteo.c.http.httpFunction(url, station, par, function (json) {
  605. if (json) {
  606. var date = json.ldate;
  607. popup.setTitle('#meteo-popup-global-title', name, station, date);
  608. var wth = meteo.c.process.setWth(json.wth);
  609. popup.setPopupData('#meteo-popup-global-wth', wth);
  610. var tt = meteo.c.process.setTt(json.tt);
  611. popup.setPopupData('#meteo-popup-global-tt', tt);
  612. var wth1 = meteo.c.process.setWth(json.wth1);
  613. popup.setPopupData('#meteo-popup-global-wth1', wth1);
  614. var wth2 = meteo.c.process.setWth(json.wth2);
  615. popup.setPopupData('#meteo-popup-global-wth2', wth2);
  616. var td = meteo.c.process.setTt(json.td);
  617. popup.setPopupData('#meteo-popup-global-td', td);
  618. var pr = meteo.c.process.setPr(json.pr);
  619. popup.setPopupData('#meteo-popup-global-pr', pr);
  620. var vis = meteo.c.process.setVis(json.vis);
  621. popup.setPopupData('#meteo-popup-global-vis', vis);
  622. var rh = meteo.c.process.setRh(json.rh);
  623. popup.setPopupData('#meteo-popup-global-rh', rh);
  624. var rn = meteo.c.process.setRn(json.rn06);
  625. popup.setPopupData('#meteo-popup-global-rn06', rn);
  626. var cn = meteo.c.process.setCn(json.cn);
  627. popup.setPopupData('#meteo-popup-global-cn', cn);
  628. var wd = meteo.c.process.setWd(json.wd);
  629. var ws = meteo.c.process.setWs(json.ws);
  630. popup.setPopupData('#meteo-popup-global-wd', wd + " " + ws);
  631. // popup.setPopupData('#meteo-popup-ws', wd, '');
  632. var dp = meteo.c.process.setPr(json.dp03);
  633. popup.setPopupData('#meteo-popup-global-dp03', dp);
  634. var cm = meteo.c.process.setCn(json.cm);
  635. popup.setPopupData('#meteo-popup-global-cm', cm);
  636. var ch = meteo.c.process.setCh(json.ch);
  637. popup.setPopupData('#meteo-popup-global-ch', ch);
  638. callback ? callback() : null;
  639. } else {
  640. alert('暂无数据');
  641. }
  642. }, function () {
  643. $('.meteo-popup-global').remove();
  644. })
  645. },
  646. setArmyContent: function (station, name, url, callback, day, type) {
  647. var par = null;
  648. if (day) {
  649. par = {
  650. odate: day
  651. }
  652. }
  653. meteo.c.http.httpFunction(url, station, par, function (json) {
  654. if (json) {
  655. var date = json.ldate;
  656. popup.setTitle('#meteo-popup-army-title', name, station, date);
  657. var wth = meteo.c.process.setWth(json.wth);
  658. popup.setPopupData('#meteo-popup-army-wth', wth);
  659. var tt = meteo.c.process.setTt(json.tt);
  660. popup.setPopupData('#meteo-popup-army-tt', tt);
  661. var wth1 = meteo.c.process.setWth(json.wth1);
  662. popup.setPopupData('#meteo-popup-army-wth1', wth1);
  663. var wth2 = meteo.c.process.setWth(json.wth2);
  664. popup.setPopupData('#meteo-popup-army-wth2', wth2);
  665. var td = meteo.c.process.setTt(json.td);
  666. popup.setPopupData('#meteo-popup-army-td', td);
  667. var pr = meteo.c.process.setPr(json.pr);
  668. popup.setPopupData('#meteo-popup-army-pr', pr);
  669. var vis = meteo.c.process.setVis(json.vis);
  670. popup.setPopupData('#meteo-popup-army-vis', vis);
  671. var rh = meteo.c.process.setRh(json.rh);
  672. popup.setPopupData('#meteo-popup-army-rh', rh);
  673. var rn = meteo.c.process.setRn(json.rn06);
  674. popup.setPopupData('#meteo-popup-army-rn06', rn);
  675. var cn = meteo.c.process.setCn(json.cn);
  676. popup.setPopupData('#meteo-popup-army-cn', cn);
  677. var wd = meteo.c.process.setWd(json.wd);
  678. var ws = meteo.c.process.setWs(json.ws);
  679. popup.setPopupData('#meteo-popup-army-wd', wd + " " + ws);
  680. // popup.setPopupData('#meteo-popup-ws', wd, '');
  681. var dp = meteo.c.process.setPr(json.dp03);
  682. popup.setPopupData('#meteo-popup-army-dp03', dp);
  683. var cm = meteo.c.process.setCn(json.cm);
  684. popup.setPopupData('#meteo-popup-army-cm', cm);
  685. var ch = meteo.c.process.setCh(json.ch);
  686. popup.setPopupData('#meteo-popup-army-ch', ch);
  687. callback ? callback() : null;
  688. } else {
  689. alert('暂无数据');
  690. }
  691. }, function () {
  692. $('.meteo-popup-army').remove();
  693. })
  694. },
  695. setAutoContent: function (station, name, url, callback, day, type) {
  696. var par = null;
  697. if (day) {
  698. par = {
  699. odate: day
  700. }
  701. }
  702. meteo.c.http.httpFunction(url, station, par, function (json) {
  703. if (json) {
  704. var date = json.ldate;
  705. popup.setTitle('#meteo-popup-auto-title', name, station, date);
  706. var wth = meteo.c.process.setWth(json.wth);
  707. popup.setPopupData('#meteo-popup-auto-wth', wth);
  708. var tt = meteo.c.process.setTt(json.tt);
  709. popup.setPopupData('#meteo-popup-auto-tt', tt);
  710. var wth1 = meteo.c.process.setWth(json.wth1);
  711. popup.setPopupData('#meteo-popup-auto-wth1', wth1);
  712. var wth2 = meteo.c.process.setWth(json.wth2);
  713. popup.setPopupData('#meteo-popup-auto-wth2', wth2);
  714. var td = meteo.c.process.setTt(json.td);
  715. popup.setPopupData('#meteo-popup-auto-td', td);
  716. var pr = meteo.c.process.setPr(json.pr);
  717. popup.setPopupData('#meteo-popup-auto-pr', pr);
  718. var vis = meteo.c.process.setVis(json.vis);
  719. popup.setPopupData('#meteo-popup-auto-vis', vis);
  720. var rh = meteo.c.process.setRh(json.rh);
  721. popup.setPopupData('#meteo-popup-auto-rh', rh);
  722. var rn = meteo.c.process.setRn(json.rn06);
  723. popup.setPopupData('#meteo-popup-auto-rn06', rn);
  724. var cn = meteo.c.process.setCn(json.cn);
  725. popup.setPopupData('#meteo-popup-auto-cn', cn);
  726. var wd = meteo.c.process.setWd(json.wd);
  727. var ws = meteo.c.process.setWs(json.ws);
  728. popup.setPopupData('#meteo-popup-auto-wd', wd + " " + ws);
  729. // popup.setPopupData('#meteo-popup-ws', wd, '');
  730. var dp = meteo.c.process.setPr(json.dp03);
  731. popup.setPopupData('#meteo-popup-auto-dp03', dp);
  732. var cm = meteo.c.process.setCn(json.cm);
  733. popup.setPopupData('#meteo-popup-auto-cm', cm);
  734. var ch = meteo.c.process.setCh(json.ch);
  735. popup.setPopupData('#meteo-popup-auto-ch', ch);
  736. callback ? callback() : null;
  737. } else {
  738. alert('暂无数据');
  739. }
  740. }, function () {
  741. $('.meteo-popup-auto').remove();
  742. })
  743. },
  744. setReal: function (station, url, day) {
  745. if (!url) {
  746. return;
  747. }
  748. var par = null;
  749. if (day) {
  750. par = {
  751. ldate: day,
  752. odate: day
  753. }
  754. }
  755. meteo.c.http.httpFunction(url, station, par, function (json) {
  756. if (json.length > 0) {
  757. $('#meteo-popup-bt1').show();
  758. $('#meteo-popup-cdiv1').show();
  759. var chartWidth = json.length * 50;
  760. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  761. $('#meteo-popup-chart').css('width', chartWidth); //设置宽度
  762. var chart = meteo.c.chart.getChart('meteo-popup-chart');
  763. var option = meteo.c.chart.getChartOption(json, "实况");
  764. chart.resize();
  765. chart.setOption(option);
  766. $(".content_scrollx").mCustomScrollbar('update');
  767. }
  768. }, function () {
  769. });
  770. },
  771. setSurfReal: function (station, url, day) {
  772. if (!url) {
  773. return;
  774. }
  775. var par = null;
  776. if (day) {
  777. par = {
  778. ldate: day,
  779. odate: day
  780. }
  781. }
  782. meteo.c.http.httpFunction(url, station, par, function (json) {
  783. if (json.length > 0) {
  784. $('#meteo-popup-surf-bt1').show();
  785. $('#meteo-popup-surf-cdiv1').hide();
  786. var chartWidth = json.length * 50;
  787. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  788. $('#meteo-popup-surf-chart').css('width', chartWidth); //设置宽度
  789. var chart = meteo.c.chart.getChart('meteo-popup-surf-chart');
  790. var option = meteo.c.chart.getChartOption(json, "实况");
  791. chart.resize();
  792. chart.setOption(option);
  793. $(".content_scrollx").mCustomScrollbar('update');
  794. }
  795. }, function () {
  796. });
  797. },
  798. setGlobalReal: function (station, url, day) {
  799. if (!url) {
  800. return;
  801. }
  802. var par = null;
  803. if (day) {
  804. par = {
  805. ldate: day,
  806. odate: day
  807. }
  808. }
  809. meteo.c.http.httpFunction(url, station, par, function (json) {
  810. if (json.length > 0) {
  811. $('#meteo-popup-global-bt1').show();
  812. $('#meteo-popup-global-cdiv1').show();
  813. var chartWidth = json.length * 50;
  814. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  815. $('#meteo-popup-global-chart').css('width', chartWidth); //设置宽度
  816. var chart = meteo.c.chart.getChart('meteo-popup-global-chart');
  817. var option = meteo.c.chart.getChartOption(json, "实况");
  818. chart.resize();
  819. chart.setOption(option);
  820. $(".content_scrollx").mCustomScrollbar('update');
  821. }
  822. }, function () {
  823. });
  824. },
  825. setArmyReal: function (station, url, day) {
  826. if (!url) {
  827. return;
  828. }
  829. var par = null;
  830. if (day) {
  831. par = {
  832. ldate: day,
  833. odate: day
  834. }
  835. }
  836. meteo.c.http.httpFunction(url, station, par, function (json) {
  837. if (json.length > 0) {
  838. $('#meteo-popup-army-bt1').show();
  839. $('#meteo-popup-army-cdiv1').show();
  840. var chartWidth = json.length * 50;
  841. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  842. $('#meteo-popup-army-chart').css('width', chartWidth); //设置宽度
  843. var chart = meteo.c.chart.getChart('meteo-popup-army-chart');
  844. var option = meteo.c.chart.getChartOption(json, "实况");
  845. chart.resize();
  846. chart.setOption(option);
  847. $(".content_scrollx").mCustomScrollbar('update');
  848. }
  849. }, function () {
  850. });
  851. },
  852. setAutoReal: function (station, url, day) {
  853. if (!url) {
  854. return;
  855. }
  856. var par = null;
  857. if (day) {
  858. par = {
  859. ldate: day,
  860. odate: day
  861. }
  862. }
  863. meteo.c.http.httpFunction(url, station, par, function (json) {
  864. if (json.length > 0) {
  865. $('#meteo-popup-auto-bt1').show();
  866. $('#meteo-popup-auto-cdiv1').show();
  867. var chartWidth = json.length * 50;
  868. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  869. $('#meteo-popup-auto-chart').css('width', chartWidth); //设置宽度
  870. var chart = meteo.c.chart.getChart('meteo-popup-auto-chart');
  871. var option = meteo.c.chart.getChartOption(json, "实况");
  872. chart.resize();
  873. chart.setOption(option);
  874. $(".content_scrollx").mCustomScrollbar('update');
  875. }
  876. }, function () {
  877. });
  878. },
  879. setFcst: function (station, url, type, day) {
  880. if (!url) {
  881. return;
  882. }
  883. var par = null;
  884. if (day) {
  885. par = {
  886. ldate: day,
  887. odate: day
  888. }
  889. }
  890. meteo.c.http.httpFunction(url, station, par, function (json) {
  891. if (json.length > 0) {
  892. if (type == 1) {
  893. $('#meteo-popup-bt2').hide();
  894. $('#meteo-popup-bt4').show();
  895. var chartWidth = json.length * 50;
  896. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  897. $('#meteo-popup-chart4').css('width', chartWidth); //设置宽度
  898. var chart = meteo.c.chart.getChart('meteo-popup-chart4');
  899. var option = meteo.c.chart.getGlobalData(json, "预报");
  900. chart.resize();
  901. chart.setOption(option);
  902. $(".content_scrollx").mCustomScrollbar('update');
  903. } else {
  904. $('#meteo-popup-bt4').hide();
  905. $('#meteo-popup-bt2').show();
  906. var chartWidth = json.length * 50;
  907. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  908. $('#meteo-popup-chart2').css('width', chartWidth); //设置宽度
  909. var chart = meteo.c.chart.getChart('meteo-popup-chart2');
  910. var option = meteo.c.chart.getChartOption(json, "预报");
  911. chart.resize();
  912. chart.setOption(option);
  913. $(".content_scrollx").mCustomScrollbar('update');
  914. }
  915. }
  916. }, function () {
  917. })
  918. },
  919. setSurfFcst: function (station, url, day) {
  920. if (!url) {
  921. $('#meteo-popup-surf-bt2').hide();
  922. return;
  923. }
  924. var par = null;
  925. // if (day) {
  926. // par = {
  927. // ldate: day,
  928. // odate: day
  929. // }
  930. // }
  931. meteo.c.http.httpFunction(url, station, par, function (json) {
  932. if (json.length > 0) {
  933. $('#meteo-popup-surf-bt4').hide();
  934. $('#meteo-popup-surf-bt2').show();
  935. $('#meteo-popup-surf-chart').show();
  936. var chartWidth = json.length * 60;
  937. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  938. $('#meteo-popup-surf-chart').css('width', chartWidth); //设置宽度
  939. var chart = meteo.c.chart.getChart('meteo-popup-surf-chart');
  940. chart.clear();
  941. // var option = meteo.c.chart.getChartOption(json, "预报");
  942. var option = meteo.c.chart.getSurfHourChartOption(json, "预报");
  943. // chart.resize();
  944. chart.setOption(option);
  945. $(".content_scrollx").mCustomScrollbar('update');
  946. } else {
  947. $('#meteo-popup-surf-chart').hide();
  948. $('#meteo-popup-surf-bt2').hide();
  949. }
  950. }, function () {
  951. $('#meteo-popup-surf-bt2').hide();
  952. })
  953. },
  954. setGlobalFcst: function (station, url, day) {
  955. if (!url) {
  956. return;
  957. }
  958. var par = null;
  959. if (day) {
  960. par = {
  961. ldate: day,
  962. odate: day
  963. }
  964. }
  965. meteo.c.http.httpFunction(url, station, par, function (json) {
  966. if (json.length > 0) {
  967. $('#meteo-popup-global-bt4').hide();
  968. $('#meteo-popup-global-bt2').show();
  969. var chartWidth = json.length * 50;
  970. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  971. $('#meteo-popup-global-chart').css('width', chartWidth); //设置宽度
  972. var chart = meteo.c.chart.getChart('meteo-popup-global-chart');
  973. var option = meteo.c.chart.getChartOption(json, "预报");
  974. chart.resize();
  975. chart.setOption(option);
  976. $(".content_scrollx").mCustomScrollbar('update');
  977. }
  978. }, function () {
  979. })
  980. },
  981. setArmyFcst: function (station, url, day) {
  982. if (!url) {
  983. return;
  984. }
  985. var par = null;
  986. if (day) {
  987. par = {
  988. ldate: day,
  989. odate: day
  990. }
  991. }
  992. meteo.c.http.httpFunction(url, station, par, function (json) {
  993. if (json.length > 0) {
  994. $('#meteo-popup-army-bt4').hide();
  995. $('#meteo-popup-army-bt2').show();
  996. var chartWidth = json.length * 50;
  997. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  998. $('#meteo-popup-army-chart').css('width', chartWidth); //设置宽度
  999. var chart = meteo.c.chart.getChart('meteo-popup-army-chart');
  1000. var option = meteo.c.chart.getHourChartOption(json, "预报");
  1001. chart.resize();
  1002. chart.setOption(option);
  1003. $(".content_scrollx").mCustomScrollbar('update');
  1004. }
  1005. }, function () {
  1006. })
  1007. },
  1008. setAutoFcst: function (station, url, day) {
  1009. if (!url) {
  1010. return;
  1011. }
  1012. var par = null;
  1013. if (day) {
  1014. par = {
  1015. ldate: day,
  1016. odate: day
  1017. }
  1018. }
  1019. meteo.c.http.httpFunction(url, station, par, function (json) {
  1020. if (json.length > 0) {
  1021. $('#meteo-popup-auto-bt4').hide();
  1022. $('#meteo-popup-auto-bt2').show();
  1023. var chartWidth = json.length * 50;
  1024. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  1025. $('#meteo-popup-auto-chart').css('width', chartWidth); //设置宽度
  1026. var chart = meteo.c.chart.getChart('meteo-popup-auto-chart');
  1027. var option = meteo.c.chart.getAutoHourChartOption(json, "预报");
  1028. chart.resize();
  1029. chart.setOption(option);
  1030. $(".content_scrollx").mCustomScrollbar('update');
  1031. }
  1032. }, function () {
  1033. })
  1034. },
  1035. setFcstD: function (station, url, day) {
  1036. if (!url) {
  1037. return;
  1038. }
  1039. var par = null;
  1040. if (day) {
  1041. par = {
  1042. ldate: day,
  1043. odate: day
  1044. }
  1045. }
  1046. meteo.c.http.httpFunction(url, station, par, function (json) {
  1047. if (json.length > 0) {
  1048. $('#meteo-popup-bt3').show();
  1049. var chartWidth = json.length * 40;
  1050. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  1051. $('#meteo-popup-chart2').css('width', chartWidth); //设置宽度
  1052. var chart = meteo.c.chart.getChart('meteo-popup-chart2');
  1053. var option = meteo.c.chart.getChartOption(json, "七天预报");
  1054. chart.resize();
  1055. chart.setOption(option);
  1056. $(".content_scrollx").mCustomScrollbar('update');
  1057. }
  1058. }, function () {
  1059. })
  1060. },
  1061. setSurfFcstD: function (station, url, day) {
  1062. if (!url) {
  1063. $('#meteo-popup-surf-bt3').hide();
  1064. return;
  1065. }
  1066. var par = null;
  1067. // if (day) {
  1068. // par = {
  1069. // ldate: day,
  1070. // odate: day
  1071. // }
  1072. // }
  1073. meteo.c.http.httpFunction(url, station, par, function (json) {
  1074. if (json.length > 0) {
  1075. $('#meteo-popup-surf-bt3').show();
  1076. $('#meteo-popup-surf-chart2').show();
  1077. var chartWidth = json.length * 60;
  1078. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  1079. $('#meteo-popup-surf-chart2').css('width', chartWidth); //设置宽度
  1080. var chart = meteo.c.chart.getChart('meteo-popup-surf-chart2');
  1081. chart.clear();
  1082. var option = meteo.c.chart.getSurfDaysChartOption(json, "七天预报");
  1083. // var option = meteo.c.chart.getChartOption(json, "七天预报");
  1084. // chart.resize();
  1085. chart.setOption(option);
  1086. $(".content_scrollx").mCustomScrollbar('update');
  1087. } else {
  1088. $('#meteo-popup-surf-chart2').hide();
  1089. $('#meteo-popup-surf-bt3').hide();
  1090. }
  1091. }, function () {
  1092. $('#meteo-popup-surf-bt3').hide();
  1093. })
  1094. },
  1095. setGlobalFcstD: function (station, url, day) {
  1096. if (!url) {
  1097. $('#meteo-popup-global-bt3').hide();
  1098. return;
  1099. }
  1100. var par = null;
  1101. // if (day) {
  1102. // par = {
  1103. // ldate: day,
  1104. // odate: day
  1105. // }
  1106. // }
  1107. meteo.c.http.httpFunction(url, station, par, function (json) {
  1108. if (json.length > 0) {
  1109. $('#meteo-popup-global-bt3').show();
  1110. $('#meteo-popup-global-chart1').show();
  1111. var chartWidth = json.length * 40;
  1112. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  1113. $('#meteo-popup-global-chart1').css('width', chartWidth); //设置宽度
  1114. var chart = meteo.c.chart.getChart('meteo-popup-global-chart1');
  1115. chart.clear();
  1116. // var option = meteo.c.chart.getChartOption(json, "七天预报");
  1117. var option = meteo.c.chart.getGlobalDaysChartOption(json, "七天预报");
  1118. chart.setOption(option);
  1119. $(".content_scrollx").mCustomScrollbar('update');
  1120. } else {
  1121. $('#meteo-popup-global-bt3').hide();
  1122. $('#meteo-popup-global-chart1').hide();
  1123. }
  1124. }, function () {
  1125. $('#meteo-popup-global-bt3').hide();
  1126. })
  1127. },
  1128. setArmyFcstD: function (station, url, day) {
  1129. if (!url) {
  1130. return;
  1131. }
  1132. var par = null;
  1133. if (day) {
  1134. par = {
  1135. ldate: day,
  1136. odate: day
  1137. }
  1138. }
  1139. meteo.c.http.httpFunction(url, station, par, function (json) {
  1140. if (json.length > 0) {
  1141. $('#meteo-popup-army-bt3').show();
  1142. var chartWidth = json.length * 40;
  1143. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  1144. $('#meteo-popup-army-chart2').css('width', chartWidth); //设置宽度
  1145. var chart = meteo.c.chart.getChart('meteo-popup-army-chart2');
  1146. var option = meteo.c.chart.getChartOption(json, "七天预报");
  1147. chart.resize();
  1148. chart.setOption(option);
  1149. $(".content_scrollx").mCustomScrollbar('update');
  1150. }
  1151. }, function () {
  1152. })
  1153. },
  1154. setAutoFcstD: function (station, url, day) {
  1155. if (!url) {
  1156. return;
  1157. }
  1158. var par = null;
  1159. if (day) {
  1160. par = {
  1161. ldate: day,
  1162. odate: day
  1163. }
  1164. }
  1165. meteo.c.http.httpFunction(url, station, par, function (json) {
  1166. if (json.length > 0) {
  1167. $('#meteo-popup-auto-bt3').show();
  1168. var chartWidth = json.length * 40;
  1169. chartWidth = chartWidth < 740 ? 740 : chartWidth;
  1170. $('#meteo-popup-auto-chart2').css('width', chartWidth); //设置宽度
  1171. var chart = meteo.c.chart.getChart('meteo-popup-auto-chart2');
  1172. var option = meteo.c.chart.getChartOption(json, "七天预报");
  1173. chart.resize();
  1174. chart.setOption(option);
  1175. $(".content_scrollx").mCustomScrollbar('update');
  1176. }
  1177. }, function () {
  1178. })
  1179. },
  1180. hidePopup: function () {
  1181. $('.meteo-popup').hide();
  1182. $('.meteo-popup-surf').hide();
  1183. $('.meteo-popup-global').hide();
  1184. $('.meteo-popup-army').hide();
  1185. $('.meteo-popup-auto').hide();
  1186. },
  1187. setPopupData: function (id, data) {
  1188. var html = data ? data : "--";
  1189. $(id).html(html);
  1190. },
  1191. setTitle: function (id, name, station, ldate) {
  1192. // var html = data == 0 || data ? data + company : "--";
  1193. if (name == "undefined" || !name) name = null;
  1194. var html = name ? name + " (" + station + ")" : "(" + station + ")";
  1195. html = ldate ? html + " " + ldate : html;
  1196. $(id).html(html);
  1197. },
  1198. }
  1199. // popup.init();
  1200. // popup.initImage();
  1201. return popup;
  1202. });