index.html 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. <span class="input-group-btn">
  13. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  14. </span>
  15. </div>
  16. </form>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="ibox-content">
  22. <div class="jqGrid_wrapper">
  23. <table id="table" style="border-collapse: collapse"></table>
  24. <div id="pager"></div>
  25. </div>
  26. </div>
  27. </div>
  28. {/block}
  29. {block name="script"}
  30. <script>
  31. $(function () {
  32. $(window).bind("resize",function(){
  33. var width=$(".jqGrid_wrapper").width();
  34. $("#table").setGridWidth(width);
  35. });
  36. $.jgrid.defaults.styleUI="Bootstrap";
  37. $("#table").jqGrid({
  38. url:"{:url('index')}",
  39. datatype: "json",
  40. colModel:[
  41. {label:'ID',name:'id',index:'id', width:30,sortable: false},
  42. {label:'部门',name:'dep_name',index:'dep_name',width:100,editable: false,sortable: false},
  43. {label:'负责人',name:'user_name',index:'user_name',width:100,editable: false,sortable: false},
  44. {label:'电话',name:'phone',index:'phone',width:40,sortable: true},
  45. {label:'报修地址',name:'address_title',index:'address_title',width:40,sortable: true},
  46. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  47. var editurl = "{:url('add',[],'')}/id/"+c.id;
  48. var delurl = "{:url('del',[],'')}/id/"+c.id;
  49. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  50. btn += '<a {if !btnAuth(session("user_auth.id"),"PhoneMonitor/del")} style="display:none" {/if} href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  51. return btn;
  52. }},
  53. ],
  54. rowNum:10,
  55. rowList:[10,20,30,50,100],
  56. pager: '#pager',
  57. sortname: 'id',
  58. viewrecords: true,
  59. autowidth:true,
  60. mtype: 'post',
  61. height: 'auto',
  62. emptyrecords: "暂无数据",
  63. sortorder: "asc",
  64. caption:"监控电话列表",
  65. loadComplete: function (xhr) {
  66. if(xhr.code==0){
  67. layer.msg(xhr.msg);
  68. return false;
  69. }
  70. },
  71. });
  72. });
  73. </script>
  74. {/block}