index.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. </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="title" placeholder="名称">
  13. </div>
  14. <!-- <div class="input-group">-->
  15. <!-- <select name="status" class="form-control">-->
  16. <!-- <option value="">选择状态</option>-->
  17. <!-- <option value="0">待审核</option>-->
  18. <!-- <option value="1">已通过</option>-->
  19. <!-- <option value="2">未通过</option>-->
  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> &nbsp;
  26. <span class="input-group-btn">
  27. <button class="btn-sm btn-warning" 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:'real_name',index:'real_name', width:60,sortable: false},
  55. {label:'开始时间',name:'start_time',index:'v',width:80,editable: false,sortable: false},
  56. {label:'结束时间',name:'end_time',index:'end_time',width:80,sortable: true},
  57. // {label:'状态',name:'status',index:'status',width:40,editable: false,sortable: false,formatter:function (a,b,c){
  58. // if(a == 0){
  59. // return '<span class="label label-default">待审核</span>';
  60. // }else if(a == 1){
  61. // return '<span class="label label-success">已通过</span>';
  62. // }else if(a == 2){
  63. // return '<span class="label label-danger">未通过</span>';
  64. // }
  65. // }},
  66. {label:'请假类型',name:'leave_type',index:'leave_type',width:40,editable: false,sortable: false,formatter:function (a,b,c){
  67. if(a == 1){
  68. return '<span>事假</span>';
  69. }else if(a == 2){
  70. return '<span>病假</span>';
  71. }else if(a == 3){
  72. return '<span>年假</span>';
  73. }else if(a == 4){
  74. return '<span>婚假</span>';
  75. }else if(a == 5){
  76. return '<span>产假</span>';
  77. }else if(a == 6){
  78. return '<span>丧假</span>';
  79. }
  80. }},
  81. {label:'请假天数',name:'days',index:'days',width:40,sortable: true},
  82. {label:'实际请假天数',name:'cur_days',index:'cur_days',width:40,sortable: true},
  83. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  84. var editurl = "{:url('add',[],'')}/id/"+c.id;
  85. var delurl = "{:url('del',[],'')}/id/"+c.id;
  86. var checkurl = "{:url('check',[],'')}/id/"+c.id;
  87. // var btn = '<a href="'+editurl+'"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  88. // btn += '<a url="'+checkurl+'" href="javascript:;" onclick="layer_open(this,1)" data-height="350px" data-width="500px"><span class="label label-success" title="审核">审核</span></a>&nbsp;';
  89. var btn = '<a {if !btnAuth(session("user_auth.id"),"AttendanceLeave/del")} style="display:none"{/if} href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  90. return btn;
  91. }},
  92. ],
  93. rowNum:10,
  94. rowList:[10,20,30,50,100],
  95. pager: '#pager',
  96. sortname: 'sort',
  97. viewrecords: true,
  98. autowidth:true,
  99. mtype: 'post',
  100. height: 'auto',
  101. emptyrecords: "暂无数据",
  102. sortorder: "asc",
  103. caption:"请假记录列表",
  104. loadComplete: function (xhr) {
  105. if(xhr.code==0){
  106. layer.msg(xhr.msg);
  107. return false;
  108. }
  109. },
  110. });
  111. });
  112. </script>
  113. {/block}