index.html 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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="javascript:;" url="{:url('add')}" onclick="layer_open(this,1)" data-width="650px" data-height="450px" 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="sn" placeholder="设备编号">
  13. </div>
  14. <div class="input-group">
  15. <select name="org_id" class="form-control">
  16. <option value="">选择项目</option>
  17. {foreach $orgList as $k=>$v}
  18. <option value="{$v.id}">{$v.name}</option>
  19. {/foreach}
  20. </select>
  21. </div>
  22. <div class="input-group">
  23. <span class="input-group-btn">
  24. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  25. </span>
  26. <span class="input-group-btn">
  27. <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  28. </span>
  29. </div>
  30. </form>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="ibox-content">
  35. <div class="jqGrid_wrapper">
  36. <table id="table" style="border-collapse: collapse"></table>
  37. <div id="pager"></div>
  38. </div>
  39. </div>
  40. </div>
  41. {/block}
  42. {block name="script"}
  43. <script>
  44. $(function () {
  45. $(window).bind("resize",function(){
  46. var width=$(".jqGrid_wrapper").width();
  47. $("#table").setGridWidth(width);
  48. });
  49. $.jgrid.defaults.styleUI="Bootstrap";
  50. $("#table").jqGrid({
  51. url:"{:url('index')}",
  52. datatype: "json",
  53. colModel:[
  54. {label:'设备编号',name:'sn',index:'sn', width:60,sortable: false},
  55. {label:'所属项目',name:'org_name',index:'org_name', width:60,sortable: false},
  56. {label:'地点',name:'address',index:'address', width:60,sortable: false},
  57. {label:'创建时间',name:'create_time',index:'create_time', width:60,sortable: false},
  58. {label:'操作',width:60,sortable: false,formatter: function (a, b, c) {
  59. var clearurl = "{:url('clear',[],'')}/id/"+c.id;
  60. var reloadurl = "{:url('reload',[],'')}/id/"+c.id;
  61. var delurl = "{:url('del',[],'')}/id/"+c.id;
  62. var btn = '<a href="'+clearurl+'" class="confirm ajax-get" data-confirm="确定要清空考勤机所有记录吗?" data-table="1"><span class="label label-info" title="清空数据">清空数据</span></a>&nbsp;';
  63. btn += '<a href="'+reloadurl+'" class="confirm ajax-get" data-confirm="确定要重新导入此考勤机所有数据吗??" data-table="1"><span class="label label-success" title="重新导入">重新导入</span></a>&nbsp;';
  64. btn += '<a {if !btnAuth(session("user_auth.id"),"AttendanceMachine/del")} style="display:none"{/if} href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  65. return btn;
  66. }},
  67. ],
  68. rowNum:10,
  69. rowList:[10,20,30,50,100],
  70. pager: '#pager',
  71. sortname: 'id',
  72. viewrecords: true,
  73. autowidth:true,
  74. mtype: 'post',
  75. height: 'auto',
  76. emptyrecords: "暂无数据",
  77. sortorder: "desc",
  78. caption:"考勤机列表",
  79. loadComplete: function (xhr) {
  80. if(xhr.code==0){
  81. layer.msg(xhr.msg);
  82. return false;
  83. }
  84. },
  85. });
  86. });
  87. </script>
  88. {/block}