index.html 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="ibox">
  4. <div class="ibox-content">
  5. <div class="row">
  6. <div class="col-sm-3">
  7. <a href="{$screen_url1}" target="_blank" class="btn btn-sm btn-primary">能耗大屏</a>
  8. </div>
  9. <div class="col-sm-9" style="text-align: right;">
  10. <a onclick="layerOpen(this)" data-title="近7日用电量" url="{:url('tj1',[],'')}" href="javascript:;" class="btn btn-sm btn-primary" >近7日用电量</a>&nbsp;
  11. <a onclick="layerOpen(this)" data-title="近30日用电量" url="{:url('tj2',[],'')}" href="javascript:;" class="btn btn-sm btn-primary" >近30日用电量</a>&nbsp;
  12. </div>
  13. </div>
  14. </div>
  15. <div class="ibox-content">
  16. <div class="jqGrid_wrapper">
  17. <table id="table" style="border-collapse: collapse"></table>
  18. <div id="pager"></div>
  19. </div>
  20. </div>
  21. </div>
  22. {/block}
  23. {block name="script"}
  24. <script>
  25. $(function () {
  26. $(window).bind("resize",function(){
  27. var width=$(".jqGrid_wrapper").width();
  28. $("#table").setGridWidth(width);
  29. });
  30. $.jgrid.defaults.styleUI="Bootstrap";
  31. $("#table").jqGrid({
  32. url:"{:url('index')}",
  33. datatype: "json",
  34. colModel:[
  35. {label:'数值',name:'num',index:'num',width:80,editable: false,sortable: false},
  36. {label:'时间',name:'add_time',index:'add_time',width:80,editable: false,sortable: false},
  37. // {label:'报表',width:120,sortable: false,formatter: function (a, b, c) {
  38. // var tjurl2 = "{:url('tj2',[],'')}/id/"+c.snaddr;
  39. // var tjurl3 = "{:url('tj3',[],'')}/id/"+c.snaddr;
  40. // btn+= '<a onclick="layerOpen(this)" data-title="近7日用电量" url="'+tjurl2+'" href="javascript:;" ><span class="label label-info" title="近7日用电量">近7日用电量</span></a>&nbsp;';
  41. // btn+= '<a onclick="layerOpen(this)" data-title="近30日用电量" url="'+tjurl3+'" href="javascript:;" ><span class="label label-info" title="近30日用电量">近30日用电量</span></a>';
  42. // return btn;
  43. // }},
  44. ],
  45. rowNum:10,
  46. rowList:[10,20,30,50,100],
  47. pager: '#pager',
  48. sortname: 'id',
  49. viewrecords: true,
  50. autowidth:true,
  51. mtype: 'post',
  52. height: 'auto',
  53. emptyrecords: "暂无数据",
  54. sortorder: "desc",
  55. caption:"{$meta_title}",
  56. loadComplete: function (xhr) {
  57. if(xhr.code==0){
  58. layer.msg(xhr.msg);
  59. return false;
  60. }
  61. },
  62. });
  63. });
  64. </script>
  65. {/block}