index.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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-2">
  7. <a href="javascript:;" url="{:url('add')}" data-title="新增" onclick="layer_open(this,1)" class="btn btn-sm btn-primary">新增</a>
  8. </div>
  9. <div class="col-xs-10" style="text-align: right;">
  10. <form class="form-inline" id="form-search" action="{:url('index')}">
  11. <div class="input-group">
  12. {:widget_view('common/laydate',['name'=>'start','placeholder' => '开始时间'])}
  13. </div>
  14. <div class="input-group">
  15. {:widget_view('common/laydate',['name'=>'end','placeholder' => '结束时间'])}
  16. </div>
  17. <div class="input-group">
  18. <select name="dep_id" class="form-control">
  19. <option value="">选择地点</option>
  20. {foreach $address 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="mode" class="form-control">
  27. <option value="">选择状态</option>
  28. <option value="1">已收取</option>
  29. <option value="2">已归还</option>
  30. <option value="3">已确认</option>
  31. </select>
  32. </div>
  33. <div class="input-group">
  34. <span class="input-group-btn">
  35. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  36. </span>&nbsp;
  37. <span class="input-group-btn">
  38. <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  39. </span>&nbsp;
  40. <span class="input-group-btn">
  41. <button data-url="{:url('washRecordExport',[],'')}" title="导出" class="btn-sm btn-primary" onclick="excel_download(this)" type="button" ><i class="fa fa-cloud-download"></i></button>
  42. </span>
  43. </div>
  44. </form>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="ibox-content">
  49. <div class="jqGrid_wrapper">
  50. <table id="table" style="border-collapse: collapse"></table>
  51. <div id="pager"></div>
  52. </div>
  53. </div>
  54. </div>
  55. {/block}
  56. {block name="script"}
  57. <script>
  58. $(function () {
  59. $(window).bind("resize",function(){
  60. var width=$(".jqGrid_wrapper").width();
  61. $("#table").setGridWidth(width);
  62. });
  63. $.jgrid.defaults.styleUI="Bootstrap";
  64. $("#table").jqGrid({
  65. url:"{:url('index')}",
  66. datatype: "json",
  67. colModel:[
  68. {label:'ID',name:'id',index:'id', width:30,sortable: false},
  69. {label:'操作人',name:'real_name',index:'real_name',width:60,editable: false,sortable: false},
  70. {label:'地点',name:'title',index:'title',width:80,sortable: true},
  71. {label:'物品',name:'items',index:'items',width:80,sortable: true},
  72. {label:'领取时间',name:'create_time',index:'create_time',width:80,sortable: true},
  73. {label:'归还时间',name:'return_time',index:'return_time',width:80,sortable: true},
  74. {label:'确认时间',name:'confirm_time',index:'confirm_time',width:80,sortable: true},
  75. {label:'收取图片',name:'sq_img',index:'sq_img',width:40,editable: false,sortable: false,formatter: function (a, b, c) {
  76. if(a){
  77. return '<img src="'+a+'" width="40" onclick="open_img(this)"></img>';
  78. }else{
  79. return '';
  80. }
  81. }},
  82. {label:'收取签名',name:'sq_sign',index:'sq_sign',width:40,editable: false,sortable: false,formatter: function (a, b, c) {
  83. if(a){
  84. return '<img src="'+a+'" width="40" onclick="open_img(this)"></img>';
  85. }else{
  86. return '';
  87. }
  88. }},
  89. {label:'确认图片',name:'img',index:'img',width:40,editable: false,sortable: false,formatter: function (a, b, c) {
  90. if(a){
  91. return '<img src="'+a+'" width="40" onclick="open_img(this)"></img>';
  92. }else{
  93. return '';
  94. }
  95. }},
  96. {label:'确认签名',name:'sign',index:'sign',width:40,editable: false,sortable: false,formatter: function (a, b, c) {
  97. if(a){
  98. return '<img src="'+a+'" width="40" onclick="open_img(this)"></img>';
  99. }else{
  100. return '';
  101. }
  102. }},
  103. {label:'状态',name:'mode',index:'mode',width:40,editable: false,sortable: false,formatter:function (a,b,c){
  104. if(a == 1){
  105. return '已收取';
  106. } else if (a==2){
  107. return '已归还';
  108. }else {
  109. return '已确认';
  110. }
  111. }},
  112. {label:'操作',width:70,sortable: false,formatter: function (a, b, c) {
  113. var returnWash = "{:url('returnWash',[],'')}/id/"+c.id;
  114. var confirmWash = "{:url('confirmWash',[],'')}/id/"+c.id;
  115. var delurl = "{:url('del',[],'')}/id/"+c.id;
  116. var btn = '';
  117. if(c.mode==1){
  118. btn += '<a href="'+returnWash+'" class="confirm ajax-get" data-confirm="确定要归还吗?" data-table="1"><span class="label label-primary" title="归还">归还</span></a>&nbsp;';
  119. }
  120. if(c.mode==2){
  121. btn += '<a url="'+confirmWash+'" href="javascript:;" data-title="确认" onclick="layer_open(this,1)"><span class="label label-primary" title="确认">确认</span></a>&nbsp;';
  122. }
  123. if('{$ids}'==c.user_id){
  124. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
  125. }
  126. return btn;
  127. }},
  128. ],
  129. rowNum:10,
  130. rowList:[10,20,30,50,100],
  131. pager: '#pager',
  132. sortname: 'id',
  133. viewrecords: true,
  134. autowidth:true,
  135. mtype: 'post',
  136. height: 'auto',
  137. emptyrecords: "暂无数据",
  138. sortorder: "asc",
  139. caption:"洗涤记录列表",
  140. loadComplete: function (xhr) {
  141. if(xhr.code==0){
  142. layer.msg(xhr.msg);
  143. return false;
  144. }
  145. },
  146. });
  147. });
  148. //导出
  149. function excel_download(_self){
  150. var url = $(_self).attr('data-url');
  151. var param = $('#form-search').serialize();
  152. window.location.href = url+'?'+param;
  153. }
  154. </script>
  155. {/block}