index.html 4.2 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')}" data-title="新增" onclick="layer_open(this,1)" class="btn btn-sm btn-primary">新增</a>
  8. <!--<a href="{:url('add')}" class="btn btn-sm btn-primary">新增</a>-->
  9. </div>
  10. <div class="col-xs-9" style="text-align: right;">
  11. <form class="form-inline" id="form-search" action="{:url('index')}">
  12. <div class="input-group">
  13. <input type="text" class="form-control" name="title" placeholder="名称">
  14. </div>
  15. <div class="input-group">
  16. <span class="input-group-btn">
  17. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  18. </span>
  19. <span class="input-group-btn">
  20. <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  21. </span>
  22. </div>
  23. </form>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="ibox-content">
  28. <div class="jqGrid_wrapper">
  29. <table id="table" style="border-collapse: collapse"></table>
  30. <div id="pager"></div>
  31. </div>
  32. </div>
  33. </div>
  34. {/block}
  35. {block name="script"}
  36. <script>
  37. $(function () {
  38. $(window).bind("resize",function(){
  39. var width=$(".jqGrid_wrapper").width();
  40. $("#table").setGridWidth(width);
  41. });
  42. $.jgrid.defaults.styleUI="Bootstrap";
  43. $("#table").jqGrid({
  44. url:"{:url('index')}",
  45. datatype: "json",
  46. colModel:[
  47. {label:'名称',name:'title',index:'title', width:60,sortable: false},
  48. {label:'考勤范围(米)',name:'distance',index:'distance', width:60,sortable: false},
  49. {label:'状态',name:'enable',index:'enable',width:50,editable: false,sortable: false,formatter:function (a,b,c){
  50. if(a == 0){
  51. var url = "{:url('changeField',[],'')}/fn/enable/fv/1/id/"+c.id;
  52. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-danger" title="禁用">禁用</span></a>';
  53. } else{
  54. var url = "{:url('changeField',[],'')}/fn/enable/fv/0/id/"+c.id;
  55. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-primary" title="正常">正常</span></a>';
  56. }
  57. }},
  58. {label:'操作',width:60,sortable: false,formatter: function (a, b, c) {
  59. var editurl = "{:url('add',[],'')}/id/"+c.id;
  60. var delurl = "{:url('del',[],'')}/id/"+c.id;
  61. // var btn = '<a href="'+editurl+'"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  62. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  63. btn += '<a {if !btnAuth(session("user_auth.id"),"AttendanceAddr/del")} style="display:none"{/if} href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  64. return btn;
  65. }},
  66. ],
  67. rowNum:10,
  68. rowList:[10,20,30,50,100],
  69. pager: '#pager',
  70. sortname: 'id',
  71. viewrecords: true,
  72. autowidth:true,
  73. mtype: 'post',
  74. height: 'auto',
  75. emptyrecords: "暂无数据",
  76. sortorder: "desc",
  77. caption:"考勤地点列表",
  78. loadComplete: function (xhr) {
  79. if(xhr.code==0){
  80. layer.msg(xhr.msg);
  81. return false;
  82. }
  83. },
  84. });
  85. });
  86. </script>
  87. {/block}