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