index.html 6.4 KB

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