auth.html 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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_auth')}" 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('auth')}">
  11. <div class="input-group">
  12. <input type="text" class="form-control" name="title" placeholder="设备名称">
  13. </div>
  14. <div class="input-group">
  15. <input type="text" class="form-control" name="name" placeholder="用户姓名">
  16. </div>
  17. <div class="input-group">
  18. <span class="input-group-btn">
  19. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  20. </span>
  21. <span class="input-group-btn">
  22. <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  23. </span>
  24. </div>
  25. </form>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="ibox-content">
  30. <div class="jqGrid_wrapper">
  31. <table id="table" style="border-collapse: collapse"></table>
  32. <div id="pager"></div>
  33. </div>
  34. </div>
  35. </div>
  36. {/block}
  37. {block name="script"}
  38. <script>
  39. $(function () {
  40. $(window).bind("resize",function(){
  41. var width=$(".jqGrid_wrapper").width();
  42. $("#table").setGridWidth(width);
  43. });
  44. $.jgrid.defaults.styleUI="Bootstrap";
  45. $("#table").jqGrid({
  46. url:"{:url('auth')}",
  47. datatype: "json",
  48. colModel:[
  49. {label:'用户',name:'nickName',index:'nickName', width:30,sortable: false},
  50. {label:'绑定数量',name:'num',index:'num',width:40,editable: false,sortable: false},
  51. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  52. var editurl = "{:url('edit_auth',[],'')}/id/"+c.user_id;
  53. var delurl = "{:url('del_auth',[],'')}/id/"+c.user_id;
  54. var detail = "{:url('detail_auth',[],'')}/id/"+c.user_id;
  55. var btn = '<a href="'+editurl+'"><span class="label label-info" title="编辑">编辑</span></a>&nbsp;';
  56. btn += '<a href="'+detail+'"><span class="label label-info" title="查看">查看</span></a>&nbsp;';
  57. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  58. return btn;
  59. }},
  60. ],
  61. rowNum:10,
  62. rowList:[10,20,30,50,100],
  63. pager: '#pager',
  64. sortname: 'id',
  65. viewrecords: true,
  66. autowidth:true,
  67. mtype: 'post',
  68. height: 'desc',
  69. emptyrecords: "暂无数据",
  70. sortorder: "asc",
  71. caption:"权限列表",
  72. loadComplete: function (xhr) {
  73. if(xhr.code==0){
  74. layer.msg(xhr.msg);
  75. return false;
  76. }
  77. },
  78. });
  79. });
  80. </script>
  81. {/block}