index.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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-4">
  7. <a href="javascript:;" class="btn btn-sm batch-finish btn-danger">批量删除</a>
  8. </div>
  9. <div class="col-xs-8" 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. {:widget_view('common/month',['name'=>'month', 'val' =>$month])}
  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> &nbsp;
  21. <span class="input-group-btn">
  22. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  23. </span>&nbsp;
  24. <span class="input-group-btn">
  25. <button class="btn-sm btn-primary" {if !btnAuth(session("user_auth.id"),"AttendancePunchRecord/import")} style="display:none" {/if} type="button" url="{:url('import')}" data-title="批量导入" onclick="layer_open(this,1)">导入</button>
  26. </span>&nbsp;
  27. <span class="input-group-btn">
  28. <button data-url="{:url('export',[],'')}" title="导出" class="btn-sm btn-primary" onclick="excel_download(this)" type="button" ><i class="fa fa-cloud-download"></i></button>
  29. </span>
  30. </div>
  31. </form>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="ibox-content">
  36. <div class="jqGrid_wrapper">
  37. <table id="table" style="border-collapse: collapse"></table>
  38. <div id="pager"></div>
  39. </div>
  40. </div>
  41. </div>
  42. {/block}
  43. {block name="script"}
  44. <script>
  45. //导出
  46. function excel_download(_self){
  47. var url = $(_self).attr('data-url');
  48. var param = $('#form-search').serialize();
  49. window.location.href = url+'?'+param;
  50. }
  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('index')}",
  59. datatype: "json",
  60. colModel:[
  61. // {label:'序号',name:'k',index:'k', width:20,sortable: false},
  62. {label:'项目',name:'org_name',index:'org_name',width:30,editable: false,sortable: false},
  63. {label:'部门',name:'dep_name',index:'dep_name',width:30,editable: false,sortable: false},
  64. {label:'打卡人员',name:'user_name',index:'user_name',width:30,editable: false,sortable: false},
  65. {label:'打卡方式',name:'way',index:'way',width:30,editable: false,sortable: false},
  66. {label:'班次',name:'class_content',index:'class_content',width:30,editable: false,sortable: false},
  67. {label:'打卡日期',name:'date',index:'date',width:40,sortable: false},
  68. {label:'打卡时间',name:'time',index:'time',width:40,sortable: false},
  69. {label:'打卡地点',name:'address',index:'address',width:60,sortable: true},
  70. {label:'打卡设备识别码',name:'device_sn',index:'device_sn',width:60,sortable: true},
  71. {label:'操作',width:30,sortable: false,formatter: function (a, b, c) {
  72. var delurl = "{:url('del',[],'')}/id/"+c.id;
  73. var btn = '<a {if !btnAuth(session("user_auth.id"),"AttendancePunchRecord/del")} style="display:none" {/if} href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>&nbsp;';
  74. // btn += '<a href="'+downImg+'" class="ajax-get"><span class="label label-primary" title="下载">下载</span></a>';
  75. return btn;
  76. }},
  77. ],
  78. rowNum:10,
  79. rowList:[10,20,30,50,100],
  80. pager: '#pager',
  81. sortname: 'id',
  82. viewrecords: true,
  83. autowidth:true,
  84. mtype: 'post',
  85. height: 'auto',
  86. emptyrecords: "暂无数据",
  87. sortorder: "desc",
  88. caption:"打卡记录列表",
  89. multiselect: true,//可多选
  90. loadComplete: function (xhr) {
  91. if(xhr.code==0){
  92. layer.msg(xhr.msg);
  93. return false;
  94. }
  95. },
  96. });
  97. });
  98. $('.batch-finish').click(function () {
  99. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  100. if(rowIds.length==0){
  101. layer.msg("请选择记录");
  102. return;
  103. }
  104. layer.confirm('是否要删除记录吗?', {
  105. btn: ['确认', '取消'], //按钮
  106. shade: false //不显示遮罩
  107. }, function() {
  108. $.post('{:url("delAll")}',{ids:rowIds},function (res) {
  109. if(res.code==0){
  110. layer.msg(res.msg);
  111. return;
  112. }else {
  113. layer.msg(res.msg,{time:2000},function () {
  114. $('#top-alert').find('button').click();
  115. $("#table").trigger("reloadGrid");
  116. })
  117. }
  118. },'json')
  119. }, function() {
  120. layer.closeAll();
  121. });
  122. })
  123. </script>
  124. {/block}