index.html 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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-xs-12" >
  7. <form class="form-inline" id="form-search" action="{:url('index')}">
  8. <div class="input-group">
  9. <input style="width: 200px;" value="{$id}" type="text" class="form-control" name="imei" placeholder="设备号">
  10. </div>
  11. <div class="input-group">
  12. <input type="text" style="width: 150px;" readonly id="time" class="form-control" name="riqi" >
  13. </div>
  14. <div class="input-group">
  15. <span class="input-group-btn">
  16. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  17. </span>
  18. <span class="input-group-btn">
  19. <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  20. </span>
  21. </div>
  22. </form>
  23. </div>
  24. </div>
  25. </div>
  26. <div class="ibox-content">
  27. <div class="jqGrid_wrapper">
  28. <table id="table" style="border-collapse: collapse"></table>
  29. <div id="pager"></div>
  30. </div>
  31. </div>
  32. </div>
  33. {/block}
  34. {block name="script"}
  35. <script type="text/javascript" src="/static/layDate-v5.0.9/laydate.js"></script>
  36. <script>
  37. $(function () {
  38. laydate.render({
  39. elem: '#time'
  40. ,format: 'yyyy-MM-dd',
  41. trigger: 'click' ,
  42. });
  43. $(window).bind("resize",function(){
  44. var width=$(".jqGrid_wrapper").width();
  45. $("#table").setGridWidth(width);
  46. });
  47. $.jgrid.defaults.styleUI="Bootstrap";
  48. $("#table").jqGrid({
  49. url:"{:url('index')}",
  50. datatype: "json",
  51. colModel:[
  52. {label:'时间',name:'created_at',index:'created_at',width:40,editable: false,sortable: false},
  53. {label:'检测间隔',name:'interval',index:'interval',width:50,editable: false,sortable: false},
  54. {label:'检测次数',name:'total',index:'total',width:50,editable: false,sortable: false},
  55. {label:'深睡时长(小时)',name:'deep_sleep',index:'deep_sleep',width:50,editable: false,sortable: false},
  56. {label:'浅睡时长(小时)',name:'light_sleep',index:'light_sleep',width:50,editable: false,sortable: false},
  57. {label:'清醒时长(小时)',name:'awake_time',index:'awake_time',width:50,editable: false,sortable: false},
  58. {label:'睡眠总时长(小时)',name:'total_sleep',index:'total_sleep',width:50,editable: false,sortable: false},
  59. ],
  60. rowNum:10,
  61. rowList:[10,20,30,50,100],
  62. pager: '#pager',
  63. sortname: 'id',
  64. viewrecords: true,
  65. autowidth:true,
  66. mtype: 'post',
  67. height: 'auto',
  68. emptyrecords: "暂无数据",
  69. sortorder: "desc",
  70. caption:"睡眠数据",
  71. loadComplete: function (xhr) {
  72. if(xhr.code==0){
  73. layer.msg(xhr.msg);
  74. return false;
  75. }
  76. },
  77. });
  78. });
  79. </script>
  80. {/block}