index.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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="80%" data-height="80%" class="btn btn-sm btn-primary">新增</a>
  8. </div>
  9. </div>
  10. </div>
  11. <div class="ibox-content">
  12. <div class="jqGrid_wrapper">
  13. <table id="table" style="border-collapse: collapse"></table>
  14. <div id="pager"></div>
  15. </div>
  16. </div>
  17. </div>
  18. {/block}
  19. {block name="script"}
  20. <script>
  21. $(function () {
  22. $(window).bind("resize",function(){
  23. var width=$(".jqGrid_wrapper").width();
  24. $("#table").setGridWidth(width);
  25. });
  26. $.jgrid.defaults.styleUI="Bootstrap";
  27. $("#table").jqGrid({
  28. url:"{:url('index')}",
  29. datatype: "json",
  30. colModel:[
  31. {label:'编号',name:'id',index:'id', sortable: false},
  32. {label:'封面图',name:'img',index:'img',editable: false,sortable: false,formatter: function (a, b, c) {
  33. return '<img src="'+a+'" width="60" onclick="open_img(this)"></img>';
  34. }},
  35. {label:'模块名称',name:'title',index:'title', sortable: false},
  36. {label:'模块标识',name:'name',index:'name', sortable: false},
  37. {label:'操作',sortable: false,formatter: function (a, b, c) {
  38. var editurl = "{:url('add',[],'')}/id/"+c.id;
  39. var delurl = "{:url('del',[],'')}/id/"+c.id;
  40. var btn = '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)" data-width="80%" data-height="80%"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  41. // btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  42. return btn;
  43. }},
  44. ],
  45. rowNum:10,
  46. rowList:[10,20,30,50,100],
  47. pager: '#pager',
  48. sortname: 'sort',
  49. viewrecords: true,
  50. autowidth:true,
  51. mtype: 'post',
  52. height: 'auto',
  53. emptyrecords: "暂无数据",
  54. sortorder: "asc",
  55. caption:"大屏模块列表",
  56. loadComplete: function (xhr) {
  57. if(xhr.code==0){
  58. layer.msg(xhr.msg);
  59. return false;
  60. }
  61. },
  62. });
  63. });
  64. </script>
  65. {/block}