index.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 btn = '';
  101. if(c.status == 0){
  102. btn+= '<a url="'+editurl+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  103. }
  104. btn+= '<a url="'+trackurl+'" href="javascript:;" data-title="详情" onclick="layer_open(this,1)"><span class="label label-primary" title="详情">详情</span></a>&nbsp;';
  105. if(c.status == 0){
  106. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  107. }
  108. return btn;
  109. }},
  110. ],
  111. rowNum:10,
  112. rowList:[10,20,30,50,100],
  113. pager: '#pager',
  114. sortname: 'id',
  115. viewrecords: true,
  116. autowidth:true,
  117. mtype: 'post',
  118. height: 'auto',
  119. emptyrecords: "暂无数据",
  120. sortorder: "desc",
  121. caption:"设备维保计划",
  122. multiselect: true,//可多选
  123. loadComplete: function (xhr) {
  124. if(xhr.code==0){
  125. layer.msg(xhr.msg);
  126. return false;
  127. }
  128. },
  129. });
  130. $('#js').click(function () {
  131. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  132. if(rowIds.length <=0){
  133. updateAlert('请选择计划','alert-danger');
  134. setTimeout(function(){
  135. $('#top-alert').find('button').click();
  136. },1500);
  137. return;
  138. }
  139. $.post('{:url("byIdSDel")}',{ids:rowIds},function (res) {
  140. if(res.code==0){
  141. updateAlert(res.msg,'alert-danger');
  142. setTimeout(function(){
  143. $('#top-alert').find('button').click();
  144. },1500);
  145. // window.location.reload();
  146. }else {
  147. updateAlert(res.msg,'alert-success');
  148. setTimeout(function(){
  149. $('#top-alert').find('button').click();
  150. $("#table").trigger("reloadGrid");
  151. },1500);
  152. }
  153. })
  154. })
  155. });
  156. </script>
  157. <script>
  158. //日期时间选择器
  159. laydate.render({
  160. elem: '#month',
  161. type: 'month',
  162. trigger: 'click' ,
  163. format:'yyyyMM',
  164. theme:'#148d8f'
  165. });
  166. </script>
  167. {/block}
  168. tml>