index.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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-12" style="text-align: right;">
  7. <form class="form-inline" id="form-search" action="{:url('index')}">
  8. <div class="input-group">
  9. <input type="text" class="form-control" name="title" placeholder="姓名">
  10. </div>
  11. <div class="input-group">
  12. <select name="recommend" class="form-control">
  13. <option value="">是否推荐</option>
  14. <option value="0">未推荐</option>
  15. <option value="1">推荐</option>
  16. </select>
  17. </div>
  18. <div class="input-group">
  19. <select name="enable" class="form-control">
  20. <option value="">是否禁用</option>
  21. <option value="0">禁用</option>
  22. <option value="1">启用</option>
  23. </select>
  24. </div>
  25. <div class="input-group">
  26. <select name="gender" class="form-control">
  27. <option value="">性别</option>
  28. <option value="1">男</option>
  29. <option value="2">女</option>
  30. </select>
  31. </div>
  32. <div class="input-group">
  33. <span class="input-group-btn">
  34. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  35. </span>
  36. <span class="input-group-btn">
  37. <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  38. </span>
  39. <span class="input-group-btn">
  40. <button class="btn-sm btn-primary " id="js" type="button" >结算工资</button>
  41. </span>
  42. </div>
  43. </form>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="ibox-content">
  48. <div class="jqGrid_wrapper">
  49. <table id="table" style="border-collapse: collapse"></table>
  50. <div id="pager"></div>
  51. </div>
  52. </div>
  53. </div>
  54. {/block}
  55. {block name="script"}
  56. <script>
  57. $(function () {
  58. $(window).bind("resize",function(){
  59. var width=$(".jqGrid_wrapper").width();
  60. $("#table").setGridWidth(width);
  61. });
  62. $.jgrid.defaults.styleUI="Bootstrap";
  63. $("#table").jqGrid({
  64. url:"{:url('index')}",
  65. datatype: "json",
  66. colModel:[
  67. {label:'ID',name:'id',index:'id', width:30,sortable: false},
  68. {label:'图片',name:'head_image',index:'head_image',width:50,editable: false,sortable: false,formatter: function (a, b, c) {
  69. return '<img src="'+a+'" width="40" onclick="open_img(this)"></img>';
  70. }},
  71. {label:'姓名',name:'real_name',index:'real_name',width:60,editable: false,sortable: false},
  72. {label:'性别',name:'gender',index:'gender',width:50,editable: false,sortable: false,formatter:function (a,b,c){
  73. if(a == 1){
  74. return '男';
  75. } else{
  76. return '女';
  77. }
  78. }},
  79. {label:'手机号',name:'mobile',index:'mobile',width:60,editable: false,sortable: false},
  80. {label:'余额',name:'balance',index:'balance',width:50,editable: false,sortable: false},
  81. {label:'工作经验(年)',name:'work',index:'work',width:50,editable: false,sortable: false},
  82. {label:'是否推荐',name:'recommend',index:'recommend',width:50,editable: false,sortable: false,formatter:function (a,b,c){
  83. if(a == 0){
  84. return '未推荐';
  85. } else{
  86. return '推荐';
  87. }
  88. }},
  89. {label:'是否禁用',name:'enable',index:'enable',width:50,editable: false,sortable: false,formatter:function (a,b,c){
  90. if(a == 0){
  91. return '禁用';
  92. } else{
  93. return '正常';
  94. }
  95. }},
  96. ],
  97. rowNum:10,
  98. rowList:[10,20,30,50,100],
  99. pager: '#pager',
  100. sortname: 'id',
  101. viewrecords: true,
  102. autowidth:true,
  103. mtype: 'post',
  104. height: 'auto',
  105. emptyrecords: "暂无数据",
  106. sortorder: "desc",
  107. multiselect: true,//可多选
  108. caption:"工资结算",
  109. loadComplete: function (xhr) {
  110. if(xhr.code==0){
  111. layer.msg(xhr.msg);
  112. return false;
  113. }
  114. var zhZye = xhr.zhZye;
  115. $('#pager_left').html('<span style="color:red;font-size: 10px;">账户总余额:'+zhZye+' 元');
  116. },
  117. });
  118. $('#js').click(function () {
  119. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  120. if(rowIds.length <=0){
  121. updateAlert('请选择要结算护工','alert-danger');
  122. setTimeout(function(){
  123. $('#top-alert').find('button').click();
  124. },1500);
  125. return;
  126. }
  127. var b = $('#date').val();
  128. var e = $('#date1').val();
  129. $.post('/admin/Balance/js.html',{ids:rowIds},function (res) {
  130. if(res.code==0){
  131. updateAlert(res.msg,'alert-danger');
  132. setTimeout(function(){
  133. $('#top-alert').find('button').click();
  134. },1500);
  135. }else {
  136. updateAlert(res.data.msg,'alert-success');
  137. if(res.data.code==0){
  138. $("#table").trigger("reloadGrid");
  139. }else {
  140. setTimeout(function(){
  141. $('#top-alert').find('button').click();
  142. $("#table").trigger("reloadGrid");
  143. },1500);
  144. }
  145. }
  146. })
  147. })
  148. });
  149. </script>
  150. {/block}