index.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 class="col-xs-9" style="text-align: right;">
  10. <form class="form-inline" id="form-search" action="{:url('index')}">
  11. <div class="input-group">
  12. <input type="text" class="form-control" name="title" placeholder="名称">
  13. </div>
  14. <div class="input-group">
  15. <select name="status" class="form-control">
  16. <option value="">选择状态</option>
  17. <option value="0">未开始</option>
  18. <option value="1">进行中</option>
  19. <option value="2">已结束</option>
  20. </select>
  21. </div>
  22. <div class="input-group">
  23. <span class="input-group-btn">
  24. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  25. </span>
  26. <span class="input-group-btn">
  27. <button class="btn-sm btn-warning " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  28. </span>
  29. </div>
  30. </form>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="ibox-content">
  35. <div class="jqGrid_wrapper">
  36. <table id="table" style="border-collapse: collapse"></table>
  37. <div id="pager"></div>
  38. </div>
  39. </div>
  40. </div>
  41. {/block}
  42. {block name="script"}
  43. <script type="text/javascript" src="/static/layDate-v5.0.9/laydate.js"></script>
  44. <script>
  45. $(function () {
  46. $(window).bind("resize",function(){
  47. var width=$(".jqGrid_wrapper").width();
  48. $("#table").setGridWidth(width);
  49. });
  50. $.jgrid.defaults.styleUI="Bootstrap";
  51. $("#table").jqGrid({
  52. url:"{:url('index')}",
  53. datatype: "json",
  54. colModel:[
  55. {label:'编号',name:'id',index:'id', width:40,sortable: false},
  56. {label:'创建人',name:'uname',index:'uname', width:60,sortable: false},
  57. {label:'计划名称',name:'title',index:'title', sortable: false},
  58. {label:'计划时间',name:'start_time',index:'start_time', width:100,sortable: false,formatter:function (a,b,c){
  59. return c.start_time + ' ~ ' + c.end_time;
  60. }},
  61. {label:'状态',name:'status',index:'enable',width:50,editable: false,sortable: false,formatter:function (a,b,c){
  62. if(a==0){
  63. return '<span title="未开始">未开始</span>';
  64. }else if(a==1) {
  65. return '<span title="进行中">进行中</span>';
  66. }else if(a==2){
  67. return '<span title="已结束">已结束</span>';
  68. }
  69. }},
  70. {label:'任务数',name:'count',index:'count', width:60,sortable: false},
  71. {label:'操作',width:120,sortable: false,formatter: function (a, b, c) {
  72. var trackurl = "{:url('detail',[],'')}/id/"+c.id;
  73. var copyurl = "{:url('add',[],'')}/id/"+c.id;
  74. var delurl = "{:url('del',[],'')}/id/"+c.id;
  75. var closeurl = "{:url('close',[],'')}/id/"+c.id;
  76. var btn = '';
  77. btn += '<a href="' + trackurl + '" ><span class="label label-primary" title="详情">详情</span></a>&nbsp;';
  78. btn += '<a href="' + copyurl + '" ><span class="label label-warning" title="复制">复制</span></a>&nbsp;';
  79. if(c.status != 2){
  80. btn += '<a href="'+closeurl+'" class="confirm ajax-get" data-confirm="确定要关闭此计划吗?" data-table="1"><span class="label label-danger" title="关闭">关闭</span></a>';
  81. }else{
  82. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此计划吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  83. }
  84. return btn;
  85. }},
  86. ],
  87. rowNum:10,
  88. rowList:[10,20,30,50,100],
  89. pager: '#pager',
  90. sortname: 'id',
  91. viewrecords: true,
  92. autowidth:true,
  93. mtype: 'post',
  94. height: 'auto',
  95. emptyrecords: "暂无数据",
  96. sortorder: "desc",
  97. caption:"{$meta_title}",
  98. loadComplete: function (xhr) {
  99. if(xhr.code==0){
  100. layer.msg(xhr.msg);
  101. return false;
  102. }
  103. },
  104. });
  105. });
  106. </script>
  107. <script>
  108. //日期时间选择器
  109. laydate.render({
  110. elem: '#month',
  111. type: 'month',
  112. trigger: 'click' ,
  113. format:'yyyyMM',
  114. theme:'#6eb7ff'
  115. });
  116. </script>
  117. {/block}