index.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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-12" style="text-align: right;">
  7. <form class="form-inline" id="form-search" action="{:url('index')}">
  8. <div class="input-group">
  9. <input type="text" id="start" readonly class="form-control" name="start" placeholder="开始日期">
  10. </div>
  11. <div class="input-group">
  12. <input type="text" id="end" readonly class="form-control" name="end" placeholder="结束日期">
  13. </div>
  14. <div class="input-group">
  15. <select name="status" class="form-control">
  16. <option value="">全部</option>
  17. {foreach $status as $k=>$v}
  18. <option value="{$k}">{$v}</option>
  19. {/foreach}
  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> &nbsp;
  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. //导出
  46. function excel_download(_self){
  47. var url = $(_self).attr('data-url');
  48. var param = $('#form-search').serialize();
  49. window.location.href = url+'?'+param;
  50. }
  51. $(function () {
  52. laydate.render({
  53. elem: '#start',
  54. trigger: 'click' ,
  55. theme:'#148d8f'
  56. });
  57. laydate.render({
  58. elem: '#end',
  59. trigger: 'click' ,
  60. theme:'#148d8f'
  61. });
  62. $(window).bind("resize",function(){
  63. var width=$(".jqGrid_wrapper").width();
  64. $("#table").setGridWidth(width);
  65. });
  66. $.jgrid.defaults.styleUI="Bootstrap";
  67. $("#table").jqGrid({
  68. url:"{:url('index')}",
  69. datatype: "json",
  70. colModel:[
  71. {label:'ID',name:'id',index:'id', width:30,sortable: false},
  72. {label:'打包人',name:'real_name',index:'real_name',width:40,sortable: true},
  73. {label:'重量(kg)',name:'weight',index:'weight',width:40,sortable: true},
  74. {label:'医废记录数',name:'count',index:'count',width:40,sortable: true},
  75. {label:'日期',name:'create_time',index:'create_time',width:40,sortable: true},
  76. {label:'状态',name:'status',index:'status',width:40,editable: false,sortable: false,formatter:function (a,b,c){
  77. if(a == 0){
  78. return '待交接';
  79. }else if (a==1){
  80. return '待转运';
  81. }else if (a==2){
  82. return '已转运';
  83. }
  84. }},
  85. {label:'操作',width:80,sortable: false,formatter: function (a, b, c) {
  86. var info = "{:url('info',[],'')}/id/"+c.id;
  87. var finish = "{:url('finish',[],'')}/id/"+c.id;
  88. var delurl = "{:url('del',[],'')}/id/"+c.id;
  89. var btn = '<a url="'+info+'" href="javascript:;" data-title="{$m_name}详情" onclick="layer_open(this,1)"><span class="label label-info" title="详情">详情</span></a>&nbsp;';
  90. return btn;
  91. }},
  92. ],
  93. rowNum:10,
  94. rowList:[10,20,30,50,100],
  95. pager: '#pager',
  96. sortname: 'id',
  97. viewrecords: true,
  98. autowidth:true,
  99. mtype: 'post',
  100. height: 'auto',
  101. emptyrecords: "暂无数据",
  102. sortorder: "asc",
  103. caption:"{$m_name}列表",
  104. // multiselect: true,//可多选
  105. loadComplete: function (xhr) {
  106. if(xhr.code==0){
  107. layer.msg(xhr.msg);
  108. return false;
  109. }
  110. },
  111. });
  112. $('.batch-finish').click(function () {
  113. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  114. $.post('/admin/waste_record/batchFinish.html',{ids:rowIds},function (res) {
  115. if(res.code==0){
  116. layer.msg(res.msg);
  117. return;
  118. }else {
  119. layer.msg(res.msg,{time:2000},function () {
  120. $('#top-alert').find('button').click();
  121. $("#table").trigger("reloadGrid");
  122. })
  123. }
  124. })
  125. })
  126. });
  127. </script>
  128. {/block}