index.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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" style="text-align: right;">
  7. <form class="form-inline" id="form-search" action="{:url('index')}">
  8. <div class="input-group">
  9. {:widget_view('common/laydate',['name'=>'start','placeholder' => '开始时间'])}
  10. </div>
  11. <div class="input-group">
  12. {:widget_view('common/laydate',['name'=>'end','placeholder' => '结束时间'])}
  13. </div>
  14. <div class="input-group">
  15. <input type="text" class="form-control" name="title" placeholder="设备名称">
  16. </div>
  17. <div class="input-group">
  18. <select name="enable" class="form-control">
  19. <option value="">选择状态</option>
  20. <option value="0">未处理</option>
  21. <option value="1">已处理</option>
  22. </select>
  23. </div>
  24. <div class="input-group">
  25. <span class="input-group-btn">
  26. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  27. </span> &nbsp;
  28. <span class="input-group-btn">
  29. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  30. </span> &nbsp;
  31. <span class="input-group-btn">
  32. <button data-url="{:url('export',[],'')}" title="导出" class="btn-sm btn-primary" onclick="excel_download(this)" type="button" ><i class="fa fa-cloud-download"></i></button>
  33. </span>
  34. </div>
  35. </form>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="ibox-content">
  40. <div class="jqGrid_wrapper">
  41. <table id="table" style="border-collapse: collapse"></table>
  42. <div id="pager"></div>
  43. </div>
  44. </div>
  45. </div>
  46. {/block}
  47. {block name="script"}
  48. <script>
  49. //导出
  50. function excel_download(_self){
  51. var url = $(_self).attr('data-url');
  52. var param = $('#form-search').serialize();
  53. window.location.href = url+'?'+param;
  54. }
  55. $(function () {
  56. $(window).bind("resize",function(){
  57. var width=$(".jqGrid_wrapper").width();
  58. $("#table").setGridWidth(width);
  59. });
  60. $.jgrid.defaults.styleUI="Bootstrap";
  61. $("#table").jqGrid({
  62. url:"{:url('index')}",
  63. datatype: "json",
  64. colModel:[
  65. {label:'设备名称',name:'security_name',security_name:'title',width:40,editable: false,sortable: false},
  66. {label:'报警时间',name:'alarm_time',index:'alarm_time',width:50,sortable: true},
  67. {label:'状态',name:'status',index:'status',width:20,editable: false,sortable: false,formatter:function (a,b,c){
  68. if(a == 0){
  69. return '<span>未处理</span>';
  70. } else{
  71. return '<span>已处理</span>';
  72. }
  73. }},
  74. {label:'处理人',name:'cf_user',index:'cf_user',width:20,sortable: true},
  75. {label:'处理时间',name:'update_time',index:'update_time',width:40,sortable: true},
  76. {label:'备注',name:'remark',index:'remark',width:40,sortable: true},
  77. {label:'操作',width:30,sortable: false,formatter: function (a, b, c) {
  78. if(c.status == 0){
  79. var editurl = "{:url('check',[],'')}/id/"+c.id;
  80. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="处理" onclick="layer_open(this,1)"><span class="label label-primary" title="处理">处理</span></a>&nbsp;';
  81. return btn;
  82. }else {
  83. return '';
  84. }
  85. }},
  86. ],
  87. rowNum:10,
  88. rowList:[10,20,30,50,100],
  89. pager: '#pager',
  90. sortname: 'sort',
  91. viewrecords: true,
  92. autowidth:true,
  93. mtype: 'post',
  94. height: 'auto',
  95. emptyrecords: "暂无数据",
  96. sortorder: "asc",
  97. caption:"{$meta_title}",
  98. loadComplete: function (xhr) {
  99. if(xhr.code==0){
  100. layer.msg(xhr.msg);
  101. return false;
  102. }
  103. },
  104. });
  105. });
  106. </script>
  107. {/block}