index.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. <select name="roles_id" class="form-control">
  18. <option value="">选择角色</option>
  19. {foreach $cate as $k=>$v}
  20. <option value="{$v['id']}">{$v['name']}</option>
  21. {/foreach}
  22. </select>
  23. </div>
  24. <div class="input-group">
  25. <span class="input-group-btn">
  26. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  27. </span> &nbsp;
  28. <span class="input-group-btn">
  29. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  30. </span>
  31. </div>
  32. </form>
  33. </div>
  34. </div>
  35. </div>
  36. <div class="ibox-content">
  37. <div class="jqGrid_wrapper">
  38. <table id="table" style="border-collapse: collapse"></table>
  39. <div id="pager"></div>
  40. </div>
  41. </div>
  42. </div>
  43. <script src="/static/layDate-v5.0.9/laydate.js"></script>
  44. {/block}
  45. {block name="script"}
  46. <script>
  47. $(function () {
  48. laydate.render({
  49. elem: '#date',
  50. //设置开始日期、日期日期的 input 选择器
  51. //数组格式为 5.3.0 开始新增,之前版本直接配置 true 或任意分割字符即可
  52. trigger: 'click' ,
  53. theme: '#284a94'
  54. });
  55. laydate.render({
  56. elem: '#date1',
  57. //设置开始日期、日期日期的 input 选择器
  58. //数组格式为 5.3.0 开始新增,之前版本直接配置 true 或任意分割字符即可
  59. trigger: 'click' ,
  60. theme: '#284a94'
  61. });
  62. $(window).bind("resize",function(){
  63. var width=$(".jqGrid_wrapper").width();
  64. $("#table").setGridWidth(width);
  65. });
  66. $.jgrid.defaults.styleUI="Bootstrap";
  67. $("#table").jqGrid({
  68. url:"{:url('index')}",
  69. datatype: "json",
  70. colModel:[
  71. {label:'姓名',name:'real_name',index:'real_name',width:100,editable: false,sortable: false},
  72. {label:'角色',name:'roles_name',index:'roles_name',width:50,sortable: true},
  73. {label:'学习次数',name:'views',index:'views',width:40,sortable: true},
  74. {label:'学习时长',name:'times',index:'times',width:40,sortable: true},
  75. {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
  76. var editurl = "{:url('add',[],'')}/id/"+c.id;
  77. var delurl = "{:url('del',[],'')}/id/"+c.id;
  78. var work_url = "{:url('workLog',[],'')}/id/"+c.user_id;
  79. var btn = '';
  80. btn+= '<a href="'+work_url+'"><span class="label label-primary" title="查看">查看</span></a>&nbsp;';
  81. //btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  82. return btn;
  83. }},
  84. ],
  85. rowNum:10,
  86. rowList:[10,20,30,50,100],
  87. pager: '#pager',
  88. sortname: 'id',
  89. viewrecords: true,
  90. autowidth:true,
  91. mtype: 'post',
  92. height: 'auto',
  93. emptyrecords: "暂无数据",
  94. sortorder: "asc",
  95. caption:"员工学习数据统计",
  96. loadComplete: function (xhr) {
  97. if(xhr.code==0){
  98. layer.msg(xhr.msg);
  99. return false;
  100. }
  101. },
  102. });
  103. });
  104. </script>
  105. {/block}