index.html 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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)" data-width="400px" data-height="300px" 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. $(function () {
  37. $(window).bind("resize",function(){
  38. var width=$(".jqGrid_wrapper").width();
  39. $("#table").setGridWidth(width);
  40. });
  41. $.jgrid.defaults.styleUI="Bootstrap";
  42. $("#table").jqGrid({
  43. url:"{:url('index')}",
  44. datatype: "json",
  45. colModel:[
  46. {label:'编号',name:'id',index:'id', width:40,sortable: false},
  47. {label:'名称',name:'title',index:'title', width:70,sortable: false},
  48. {label:'创建时间',name:'create_time',index:'create_time',width:80,editable: false,sortable: false},
  49. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  50. var editurl = "{:url('add',[],'')}/id/"+c.id;
  51. var delurl = "{:url('del',[],'')}/id/"+c.id;
  52. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)" data-width="400px" data-height="300px"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  53. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  54. return btn;
  55. }},
  56. ],
  57. rowNum:10,
  58. rowList:[10,20,30,50,100],
  59. pager: '#pager',
  60. sortname: 'sort',
  61. viewrecords: true,
  62. autowidth:true,
  63. mtype: 'post',
  64. height: 'auto',
  65. emptyrecords: "暂无数据",
  66. sortorder: "asc",
  67. caption:"会议服务/设备",
  68. loadComplete: function (xhr) {
  69. if(xhr.code==0){
  70. layer.msg(xhr.msg);
  71. return false;
  72. }
  73. },
  74. });
  75. });
  76. </script>
  77. {/block}