0
0

index.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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:20,sortable: false},
  72. // {label:'编号',name:'sn',index:'sn', width:50,sortable: false},
  73. {label:'打包人',name:'real_name',index:'real_name',width:40,sortable: true},
  74. {label:'重量(kg)',name:'weight',index:'weight',width:40,sortable: true},
  75. {label:'医废记录数',name:'count',index:'count',width:40,sortable: true},
  76. {label:'二维码',name:'qrcode',index:'qrcode',width:50,editable: false,sortable: false,formatter: function (a, b, c) {
  77. return '<img src="'+a+'" width="60" onclick="open_img(this)"></img>';
  78. }},
  79. {label:'日期',name:'create_time',index:'create_time',width:40,sortable: true},
  80. {label:'状态',name:'status',index:'status',width:40,editable: false,sortable: false,formatter:function (a,b,c){
  81. if(a == 0){
  82. return '待交接';
  83. }else if (a==1){
  84. return '待转运';
  85. }else if (a==2){
  86. return '已转运';
  87. }
  88. }},
  89. {label:'操作',width:80,sortable: false,formatter: function (a, b, c) {
  90. var info = "{:url('info',[],'')}/id/"+c.id;
  91. var finish = "{:url('finish',[],'')}/id/"+c.id;
  92. var delurl = "{:url('del',[],'')}/id/"+c.id;
  93. 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;';
  94. return btn;
  95. }},
  96. ],
  97. rowNum:10,
  98. rowList:[10,20,30,50,100],
  99. pager: '#pager',
  100. sortname: 'id',
  101. viewrecords: true,
  102. autowidth:true,
  103. mtype: 'post',
  104. height: 'auto',
  105. emptyrecords: "暂无数据",
  106. sortorder: "asc",
  107. caption:"{$m_name}列表",
  108. // multiselect: true,//可多选
  109. loadComplete: function (xhr) {
  110. if(xhr.code==0){
  111. layer.msg(xhr.msg);
  112. return false;
  113. }
  114. },
  115. });
  116. $('.batch-finish').click(function () {
  117. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  118. $.post('/admin/waste_record/batchFinish.html',{ids:rowIds},function (res) {
  119. if(res.code==0){
  120. layer.msg(res.msg);
  121. return;
  122. }else {
  123. layer.msg(res.msg,{time:2000},function () {
  124. $('#top-alert').find('button').click();
  125. $("#table").trigger("reloadGrid");
  126. })
  127. }
  128. })
  129. })
  130. });
  131. </script>
  132. {/block}