index.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. </div>
  8. <div class="col-xs-9" style="text-align: right;">
  9. <form class="form-inline" id="form-search" action="{:url('index')}">
  10. <div class="input-group">
  11. <input type="text" id="date" readonly class="form-control" name="begin" placeholder="开始日期">
  12. </div>
  13. <div class="input-group">
  14. <input type="text" id="date1" readonly class="form-control" name="end" placeholder="结束日期">
  15. </div>
  16. <div class="input-group">
  17. <input type="text" class="form-control" name="title" placeholder="名称">
  18. </div>
  19. <div class="input-group">
  20. <select name="cate_id" class="form-control">
  21. <option value="">选择分类</option>
  22. {foreach $cate as $k=>$v}
  23. <option value="{$v['id']}">{$v['title']}</option>
  24. {/foreach}
  25. </select>
  26. </div>
  27. <div class="input-group">
  28. <span class="input-group-btn">
  29. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  30. </span> &nbsp;
  31. <span class="input-group-btn">
  32. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  33. </span>
  34. </div>
  35. </form>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="ibox-content">
  40. <div class="jqGrid_wrapper">
  41. <table id="table" style="border-collapse: collapse"></table>
  42. <div id="pager"></div>
  43. </div>
  44. </div>
  45. </div>
  46. <script src="/static/layDate-v5.0.9/laydate.js"></script>
  47. {/block}
  48. {block name="script"}
  49. <script>
  50. $(function () {
  51. laydate.render({
  52. elem: '#date',
  53. //设置开始日期、日期日期的 input 选择器
  54. //数组格式为 5.3.0 开始新增,之前版本直接配置 true 或任意分割字符即可
  55. trigger: 'click' ,
  56. theme: '#284a94'
  57. });
  58. laydate.render({
  59. elem: '#date1',
  60. //设置开始日期、日期日期的 input 选择器
  61. //数组格式为 5.3.0 开始新增,之前版本直接配置 true 或任意分割字符即可
  62. trigger: 'click' ,
  63. theme: '#284a94'
  64. });
  65. $(window).bind("resize",function(){
  66. var width=$(".jqGrid_wrapper").width();
  67. $("#table").setGridWidth(width);
  68. });
  69. $.jgrid.defaults.styleUI="Bootstrap";
  70. $("#table").jqGrid({
  71. url:"{:url('index')}",
  72. datatype: "json",
  73. colModel:[
  74. {label:'标题',name:'title',index:'title',width:100,editable: false,sortable: false},
  75. {label:'类型',name:'cate_name',index:'cate_name',width:50,sortable: true},
  76. {label:'最低时长限制',name:'limit',index:'limit',width:30,editable: false,sortable: false,formatter:function (a,b,c){
  77. if(a>0){
  78. return a+'分钟';
  79. } else{
  80. return '不限制';
  81. }
  82. }},
  83. {label:'阅读次数',name:'read_total',index:'read_total',width:40,sortable: true},
  84. {label:'阅读人数',name:'read_user_num',index:'read_user_num',width:40,sortable: true},
  85. {label:'阅读时长',name:'read_time',index:'read_time',width:40,sortable: true},
  86. {label:'未达标人数',name:'unread_users',index:'unread_users',width:40,sortable: true},
  87. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  88. var editurl = "{:url('add',[],'')}/id/"+c.id;
  89. var log_url = "{:url('recordLog',[],'')}/id/"+c.id;
  90. var btn = '';
  91. if(c.limit >0){
  92. btn+= '<a href="'+log_url+'" ><span class="label label-primary" title="查看">查看</span></a>&nbsp;';
  93. }
  94. //btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  95. return btn;
  96. }},
  97. ],
  98. rowNum:10,
  99. rowList:[10,20,30,50,100],
  100. pager: '#pager',
  101. sortname: 'sort',
  102. viewrecords: true,
  103. autowidth:true,
  104. mtype: 'post',
  105. height: 'auto',
  106. emptyrecords: "暂无数据",
  107. sortorder: "asc",
  108. caption:"文档阅读数据统计",
  109. loadComplete: function (xhr) {
  110. if(xhr.code==0){
  111. layer.msg(xhr.msg);
  112. return false;
  113. }
  114. },
  115. });
  116. });
  117. </script>
  118. {/block}