index.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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. </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 placeholder="月份" type="text" class="form-control" readonly id="month" name="month">
  13. </div>
  14. <div class="input-group">
  15. <input type="text" class="form-control" name="title" placeholder="名称">
  16. </div>
  17. <div class="input-group">
  18. <select name="cate_id" class="form-control">
  19. <option value="">选择分类</option>
  20. {foreach $cate as $k=>$v}
  21. <option value="{$v.id}">{$v.title}</option>
  22. {/foreach}
  23. </select>
  24. </div>
  25. <div class="input-group">
  26. <select name="status" class="form-control">
  27. <option value="">选择状态</option>
  28. <option value="0">未执行</option>
  29. <option value="1">执行中</option>
  30. <option value="2">已完成</option>
  31. <option value="3">未完成</option>
  32. <option value="5">中断</option>
  33. </select>
  34. </div>
  35. <div class="input-group">
  36. <span class="input-group-btn">
  37. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  38. </span>
  39. <span class="input-group-btn">
  40. <button class="btn-sm btn-warning " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  41. </span>
  42. </div>
  43. </form>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="ibox-content">
  48. <div class="row">
  49. <div class="col-xs-6">
  50. <a href="{:url('calendar')}" class="btn btn-sm btn-warning">日历显示</a>
  51. <a href="{:url('plan')}?type=1" class="btn btn-sm btn-success">复制月计划</a>
  52. <a {if !btnAuth(session("user_auth.id"),"DeviceTask/del")} style="display:none" {/if} href="{:url('batch')}?type=1" class="btn btn-sm btn-danger">按月删除计划</a>
  53. <a {if !btnAuth(session("user_auth.id"),"DeviceTask/del")} style="display:none" {/if} href="javascript:;" id="js" class="btn btn-sm btn-danger">批量删除</a>
  54. </div>
  55. </div>
  56. </div>
  57. <div class="ibox-content">
  58. <div class="jqGrid_wrapper">
  59. <table id="table" style="border-collapse: collapse"></table>
  60. <div id="pager"></div>
  61. </div>
  62. </div>
  63. </div>
  64. {/block}
  65. {block name="script"}
  66. <script type="text/javascript" src="/static/layDate-v5.0.9/laydate.js"></script>
  67. <script>
  68. $(function () {
  69. $(window).bind("resize",function(){
  70. var width=$(".jqGrid_wrapper").width();
  71. $("#table").setGridWidth(width);
  72. });
  73. $.jgrid.defaults.styleUI="Bootstrap";
  74. $("#table").jqGrid({
  75. url:"{:url('index')}",
  76. datatype: "json",
  77. colModel:[
  78. {label:'编号',name:'id',index:'id', width:30,sortable: false},
  79. {label:'名称',name:'title',index:'title', width:60,sortable: false},
  80. {label:'执行人',name:'task_user',index:'task_user', width:60,sortable: false},
  81. {label:'分类',name:'cate_name',index:'cate_name',width:40,sortable: true},
  82. {label:'开始时间',name:'start_time',index:'start_time', width:50,sortable: false},
  83. {label:'结束时间',name:'end_time',index:'end_time', width:50,sortable: false},
  84. {label:'状态',name:'status',index:'enable',width:30,editable: false,sortable: false,formatter:function (a,b,c){
  85. if(a==0){
  86. return '<span title="未执行">未执行</span>';
  87. }else if(a==1) {
  88. return '<span title="执行中">执行中</span>';
  89. }else if(a==2){
  90. return '<span title="已完成">已完成</span>';
  91. }else if(a==3){
  92. return '<span title="未完成">未完成</span>';
  93. }
  94. }},
  95. {label:'创建日期',name:'create_time',index:'create_time', width:60,sortable: false},
  96. {label:'操作',width:80,sortable: false,formatter: function (a, b, c) {
  97. var editurl = "{:url('add',[],'')}/id/"+c.id;
  98. var trackurl = "{:url('info',[],'')}/id/"+c.id;
  99. var delurl = "{:url('del',[],'')}/id/"+c.id;
  100. var copyurl = "{:url('copy',[],'')}/id/"+c.id;
  101. var btn = '';
  102. if(c.status == 0){
  103. btn+= '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  104. }
  105. btn+= '<a url="'+trackurl+'" href="javascript:;" data-title="详情" onclick="layer_open(this,1)"><span class="label label-primary" title="详情">详情</span></a>&nbsp;';
  106. if(c.status == 0){
  107. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  108. }
  109. btn+= '<a href="'+copyurl+'"><span class="label label-primary" title="复制计划">复制计划</span></a>&nbsp;';
  110. return btn;
  111. }},
  112. ],
  113. rowNum:10,
  114. rowList:[10,20,30,50,100],
  115. pager: '#pager',
  116. sortname: 'id',
  117. viewrecords: true,
  118. autowidth:true,
  119. mtype: 'post',
  120. height: 'auto',
  121. emptyrecords: "暂无数据",
  122. sortorder: "desc",
  123. caption:"设备维保计划",
  124. multiselect: true,//可多选
  125. loadComplete: function (xhr) {
  126. if(xhr.code==0){
  127. layer.msg(xhr.msg);
  128. return false;
  129. }
  130. },
  131. });
  132. $('#js').click(function () {
  133. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  134. if(rowIds.length <=0){
  135. updateAlert('请选择计划','alert-danger');
  136. setTimeout(function(){
  137. $('#top-alert').find('button').click();
  138. },1500);
  139. return;
  140. }
  141. $.post('{:url("byIdSDel")}',{ids:rowIds},function (res) {
  142. if(res.code==0){
  143. updateAlert(res.msg,'alert-danger');
  144. setTimeout(function(){
  145. $('#top-alert').find('button').click();
  146. },1500);
  147. // window.location.reload();
  148. }else {
  149. updateAlert(res.msg,'alert-success');
  150. setTimeout(function(){
  151. $('#top-alert').find('button').click();
  152. $("#table").trigger("reloadGrid");
  153. },1500);
  154. }
  155. })
  156. })
  157. });
  158. </script>
  159. <script>
  160. //日期时间选择器
  161. laydate.render({
  162. elem: '#month',
  163. type: 'month',
  164. trigger: 'click' ,
  165. format:'yyyyMM',
  166. theme:'#284a94'
  167. });
  168. </script>
  169. {/block}
  170. tml>