company.html 5.0 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="javascript:;" url="{:url('addcompany')}" data-title="新增人员" onclick="layer_open(this,1)" 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('company')}">
  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="rolesId" class="form-control">
  16. <option value="">选择角色</option>
  17. {volist name="roles" id="v"}
  18. <option value="{$v.id}">{$v.name}</option>
  19. {/volist}
  20. </select>
  21. </div>
  22. <div class="input-group">
  23. <select name="enable" class="form-control">
  24. <option value="">选择状态</option>
  25. <option value="0">禁用</option>
  26. <option value="1">正常</option>
  27. </select>
  28. </div>
  29. <div class="input-group">
  30. <span class="input-group-btn">
  31. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  32. </span> &nbsp;
  33. <span class="input-group-btn">
  34. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  35. </span>
  36. </div>
  37. </form>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="ibox-content">
  42. <div class="jqGrid_wrapper">
  43. <table id="table" style="border-collapse: collapse"></table>
  44. <div id="pager"></div>
  45. </div>
  46. </div>
  47. </div>
  48. {/block}
  49. {block name="script"}
  50. <script>
  51. $(function () {
  52. $(window).bind("resize",function(){
  53. var width=$(".jqGrid_wrapper").width();
  54. $("#table").setGridWidth(width);
  55. });
  56. $.jgrid.defaults.styleUI="Bootstrap";
  57. $("#table").jqGrid({
  58. url:"{:url('company')}",
  59. datatype: "json",
  60. colModel:[
  61. {label:'ID',name:'id',index:'id', width:30,sortable: false},
  62. {label:'账号',name:'account',index:'account',width:50,editable: false,sortable: false},
  63. {label:'姓名',name:'real_name',index:'real_name',width:50,editable: false,sortable: false},
  64. {label:'手机号',name:'mobile',index:'mobile',width:50,editable: false,sortable: false},
  65. {label:'角色',name:'roles_name',index:'roles_name',width:50,editable: false,sortable: false},
  66. {label:'状态',name:'enable',index:'enable',width:40,editable: false,sortable: false,formatter:function (a,b,c){
  67. if(a == 0){
  68. var url = "{:url('changeField',[],'')}/fn/enable/fv/1/id/"+c.id;
  69. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-danger" title="禁用">禁用</span></a>';
  70. } else{
  71. var url = "{:url('changeField',[],'')}/fn/enable/fv/0/id/"+c.id;
  72. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-primary" title="正常">正常</span></a>';
  73. }
  74. }},
  75. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  76. var editurl = "{:url('addcompany',[],'')}/id/"+c.id;
  77. var delurl = "{:url('del',[],'')}/id/"+c.id;
  78. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑人员" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  79. btn += '<a {if !btnAuth(session("user_auth.id"),"UserCompany/del")} style="display:none" {/if} href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  80. return btn;
  81. }},
  82. ],
  83. rowNum:10,
  84. rowList:[10,20,30,50,100],
  85. pager: '#pager',
  86. sortname: 'id',
  87. viewrecords: true,
  88. autowidth:true,
  89. mtype: 'post',
  90. height: 'auto',
  91. emptyrecords: "暂无数据",
  92. sortorder: "desc",
  93. caption:"人员列表",
  94. loadComplete: function (xhr) {
  95. if(xhr.code==0){
  96. layer.msg(xhr.msg);
  97. return false;
  98. }
  99. },
  100. });
  101. });
  102. </script>
  103. {/block}