index.html 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. <span class="input-group-btn">
  16. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  17. </span> &nbsp;
  18. <span class="input-group-btn">
  19. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  20. </span>
  21. </div>
  22. </form>
  23. </div>
  24. </div>
  25. </div>
  26. <div class="ibox-content">
  27. <div class="jqGrid_wrapper">
  28. <table id="table" style="border-collapse: collapse"></table>
  29. <div id="pager"></div>
  30. </div>
  31. </div>
  32. </div>
  33. {/block}
  34. {block name="script"}
  35. <script>
  36. //导出
  37. function excel_download(_self){
  38. var url = $(_self).attr('data-url');
  39. var param = $('#form-search').serialize();
  40. window.location.href = url+'?'+param;
  41. }
  42. $(function () {
  43. $(window).bind("resize",function(){
  44. var width=$(".jqGrid_wrapper").width();
  45. $("#table").setGridWidth(width);
  46. });
  47. $.jgrid.defaults.styleUI="Bootstrap";
  48. $("#table").jqGrid({
  49. url:"{:url('index')}",
  50. datatype: "json",
  51. colModel:[
  52. {label:'ID',name:'id',index:'id', width:30,sortable: false},
  53. {label:'部门',name:'dep_name',index:'dep_name',width:100,editable: false,sortable: false},
  54. {label:'维修人员',name:'real_name',index:'real_name',width:100,sortable: true},
  55. {label:'最后一次派单人',name:'last_name',index:'last_name',width:120,sortable: true},
  56. {label:'创建时间',name:'create_time',index:'create_time',width:120,sortable: true},
  57. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  58. var editurl = "{:url('add',[],'')}/id/"+c.id;
  59. var delurl = "{:url('del',[],'')}/id/"+c.id;
  60. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  61. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  62. return btn;
  63. }},
  64. ],
  65. rowNum:10,
  66. rowList:[10,20,30,50,100],
  67. pager: '#pager',
  68. sortname: 'id',
  69. viewrecords: true,
  70. autowidth:true,
  71. mtype: 'post',
  72. height: 'auto',
  73. emptyrecords: "暂无数据",
  74. sortorder: "asc",
  75. caption:"自动接单区域列表",
  76. loadComplete: function (xhr) {
  77. if(xhr.code==0){
  78. layer.msg(xhr.msg);
  79. return false;
  80. }
  81. },
  82. });
  83. });
  84. </script>
  85. {/block}