index.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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-3">
  7. <a href="{:url('add')}" class="btn btn-sm btn-primary">新增</a>
  8. </div>
  9. <div class="col-xs-9" style="text-align: right;">
  10. <form class="form-inline" id="form-search" action="{:url('index')}">
  11. <div class="input-group">
  12. <input type="text" class="form-control" name="title" placeholder="昵称">
  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>
  36. $(function () {
  37. $(window).bind("resize",function(){
  38. var width=$(".jqGrid_wrapper").width();
  39. $("#table").setGridWidth(width);
  40. });
  41. $.jgrid.defaults.styleUI="Bootstrap";
  42. $("#table").jqGrid({
  43. url:"{:url('index')}",
  44. datatype: "json",
  45. colModel:[
  46. {label:'设备号',name:'imei',index:'imei', width:50,sortable: false},
  47. {label:'昵称',name:'nickname',index:'nickname',width:50,editable: false,sortable: false},
  48. {label:'状态',name:'online',index:'online',width:50,editable: false,sortable: false},
  49. {label:'创建时间',name:'create_time',index:'create_time',width:50,editable: false,sortable: false},
  50. {label:'设备记录',name:'icon',index:'icon',width:60,editable: false,sortable: false,formatter:function (a,b,c){
  51. var number = "{:url('number',[],'')}/id/"+c.imei;
  52. var btn= '<a href="'+number+'"><span class="label label-success" title="亲情号码"><span class="glyphicon glyphicon-earphone"></span></span></a>';
  53. return btn;
  54. }},
  55. {label:'详情',name:'jk',index:'jk',width:100,editable: false,sortable: false,formatter:function (a,b,c){
  56. var xin = "/admin/Xinlv/index.html?id="+c.imei;
  57. var bu = "/admin/Bushu/index.html?id="+c.imei;
  58. var shui = "/admin/Shui/index.html?id="+c.imei;
  59. var jiu = "/admin/Jiu/index.html?id="+c.imei;
  60. var gui = "/admin/Gui/index.html?id="+c.imei;
  61. var xueya = "/admin/Xueya/index.html?id="+c.imei;
  62. var xueyang = "/admin/Xueyang/index.html?id="+c.imei;
  63. var btn = '<a onclick="layerOpen(this)" data-title="心率" url="'+xin+'" href="javascript:;"><span class="label label-warning" title="心率">心</span></a>&nbsp;';
  64. btn+= '<a onclick="layerOpen(this)" data-title="步数" url="'+bu+'" href="javascript:;" ><span class="label label-success" title="计步">步</span></a>&nbsp;';
  65. btn+= '<a onclick="layerOpen(this)" data-title="睡眠" url="'+shui+'" href="javascript:;" ><span class="label label-primary" title="睡眠">睡</span></a>&nbsp;';
  66. btn+= '<a onclick="layerOpen(this)" data-title="呼救" url="'+jiu+'" href="javascript:;"><span class="label label-danger" title="呼叫">救</span></a>&nbsp;';
  67. btn+= '<a onclick="layerOpen(this)" data-title="轨迹" url="'+gui+'" href="javascript:;"><span class="label label-info" title="轨迹">轨</span></a>&nbsp;';
  68. btn+= '<a onclick="layerOpen(this)" data-title="血压" url="'+xueya+'" href="javascript:;"><span class="label label-info" title="血压">压</span></a>&nbsp;';
  69. btn+= '<a onclick="layerOpen(this)" data-title="血氧" url="'+xueyang+'" href="javascript:;"><span class="label label-info" title="血氧">氧</span></a>';
  70. return btn;
  71. }},
  72. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  73. var delurl = "{:url('del',[],'')}/id/"+c.id;
  74. var editurl = "{:url('add',[],'')}/id/"+c.id;
  75. var btn = '<a href="'+editurl+'"><span class="label label-info" title="编辑">编辑</span></a>&nbsp;';
  76. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  77. return btn;
  78. }},
  79. ],
  80. rowNum:10,
  81. rowList:[10,20,30,50,100],
  82. pager: '#pager',
  83. sortname: 'id',
  84. viewrecords: true,
  85. autowidth:true,
  86. mtype: 'post',
  87. height: 'auto',
  88. emptyrecords: "暂无数据",
  89. sortorder: "desc",
  90. caption:"设备列表",
  91. loadComplete: function (xhr) {
  92. if(xhr.code==0){
  93. layer.msg(xhr.msg);
  94. return false;
  95. }
  96. },
  97. });
  98. });
  99. </script>
  100. {/block}