index.html 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 url="{:url('add')}" href="javascript:;" data-title="新增" onclick="layer_open(this,1)" class="btn btn-sm btn-primary">新增</a>
  8. <!--<a href="{:url('add')}" class="btn btn-sm btn-primary">新增</a>-->
  9. </div>
  10. <div class="col-xs-9" style="text-align: right;">
  11. <form class="form-inline" id="form-search" action="{:url('index')}">
  12. <div class="input-group">
  13. <input type="text" class="form-control" name="title" placeholder="标题名称">
  14. </div>
  15. <div class="input-group">
  16. <select name="cateId" class="form-control">
  17. <option value="">选择类型</option>
  18. {foreach $cate as $k=>$v}
  19. <option value="{$v.id}">{$v.name}</option>
  20. {/foreach}
  21. </select>
  22. </div>
  23. <div class="input-group">
  24. <span class="input-group-btn">
  25. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  26. </span>
  27. <span class="input-group-btn">
  28. <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  29. </span>
  30. </div>
  31. </form>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="ibox-content">
  36. <div class="jqGrid_wrapper">
  37. <table id="table" style="border-collapse: collapse"></table>
  38. <div id="pager"></div>
  39. </div>
  40. </div>
  41. </div>
  42. {/block}
  43. {block name="script"}
  44. <script>
  45. $(function () {
  46. $(window).bind("resize",function(){
  47. var width=$(".jqGrid_wrapper").width();
  48. $("#table").setGridWidth(width);
  49. });
  50. $.jgrid.defaults.styleUI="Bootstrap";
  51. $("#table").jqGrid({
  52. url:"{:url('index')}",
  53. datatype: "json",
  54. colModel:[
  55. {label:'编号',name:'id',index:'id', width:40,sortable: false},
  56. {label:'通知标题',name:'title',index:'title', width:60,sortable: false},
  57. {label:'通知类型',name:'notice_cate',index:'notice_cate', width:60,sortable: false},
  58. {label:'创建人',name:'create_user',index:'create_user', width:60,sortable: false},
  59. {label:'发布时间',name:'create_time',index:'create_time', width:60,sortable: false},
  60. {label:'操作',width:60,sortable: false,formatter: function (a, b, c) {
  61. var delurl = "{:url('del',[],'')}/id/"+c.id;
  62. var detailsurl = "{:url('details',[],'')}/id/"+c.id;
  63. var btn= '<a url="'+detailsurl+'" href="javascript:;" data-title="详情" onclick="layer_open(this,1)"><span class="label label-info" title="详情">详情</span></a>&nbsp;';
  64. // var btn = '<a href="'+detailsurl+'"><span class="label label-info" title="详情">详情</span></a>&nbsp;'
  65. btn += '<a {if !btnAuth(session("user_auth.id"),"NoticeCommon/del")} style="display:none"{/if} href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  66. return btn;
  67. }},
  68. ],
  69. rowNum:10,
  70. rowList:[10,20,30,50,100],
  71. pager: '#pager',
  72. sortname: 'id',
  73. viewrecords: true,
  74. autowidth:true,
  75. mtype: 'post',
  76. height: 'auto',
  77. emptyrecords: "暂无数据",
  78. sortorder: "desc",
  79. caption:"通知公告列表",
  80. loadComplete: function (xhr) {
  81. if(xhr.code==0){
  82. layer.msg(xhr.msg);
  83. return false;
  84. }
  85. },
  86. });
  87. });
  88. </script>
  89. {/block}