千家信息网

带有天气预报的高大上web报表制作分享

发表于:2025-02-23 作者:千家信息网编辑
千家信息网最后更新 2025年02月23日,我用FineReport开发了挺多报表,但集成天气预报这样提高交互和人性化的还是第一次,所以跟大家分享下。这个报表是综合的门店销售管理分析面板,可以查询业绩分析、店员销售分析,店铺排行分析(可以看出是
千家信息网最后更新 2025年02月23日带有天气预报的高大上web报表制作分享

我用FineReport开发了挺多报表,但集成天气预报这样提高交互和人性化的还是第一次,所以跟大家分享下。

这个报表是综合的门店销售管理分析面板,可以查询业绩分析、店员销售分析,店铺排行分析(可以看出是个连锁店),VIP生日提醒。怎么具体制作模板,业内人士一看即明,无需多讲,就重点说下怎么集成天气吧。

先上图:


方法是加一段JS代码,具体如下:

[javascript] view plaincopy

  1. var weather=function(){

  2. var tmp=0;

  3. var SWther={w:[{}],add:{}};

  4. var SWther={};

  5. this.getWeather=function(city,type){

  6. //city=utf8ToGBK(city);

  7. /*

  8. $.getScript("http://php.weather.sina.com.cn/iframe/index/w_cl.php?code=js&day=2&city="+city+"&dfc=3",function(){if(type=='js'){echo(city);}});

  9. **/

  10. $.ajax({

  11. dataType:'script',

  12. scriptCharset:'gb2312',////////

  13. url:"http://php.weather.sina.com.cn/iframe/index/w_cl.php?code=js&day=2&city="+city+"&dfc=3",

  14. success:function(){

  15. if(type=='js'){echo(city);}

  16. }

  17. })

  18. }

  19. function dis_img(weather){

  20. var style_img="p_w_picpath/s_13.png";

  21. if(weather.indexOf("多云")!==-1||weather.indexOf("晴")!==-1){style_img="p_w_picpath/s_1.png";}

  22. else if(weather.indexOf("多云")!==-1&&weather.indexOf("阴")!==-1){style_img="p_w_picpath/s_2.png";}

  23. else if(weather.indexOf("阴")!==-1&&weather.indexOf("雨")!==-1){style_img="p_w_picpath/s_3.png";}

  24. else if(weather.indexOf("晴")!==-1&&weather.indexOf("雨")!==-1){style_img="p_w_picpath/s_12.png";}

  25. else if(weather.indexOf("晴")!==-1&&weather.indexOf("雾")!==-1){style_img="p_w_picpath/s_12.png";}

  26. else if(weather.indexOf("晴")!==-1){style_img="p_w_picpath/s_13.png";}

  27. else if(weather.indexOf("多云")!==-1){style_img="p_w_picpath/s_2.png";}

  28. else if(weather.indexOf("阵雨")!==-1){style_img="p_w_picpath/s_3.png";}

  29. else if(weather.indexOf("小雨")!==-1){style_img="p_w_picpath/s_3.png";}

  30. else if(weather.indexOf("中雨")!==-1){style_img="p_w_picpath/s_4.png";}

  31. else if(weather.indexOf("大雨")!==-1){style_img="p_w_picpath/s_5.png";}

  32. else if(weather.indexOf("暴雨")!==-1){style_img="p_w_picpath/s_5.png";}

  33. else if(weather.indexOf("冰雹")!==-1){style_img="p_w_picpath/s_6.png";}

  34. else if(weather.indexOf("雷阵雨")!==-1){style_img="p_w_picpath/s_7.png";}

  35. else if(weather.indexOf("小雪")!==-1){style_img="p_w_picpath/s_8.png";}

  36. else if(weather.indexOf("中雪")!==-1){style_img="p_w_picpath/s_9.png";}

  37. else if(weather.indexOf("大雪")!==-1){style_img="p_w_picpath/s_10.png";}

  38. else if(weather.indexOf("暴雪")!==-1){style_img="p_w_picpath/s_10.png";}

  39. else if(weather.indexOf("扬沙")!==-1){style_img="p_w_picpath/s_11.png";}

  40. else if(weather.indexOf("沙尘")!==-1){style_img="p_w_picpath/s_11.png";}

  41. else if(weather.indexOf("雾")!==-1){style_img="p_w_picpath/s_12.png";}

  42. else{style_img="p_w_picpath/s_2.png";}

  43. return style_img;};

  44. function echo(city){

  45. $('#city').html(city);

  46. $('#weather').html(window.SWther.w[city][0].s1);

  47. $('#temperature').html(window.SWther.w[city][0].t1+'°');

  48. $('#wind').html(window.SWther.w[city][0].p1);

  49. $('#direction').html(window.SWther.w[city][0].d1);

  50. var T_weather_img=dis_img(window.SWther.w[city][0].s1);

  51. $('#T_weather_img').html(""</span><span>+window.SWther.w[city][0].s1+</span><span>"
    "
    );

  52. //$('#T_temperature').html(window.SWther.w[city][0].t1+'~'+window.SWther.w[city][0].t2+'°');

  53. $('#T_temperature').html(window.SWther.w[city][0].t1);

  54. $('#T_weather').html(window.SWther.w[city][0].s1);

  55. $('#T_wind').html(window.SWther.w[city][0].p1);

  56. $('#T_direction').html(window.SWther.w[city][0].d1);

  57. $('#M_weather').html(window.SWther.w[city][1].s1);

  58. var M_weather_img=dis_img(window.SWther.w[city][1].s1);

  59. $('#M_weather_img').html(""</span><span>+window.SWther.w[city][1].s1+</span><span>"");

  60. $('#M_temperature').html(window.SWther.w[city][1].t1+'~'+window.SWther.w[city][1].t2+'°');

  61. $('#M_wind').html(window.SWther.w[city][1].p1);

  62. $('#M_direction').html(window.SWther.w[city][1].d1);

  63. $('#L_weather').html(window.SWther.w[city][2].s1);

  64. var L_weather_img=dis_img(window.SWther.w[city][2].s1);

  65. $('#L_weather_img').html(""</span><span>+window.SWther.w[city][2].s1+</span><span>"");

  66. $('#L_temperature').html(window.SWther.w[city][2].t1+'~'+window.SWther.w[city][2].t2+'°');

  67. $('#L_wind').html(window.SWther.w[city][2].p1);$('#L_direction').html(window.SWther.w[city][2].d1);

  68. }

  69. }

  70. //weather结束了

  71. function jintian(){

  72. weather_.getWeather(city,'js');

  73. };


如此,大功告成。


分析 天气 报表 销售 天气预报 制作 预报 大功告成 上图 业内 业内人士 业绩 中雨 中雪 人士 人性 代码 冰雹 大功 大雨 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 安卓手表软件开发 软件开发提供技术支持工作 如何在数据库中找到后台地址 怎么看自己绝地求生是什么服务器 我的世界花雨庭服务器从哪里进 软件开发买什么电脑比较好 管道网络安全 软件开发面试时问到职业规划 光纤通信网络技术的发展方向 计算机网络技术基础名词解释题 德阳软件开发最佳青岗科技 成都网络安全ppt 广东程序软件开发定制费用 可以扫雷的服务器 网络安全监督检查记录 苹果系统链接服务器 沈阳新华互联网科技学校简介 erp主域控制服务器有用吗 廊坊乐普网络技术有限公司 数据库老是死锁 如何连接安装好的数据库 电脑方舟怎么加不了服务器 数据库的分类有几种类型 美团服务器错误504怎么解决 如何将核心代码放到服务器 数据库表按月备份 记者探馆网络安全博览 网络安全等级保护测评机构推荐证书 提升网络技术意义 如何遍历数据库某字段
0