0
0

index.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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="{:url('add')}" 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="40" height="40" onclick="open_img(this)"></img>';
  34. }},
  35. {label:'模版名称',name:'title',index:'title', sortable: false},
  36. {label:'模版标识',name:'name',index:'name', sortable: false},
  37. {label:'模块数量',name:'nums',index:'nums', sortable: false},
  38. {label:'备注',name:'remark',index:'remark', sortable: false},
  39. {label:'操作',sortable: false,formatter: function (a, b, c) {
  40. var editurl = "{:url('add',[],'')}/id/"+c.id;
  41. var delurl = "{:url('del',[],'')}/id/"+c.id;
  42. var btn = '<a href="'+editurl+'"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  43. // btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  44. return btn;
  45. }},
  46. ],
  47. rowNum:10,
  48. rowList:[10,20,30,50,100],
  49. pager: '#pager',
  50. sortname: 'sort',
  51. viewrecords: true,
  52. autowidth:true,
  53. mtype: 'post',
  54. height: 'auto',
  55. emptyrecords: "暂无数据",
  56. sortorder: "asc",
  57. caption:"大屏模板列表",
  58. loadComplete: function (xhr) {
  59. if(xhr.code==0){
  60. layer.msg(xhr.msg);
  61. return false;
  62. }
  63. },
  64. });
  65. });
  66. </script>
  67. {/block}