index.html 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. </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:'ver',index:'ver', width:30,sortable: false},
  32. {label:'更新内容',name:'content',index:'content',width:150,editable: false,sortable: false},
  33. {label:'更新时间',name:'create_time',index:'create_time',width:40,sortable: true},
  34. {label:'状态',name:'enable',index:'enable',width:40,editable: false,sortable: false,formatter:function (a,b,c){
  35. if(a == 0){
  36. var url = "{:url('changeField',[],'')}/fn/enable/fv/1/id/"+c.id;
  37. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-danger" title="禁用">禁用</span></a>';
  38. } else{
  39. var url = "{:url('changeField',[],'')}/fn/enable/fv/0/id/"+c.id;
  40. return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-primary" title="正常">正常</span></a>';
  41. }
  42. }},
  43. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  44. var delurl = "{:url('del',[],'')}/id/"+c.id;
  45. var btn = '<a {if !btnAuth(session("user_auth.id"),"AppMgr/del")} style="display:none" {/if} href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  46. return btn;
  47. }},
  48. ],
  49. rowNum:10,
  50. rowList:[10,20,30,50,100],
  51. pager: '#pager',
  52. sortname: 'id',
  53. viewrecords: true,
  54. autowidth:true,
  55. mtype: 'post',
  56. height: 'auto',
  57. emptyrecords: "暂无数据",
  58. sortorder: "desc",
  59. caption:"安卓版本列表",
  60. loadComplete: function (xhr) {
  61. if(xhr.code==0){
  62. layer.msg(xhr.msg);
  63. return false;
  64. }
  65. },
  66. });
  67. });
  68. </script>
  69. {/block}