0
0

index.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. <select name="enable" class="form-control">
  16. <option value="">选择状态</option>
  17. <option value="0">禁用</option>
  18. <option value="1">正常</option>
  19. </select>
  20. </div>
  21. <div class="input-group">
  22. <select name="group_id" class="form-control">
  23. {foreach $group as $k=>$v}
  24. <option value="{$v.id}">{$v.title}</option>
  25. {/foreach}
  26. </select>
  27. </div>
  28. <div class="input-group">
  29. <span class="input-group-btn">
  30. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  31. </span>
  32. <span class="input-group-btn">
  33. <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  34. </span>
  35. </div>
  36. </form>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="ibox-content">
  41. <div class="jqGrid_wrapper">
  42. <table id="table" style="border-collapse: collapse"></table>
  43. <div id="pager"></div>
  44. </div>
  45. </div>
  46. </div>
  47. {/block}
  48. {block name="script"}
  49. <script>
  50. $(function () {
  51. $(window).bind("resize",function(){
  52. var width=$(".jqGrid_wrapper").width();
  53. $("#table").setGridWidth(width);
  54. });
  55. $.jgrid.defaults.styleUI="Bootstrap";
  56. $("#table").jqGrid({
  57. url:"{:url('index')}",
  58. datatype: "json",
  59. colModel:[
  60. {label:'编号',name:'id',index:'id', width:30,sortable: false},
  61. {label:'设备号',name:'snaddr',index:'snaddr',width:30,editable: false,sortable: false},
  62. {label:'设备名称',name:'dev_name',index:'dev_name',width:40,editable: false,sortable: false},
  63. {label:'所属分组',name:'gName',index:'gName',width:60,editable: false,sortable: false},
  64. {label:'状态',name:'enable',index:'enable',width:30,editable: false,sortable: false,
  65. formatter:function (a,b,c){
  66. if(a == 0){
  67. var url = "{:url('changeField',[],'')}/fn/enable/fv/1/id/"+c.id;
  68. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-danger" title="禁用">禁用</span></a>';
  69. } else{
  70. var url = "{:url('changeField',[],'')}/fn/enable/fv/0/id/"+c.id;
  71. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-primary" title="正常">正常</span></a>';
  72. }
  73. }},
  74. {label:'温度',name:'temp',index:'temp',width:30,editable: false,sortable: false,
  75. formatter:function (a,b,c){
  76. return '<span class="label label-primary" title="温度">'+a+'℃</span>';
  77. }},
  78. {label:'当前状态',name:'abnormal_name',index:'abnormal_name',width:50,editable: false,sortable: false},
  79. {label:'统计',width:120,sortable: false,formatter: function (a, b, c) {
  80. var tjurl1 = "{:url('tj1',[],'')}/id/"+c.snaddr;
  81. var tjurl2 = "{:url('tj2',[],'')}/id/"+c.snaddr;
  82. var tjurl3 = "{:url('tj3',[],'')}/id/"+c.snaddr;
  83. var btn = '<a onclick="layerOpen(this)" data-title="24小时温度图" url="'+tjurl1+'" href="javascript:;"><span class="label label-info" title="24小时温度图">24小时温度图</span></a>&nbsp;';
  84. btn+= '<a onclick="layerOpen(this)" data-title="7日温度图" url="'+tjurl2+'" href="javascript:;" ><span class="label label-info" title="7日温度图">7日温度图</span></a>&nbsp;';
  85. btn+= '<a onclick="layerOpen(this)" data-title="30日温度图" url="'+tjurl3+'" href="javascript:;" ><span class="label label-info" title="30日温度图">30日温度图</span></a>';
  86. return btn;
  87. }},
  88. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  89. var editurl = "{:url('add',[],'')}/id/"+c.id;
  90. var delurl = "{:url('del',[],'')}/id/"+c.id;
  91. var btn = '<a href="'+editurl+'"><span class="label label-info" title="编辑">编辑</span></a>&nbsp;';
  92. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  93. return btn;
  94. }},
  95. ],
  96. rowNum:10,
  97. rowList:[10,20,30,50,100],
  98. pager: '#pager',
  99. sortname: 'id',
  100. viewrecords: true,
  101. autowidth:true,
  102. mtype: 'post',
  103. height: 'desc',
  104. emptyrecords: "暂无数据",
  105. sortorder: "asc",
  106. caption:"设备列表",
  107. loadComplete: function (xhr) {
  108. if(xhr.code==0){
  109. layer.msg(xhr.msg);
  110. return false;
  111. }
  112. },
  113. });
  114. });
  115. </script>
  116. {/block}