员工搜索
Showing
2 changed files
with
6 additions
and
67 deletions
| ... | @@ -117,6 +117,7 @@ | ... | @@ -117,6 +117,7 @@ |
| 117 | aoData.modifyUser = $('[name="modifyUser"]').val() || ''; | 117 | aoData.modifyUser = $('[name="modifyUser"]').val() || ''; |
| 118 | aoData.proposerName = $('[name="proposerName"]').val() || ''; | 118 | aoData.proposerName = $('[name="proposerName"]').val() || ''; |
| 119 | aoData.phoneNumber = $('[name="phoneNumber"]').val() || ''; | 119 | aoData.phoneNumber = $('[name="phoneNumber"]').val() || ''; |
| 120 | aoData.role = $('[name="role"]').val() || ''; | ||
| 120 | }, | 121 | }, |
| 121 | }); | 122 | }); |
| 122 | 123 | ... | ... |
| ... | @@ -7,11 +7,11 @@ | ... | @@ -7,11 +7,11 @@ |
| 7 | <div class="row cl mb-20"> | 7 | <div class="row cl mb-20"> |
| 8 | <div class="col-xs-2"> | 8 | <div class="col-xs-2"> |
| 9 | <span class="select-box"> | 9 | <span class="select-box"> |
| 10 | <select class="select table_search" size="1" column="1"> | 10 | <select class="select table_search" size="1" name="departments"> |
| 11 | <option value="" selected>网点</option> | 11 | <option value="" selected>网点</option> |
| 12 | <?php foreach ($this->session->departments as $k=>$v):?> | 12 | <?php foreach ($this->session->departments as $k=>$v):?> |
| 13 | <option value="<?=$v->id?>"><?=$v->name?></option> | 13 | <option value="<?=$v->id?>"><?=$v->name?></option> |
| 14 | <?php if($v->children && !empty($v->children)):?> | 14 | <?php if($v->children && !empty($v->children)):?> |
| 15 | <?php foreach ($v->children as $kk=>$vv):?> | 15 | <?php foreach ($v->children as $kk=>$vv):?> |
| 16 | <option value="<?=$vv->id?>"> <?=$vv->name?></option> | 16 | <option value="<?=$vv->id?>"> <?=$vv->name?></option> |
| 17 | <?php endforeach;?> | 17 | <?php endforeach;?> |
| ... | @@ -22,7 +22,7 @@ | ... | @@ -22,7 +22,7 @@ |
| 22 | </div> | 22 | </div> |
| 23 | <div class="col-xs-2"> | 23 | <div class="col-xs-2"> |
| 24 | <span class="select-box"> | 24 | <span class="select-box"> |
| 25 | <select class="select table_search" size="1" column="2"> | 25 | <select class="select table_search" size="1" column="2" name="role"> |
| 26 | <option value="" selected>角色</option> | 26 | <option value="" selected>角色</option> |
| 27 | <?php foreach ($this->session->role as $k=>$v):?> | 27 | <?php foreach ($this->session->role as $k=>$v):?> |
| 28 | <option value="<?=$v->id?>"><?=$v->nameZh?></option> | 28 | <option value="<?=$v->id?>"><?=$v->nameZh?></option> |
| ... | @@ -32,13 +32,14 @@ | ... | @@ -32,13 +32,14 @@ |
| 32 | </div> | 32 | </div> |
| 33 | </div> | 33 | </div> |
| 34 | <div> | 34 | <div> |
| 35 | <button class="btn btn-primary radius" type="button" onclick="$('#table').DataTable().draw()">搜索</button> | ||
| 35 | <input class="btn btn-warning radius" type="reset" value="重置搜索"> | 36 | <input class="btn btn-warning radius" type="reset" value="重置搜索"> |
| 36 | <button class="btn btn-primary radius" type="button" onclick="add()">添加员工</button> | 37 | <button class="btn btn-primary radius" type="button" onclick="add()">添加员工</button> |
| 37 | </div> | 38 | </div> |
| 38 | </form> | 39 | </form> |
| 39 | 40 | ||
| 40 | <div class="body mt-20"> | 41 | <div class="body mt-20"> |
| 41 | <table class="table table-border table-bordered table-bg" id="table"> | 42 | <table class="table table-border table-bordered table-bg" id="table" url="system/user/getAllHr"> |
| 42 | <thead class="text-c"> | 43 | <thead class="text-c"> |
| 43 | <tr> | 44 | <tr> |
| 44 | <th width="68px">操作</th> | 45 | <th width="68px">操作</th> |
| ... | @@ -61,36 +62,6 @@ | ... | @@ -61,36 +62,6 @@ |
| 61 | 62 | ||
| 62 | <script> | 63 | <script> |
| 63 | var table = $('#table').dataTable({ | 64 | var table = $('#table').dataTable({ |
| 64 | aaSorting: [[1, "desc"]], | ||
| 65 | serverSide: true, | ||
| 66 | processing: true, | ||
| 67 | bSort: false, | ||
| 68 | searching: false,//是否显示搜索 | ||
| 69 | iDisplayLength: 6, | ||
| 70 | bLengthChange: false, | ||
| 71 | ajax: { | ||
| 72 | url: apiBaseUrl + 'system/user/getAllHr', | ||
| 73 | dataFilter: function (json) { | ||
| 74 | var ret = {}, json = jQuery.parseJSON(json); | ||
| 75 | ret.data = json.data || []; | ||
| 76 | var draw = getUrlParam('draw'); | ||
| 77 | if(draw) { | ||
| 78 | ret.draw = draw; | ||
| 79 | } | ||
| 80 | ret.recordsTotal = 0; | ||
| 81 | ret.recordsFiltered = 0; | ||
| 82 | if (json.page) { | ||
| 83 | ret.recordsTotal = parseInt(json.page.totalNumber); | ||
| 84 | ret.recordsFiltered = parseInt(json.page.totalNumber); | ||
| 85 | } | ||
| 86 | return JSON.stringify(ret); | ||
| 87 | }, | ||
| 88 | data: function (data) { | ||
| 89 | data.pageSize = data.length; | ||
| 90 | data.currentPage = parseFloat(data.start / data.length) + 1; | ||
| 91 | return data; | ||
| 92 | } | ||
| 93 | }, | ||
| 94 | columns: [ | 65 | columns: [ |
| 95 | { | 66 | { |
| 96 | data: "id", render: function (data, type, full) { | 67 | data: "id", render: function (data, type, full) { |
| ... | @@ -118,39 +89,6 @@ | ... | @@ -118,39 +89,6 @@ |
| 118 | {data: "remark"},//备注 | 89 | {data: "remark"},//备注 |
| 119 | ] | 90 | ] |
| 120 | }); | 91 | }); |
| 121 | $.fn.dataTableExt.afnFiltering.push( | ||
| 122 | function (oSettings, aData, iDataIndex) { | ||
| 123 | var min = document.getElementById('min').value; | ||
| 124 | var max = document.getElementById('max').value; | ||
| 125 | var iDateCol = 12; | ||
| 126 | |||
| 127 | var dateMin = new Date(aData[iDateCol]); | ||
| 128 | var dateMax = new Date(aData[iDateCol]); | ||
| 129 | |||
| 130 | if (min === '' && max === '') | ||
| 131 | return true; | ||
| 132 | else if (new Date(min).getTime() <= dateMin.getTime() && max === '') | ||
| 133 | return true; | ||
| 134 | else if (new Date(min).getTime() <= dateMin.getTime() && new Date(max).getTime() >= dateMax.getTime()) | ||
| 135 | return true; | ||
| 136 | return false; | ||
| 137 | } | ||
| 138 | ); | ||
| 139 | |||
| 140 | $('.table_search').on('change', function () { | ||
| 141 | search = $(this).val(); | ||
| 142 | column = $(this).attr('column'); | ||
| 143 | |||
| 144 | $('#table').DataTable().column(column).search(search).draw(); | ||
| 145 | }); | ||
| 146 | |||
| 147 | $('#min, #max').on('keyup', function () { | ||
| 148 | $('#table').DataTable().draw(); | ||
| 149 | }); | ||
| 150 | |||
| 151 | function resetHandler() { | ||
| 152 | $('#table').DataTable().columns().search("").draw(); | ||
| 153 | } | ||
| 154 | 92 | ||
| 155 | function add() { | 93 | function add() { |
| 156 | layer_show('添加员工', '<?=site_url('perm/staffAdd');?>'); | 94 | layer_show('添加员工', '<?=site_url('perm/staffAdd');?>'); | ... | ... |
-
Please register or sign in to post a comment