index.html 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <style>
  4. #allZy{
  5. background-color: var(--themeColor) !important;
  6. border-color: var(--themeColor) !important;
  7. border-radius: 3px;
  8. padding: 6px 10px;
  9. font-size: 12px;
  10. line-height: 1.5;
  11. margin-top: 2px;
  12. display: inline-block;
  13. }
  14. </style>
  15. <div class="ibox">
  16. <div class="ibox-content">
  17. <div class="row">
  18. <div class="col-xs-4">
  19. <!--<a href="javascript:;" url="{:url('add')}" data-title="新增{$m_name}" onclick="layer_open(this,1)" class="btn btn-sm btn-primary">批量转运</a>-->
  20. <!---->
  21. <a href="javascript:;" class="btn btn-sm batch-finish btn-primary">批量转运</a>
  22. <a href="{:url('allZy')}" data-confirm="确认要全部转运吗?" class="confirm ajax-get" ><span class=" label-primary" title="全部转运" id="allZy">全部转运</span></a>
  23. <a href="javascript:;" class="btn btn-sm batch-apply btn-primary">修改申请</a>
  24. </div>
  25. <div class="col-xs-8" style="text-align: right;">
  26. <form class="form-inline" id="form-search" action="{:url('index')}">
  27. <div class="input-group">
  28. <input type="text" id="start" readonly class="form-control" name="start" placeholder="开始日期">
  29. </div>
  30. <div class="input-group">
  31. <input type="text" id="end" readonly class="form-control" name="end" placeholder="结束日期">
  32. </div>
  33. <div class="input-group">
  34. <select name="cateid" class="form-control">
  35. <option value="">请选择类型</option>
  36. {foreach $type as $k=>$v}
  37. <option value="{$v.id}">{$v.title}</option>
  38. {/foreach}
  39. </select>
  40. </div>
  41. <div class="input-group">
  42. <select name="status" class="form-control">
  43. <option value="">全部</option>
  44. {foreach $status as $k=>$v}
  45. <option {if $k==4} selected {/if} value="{$k}">{$v}</option>
  46. {/foreach}
  47. </select>
  48. </div>
  49. <div class="input-group">
  50. <span class="input-group-btn">
  51. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  52. </span> &nbsp;
  53. <span class="input-group-btn">
  54. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  55. </span>
  56. &nbsp;
  57. <span class="input-group-btn">
  58. <button data-url="{:url('export')}" title="导出" class="btn-sm btn-primary" onclick="excel_download(this)" type="button" ><i class="fa fa-cloud-download"></i></button>
  59. </span>
  60. </div>
  61. </form>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="ibox-content">
  66. <div class="jqGrid_wrapper">
  67. <table id="table" style="border-collapse: collapse"></table>
  68. <div id="pager"></div>
  69. </div>
  70. </div>
  71. </div>
  72. {/block}
  73. {block name="script"}
  74. <script type="text/javascript" src="/static/layDate-v5.0.9/laydate.js"></script>
  75. <script>
  76. //导出
  77. function excel_download(_self){
  78. var url = $(_self).attr('data-url');
  79. var param = $('#form-search').serialize();
  80. window.location.href = url+'?'+param;
  81. }
  82. $(function () {
  83. laydate.render({
  84. elem: '#start',
  85. trigger: 'click' ,
  86. theme:'#148d8f'
  87. });
  88. laydate.render({
  89. elem: '#end',
  90. trigger: 'click' ,
  91. theme:'#148d8f'
  92. });
  93. $(window).bind("resize",function(){
  94. var width=$(".jqGrid_wrapper").width();
  95. $("#table").setGridWidth(width);
  96. });
  97. $.jgrid.defaults.styleUI="Bootstrap";
  98. $("#table").jqGrid({
  99. url:"{:url('index')}",
  100. datatype: "json",
  101. colModel:[
  102. {label:'ID',name:'id',index:'id', width:30,sortable: false},
  103. {label:'收取地点',name:'waste_device',index:'waste_device',width:80,editable: false,sortable: false},
  104. {label:'收取人',name:'real_name',index:'real_name',width:40,sortable: true},
  105. {label:'称重序列号',name:'serial_number',index:'serial_number',width:80,sortable: true},
  106. {label:'类别',name:'cate',index:'cate',width:40,sortable: true},
  107. {label:'重量(kg)',name:'weight',index:'weight',width:40,sortable: true},
  108. {label:'收取时间',name:'create_time',index:'create_time',width:80,sortable: true},
  109. {label:'二维码',name:'serial_number_path',index:'serial_number_path',width:80,editable: false,sortable: false,formatter: function (a, b, c) {
  110. return '<img src="'+a+'" width="60" onclick="open_img(this)"></img>';
  111. }},
  112. {label:'是否签字',name:'sign',index:'sign',width:40,editable: false,sortable: false,formatter:function (a,b,c){
  113. if(a == 0){
  114. return '否';
  115. }else if (a==1){
  116. return '是';
  117. }
  118. }},
  119. {label:'状态',name:'status',index:'status',width:40,editable: false,sortable: false},
  120. {label:'操作',width:80,sortable: false,formatter: function (a, b, c) {
  121. var info = "{:url('info',[],'')}/id/"+c.id;
  122. var finish = "{:url('finish',[],'')}/id/"+c.id;
  123. var delurl = "{:url('del',[],'')}/id/"+c.id;
  124. 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;';
  125. if(c.status==1){
  126. btn += '<a href="'+finish+'" class="confirm ajax-get" data-confirm="确定要转运此记录吗?" data-table="1"><span class="label label-primary" title="转运">转运</span></a>&nbsp;';
  127. }
  128. btn += '<a {if !btnAuth(session("user_auth.id"),"WasteRecord/del")} style="display:none"{/if} href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  129. return btn;
  130. }},
  131. ],
  132. rowNum:10,
  133. rowList:[10,20,30,50,100],
  134. pager: '#pager',
  135. sortname: 'id',
  136. viewrecords: true,
  137. autowidth:true,
  138. mtype: 'post',
  139. height: 'auto',
  140. emptyrecords: "暂无数据",
  141. sortorder: "desc",
  142. caption:"{$m_name}列表",
  143. multiselect: true,//可多选
  144. loadComplete: function (xhr) {
  145. if(xhr.code==0){
  146. layer.msg(xhr.msg);
  147. return false;
  148. }
  149. },
  150. });
  151. $('.batch-finish').click(function () {
  152. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  153. $.post('/admin/waste_record/batchFinish.html',{ids:rowIds},function (res) {
  154. if(res.code==0){
  155. layer.msg(res.msg);
  156. return;
  157. }else {
  158. layer.msg(res.msg,{time:2000},function () {
  159. $('#top-alert').find('button').click();
  160. $("#table").trigger("reloadGrid");
  161. })
  162. }
  163. })
  164. })
  165. $('.batch-apply').click(function () {
  166. var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow'); //获取勾选记录的ID
  167. if(rowIds.length==0){
  168. layer.msg('选择记录');
  169. return false;
  170. }
  171. if(rowIds.length >1){
  172. layer.msg('只能单个修改申请');
  173. return false;
  174. }
  175. layer.open({
  176. type: 2,
  177. title: '修改申请',
  178. shadeClose: true,
  179. shade: 0.3,
  180. maxmin: true,
  181. area: ['70%', '70%'],
  182. content: '/admin/waste_record/apply.html?id='+rowIds[0],
  183. });
  184. })
  185. });
  186. </script>
  187. {/block}