index.html 2.7 KB

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