index.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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="recommend" class="form-control">
  16. <option value="">是否推荐</option>
  17. <option value="0">未推荐</option>
  18. <option value="1">推荐</option>
  19. </select>
  20. </div>
  21. <div class="input-group">
  22. <select name="enable" class="form-control">
  23. <option value="">是否禁用</option>
  24. <option value="0">禁用</option>
  25. <option value="1">启用</option>
  26. </select>
  27. </div>
  28. <div class="input-group">
  29. <select name="gender" class="form-control">
  30. <option value="">性别</option>
  31. <option value="1">男</option>
  32. <option value="2">女</option>
  33. </select>
  34. </div>
  35. <div class="input-group">
  36. <span class="input-group-btn">
  37. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  38. </span>
  39. <span class="input-group-btn">
  40. <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></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. var url = "{:url('changeField',[],'')}/fn/recommend/fv/1/id/"+c.id;
  85. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-danger" title="未推荐">未推荐</span></a>';
  86. } else{
  87. var url = "{:url('changeField',[],'')}/fn/recommend/fv/0/id/"+c.id;
  88. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-primary" title="推荐">推荐</span></a>';
  89. }
  90. }},
  91. {label:'是否禁用',name:'enable',index:'enable',width:50,editable: false,sortable: false,formatter:function (a,b,c){
  92. if(a == 0){
  93. var url = "{:url('changeField',[],'')}/fn/enable/fv/1/id/"+c.user_id;
  94. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-danger" title="禁用">禁用</span></a>';
  95. } else{
  96. var url = "{:url('changeField',[],'')}/fn/enable/fv/0/id/"+c.user_id;
  97. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-primary" title="正常">正常</span></a>';
  98. }
  99. }},
  100. {label:'操作',width:180,sortable: false,formatter: function (a, b, c) {
  101. var editurl = "{:url('add',[],'')}/id/"+c.user_id;
  102. var delurl = "{:url('del',[],'')}/id/"+c.user_id;
  103. var edit_money = "{:url('edit_money',[],'')}/id/"+c.id;
  104. var js_money = "{:url('js_money',[],'')}/id/"+c.id;
  105. var ye_log = "{:url('ye_log',[],'')}/id/"+c.id;
  106. // var btn = '<a href="'+editurl+'"><span class="label label-info" title="编辑">编辑</span></a>&nbsp;';
  107. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  108. btn += '<a {if !btnAuth(session("user_auth.id"),"Worker/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;';
  109. //btn+= '<a href="'+edit_money+'"><span class="label label-info" title="修改余额">修改余额</span></a>&nbsp;';
  110. btn+= '<a url="'+edit_money+'" href="javascript:;" data-title="修改余额" onclick="layer_open(this,1)"><span class="label label-info" title="修改余额">修改余额</span></a>&nbsp;';
  111. if(c.balance>0){
  112. btn += '<a href="'+js_money+'" class="confirm ajax-get" data-confirm="确定要结算该护工工资吗?" data-table="1"><span class="label label-info" title="工资结算">工资结算</span></a>&nbsp;';
  113. }
  114. // btn+= '<a href="'+ye_log+'"><span class="label label-info" title="余额记录">余额记录</span></a>';
  115. btn+= '<a url="'+ye_log+'" href="javascript:;" data-title="余额记录" onclick="layer_open(this,1)"><span class="label label-info" title="余额记录">余额记录</span></a>&nbsp;';
  116. return btn;
  117. }},
  118. ],
  119. rowNum:10,
  120. rowList:[10,20,30,50,100],
  121. pager: '#pager',
  122. sortname: 'id',
  123. viewrecords: true,
  124. autowidth:true,
  125. mtype: 'post',
  126. height: 'auto',
  127. emptyrecords: "暂无数据",
  128. sortorder: "desc",
  129. caption:"护工列表",
  130. loadComplete: function (xhr) {
  131. if(xhr.code==0){
  132. layer.msg(xhr.msg);
  133. return false;
  134. }
  135. var zhZye = xhr.zhZye;
  136. $('#pager_left').html('<span style="color:red;font-size: 10px;">账户总余额:'+zhZye+' 元');
  137. },
  138. });
  139. });
  140. </script>
  141. {/block}