123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- {extend name="common/common2" /}
- {block name="main"}
- <div class="ibox">
- <div class="ibox-content">
- <div class="row">
- <div class="col-xs-3">
- <a href="javascript:;" onclick="batchSorts()" class="btn btn-sm btn-warning">保存排序</a>
- <a href="{:url('remove')}" class="btn ajax-get btn-sm btn-danger">清理缓存</a>
- </div>
- <div class="col-xs-9" style="text-align: right;">
- <form class="form-inline" id="form-search" action="{:url('index')}">
- <div class="input-group">
- <input type="text" class="form-control" name="title" placeholder="账号/姓名/手机号">
- </div>
- <div class="input-group" style="overflow: hidden;width: 120px;">
- {:widget_view('common/select',['name'=>'depId','lists' => $deps, 'value' => ''])}
- </div>
- <div class="input-group">
- <span class="input-group-btn">
- <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
- </span>
- <span class="input-group-btn">
- <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
- </span>
- </div>
- </form>
- </div>
- </div>
- </div>
- <div class="ibox-content">
- <div class="jqGrid_wrapper">
- <table id="table" style="border-collapse: collapse"></table>
- <div id="pager"></div>
- </div>
- </div>
- </div>
- {/block}
- {block name="script"}
- <script>
- $(function () {
- $(window).bind("resize",function(){
- var width=$(".jqGrid_wrapper").width();
- $("#table").setGridWidth(width);
- });
- $.jgrid.defaults.styleUI="Bootstrap";
- $("#table").jqGrid({
- url:"{:url('index')}",
- datatype: "json",
- colModel:[
- {label:'ID',name:'id',index:'id', width:60,sortable: false},
- {label:'排序(正序)',name:'sorts',index:'sorts',width:120,sortable: true,formatter: function (a, b, c) {
- return '<input type="number" class="form-control input-sm usersorts" data-id="'+c.id+'" data-old="'+a+'" value="'+a+'" />';
- }},
- {label:'上一次排序',name:'old_sorts',index:'old_sorts',width:100,editable: false,sortable: false},
- {label:'是否是最后一次派单人',name:'is_last',index:'is_last',width:140,sortable: true,formatter: function (a, b, c) {
- if(a){
- return '<span style="color: #387aff">是</span>';
- }else {
- return '否';
- }
- }},
- {label:'状态',name:'enable_sorts',index:'enable_sorts',width:80,editable: false,sortable: false,formatter:function (a,b,c){
- if(a == 0){
- var url = "{:url('changeField',[],'')}/fn/enable_sorts/fv/1/id/"+c.id;
- return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-danger" title="禁用">禁用</span></a>';
- } else{
- var url = "{:url('changeField',[],'')}/fn/enable_sorts/fv/0/id/"+c.id;
- return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-primary" title="正常">正常</span></a>';
- }
- }},
- {label:'账号',name:'account',index:'account',width:100,editable: false,sortable: false},
- {label:'姓名',name:'real_name',index:'real_name',width:100,editable: false,sortable: false},
- {label:'手机号',name:'mobile',index:'mobile',width:150,editable: false,sortable: false},
- {label:'所在部门',name:'dep_name',index:'dep_name',width:100,editable: false,sortable: false},
- {label:'角色',name:'roles_name',index:'roles_name',width:100,editable: false,sortable: false},
- {label:'报修类型',name:'type_name',index:'type_name',width:100,editable: false,sortable: false},
- ],
- rowNum:10,
- rowList:[10,20,30,50,100],
- pager: '#pager',
- sortname: 'id',
- viewrecords: true,
- autowidth:true,
- autoScroll: false,
- shrinkToFit: true,
- mtype: 'post',
- height: 'auto',
- emptyrecords: "暂无数据",
- sortorder: "desc",
- caption:"人员排序列表",
- loadComplete: function (xhr) {
- if(xhr.code==0){
- layer.msg(xhr.msg);
- return false;
- }
- },
- });
- /*固定表头及侧边*/
- // $("#table").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "auto" });
- // $("#table").jqGrid('setFrozenColumns');
- });
- function batchSorts() {
- let data = [];
- $('.usersorts').each(function(){
- data.push({
- id: $(this).attr('data-id'),
- sort: $(this).val(),
- })
- });
- let url = "{:url('UserSorts/batchSorts')}";
- $.post(url,{data:JSON.stringify(data)},function (res) {
- if(res.code == 1){
- updateAlert('操作成功','alert-success');
- setTimeout(function(){
- $('#top-alert').find('button').click();
- },1500);
- $("#table").trigger("reloadGrid");
- }else{
- updateAlert(data.msg,'alert-danger');
- setTimeout(function(){
- $('#top-alert').find('button').click();
- },1500);
- }
- });
- }
- </script>
- {/block}
|