search.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. @extends('layouts.app')
  2. @section('title')订单管理-波次@endsection
  3. @section("content")
  4. @component("order.wave.menu")@endcomponent
  5. <div class="container-fluid d-none" id="wave_div">
  6. <div style="min-width: 2000px;">
  7. <div id="form_div" style="min-width: 1950px;" class="bg-white"></div>
  8. <table class="table table-sm table-striped table-bordered table-hover card-body mt-2 ">
  9. <tr></tr>
  10. <tr>
  11. <td colspan="20">
  12. <button type="button" class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
  13. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
  14. 导出Excel
  15. </button>
  16. <div class="dropdown-menu">
  17. <a class="dropdown-item" @click="exportExcel('pitch')" href="javascript:">导出勾选内容</a>
  18. <a class="dropdown-item" @click="exportExcel()" href="javascript:">导出所有页</a>
  19. </div>
  20. {{-- <button type="button" class="btn btn-sm tooltipTarget btn-outline-dark" @click="batchCancelPrint">重置打印标记</button>--}}
  21. </td>
  22. </tr>
  23. <tr class="text-nowrap">
  24. <th>
  25. <label for="all">
  26. <input type="checkbox" id="all" @click="checkAll()"/>
  27. </label>
  28. </th>
  29. <th>序号</th>
  30. <th>波次号</th>
  31. <th>波次状态</th>
  32. <th>波次规则</th>
  33. <th>波次描述</th>
  34. <th>承运人</th>
  35. <th>操作员</th>
  36. <th>创建时间</th>
  37. <th>拣货单打印人</th>
  38. <th>拣货单打印于</th>
  39. <th>快递单打印人</th>
  40. <th>快递单打印于</th>
  41. @can("订单管理-波次-重置打印")
  42. <th>重置打印</th>
  43. @endcan
  44. </tr>
  45. <tr v-for="(wave,i) in waves">
  46. <td>
  47. <input class="checkItem" type="checkbox" :value="wave.waveNo" v-model="checkData">
  48. </td>
  49. <td>@{{ i+1 }}</td>{{--序号--}}
  50. <td class="text-dark font-weight-bold text-nowrap">@{{ wave.waveNo }}</td>{{--波次号--}}
  51. <td class="text-muted text-nowrap">@{{ wave.codename_c }}</td>{{--波次状态--}}
  52. <td class="text-nowrap text-muted">@{{ wave.waveRule }}</td>{{--波次规则--}}
  53. <td class="text-nowrap">@{{ wave.descr }}</td>{{--波次描述--}}
  54. <td class="text-muted">@{{ wave.descr_c }}</td>{{--承运人--}}
  55. <td class="text-nowrap">@{{ wave.addWho }}</td>{{--操作员--}}
  56. <td class="text-muted">@{{ wave.addTime }}</td>{{--创建时间--}}
  57. <td class="text-nowrap">@{{ wave.pickerPrint }}</td>{{--拣货单打印人--}}
  58. <td class="text-muted">@{{ wave.pickerPrintTime }}</td>{{--拣货单打印时间--}}
  59. <td class="text-nowrap">@{{ wave.expressPrinting }}</td>{{--快递单号打印人--}}
  60. <td class="text-muted">@{{ wave.expressPrintTime }}</td>{{--快递单号打时间--}}
  61. @can("订单管理-波次-重置打印")
  62. <td class="text-center">
  63. <button :disabled="!(wave.waveStatus !== '99' && wave.UdfPrintFlag2 === 'Y')" type="button" class="btn btn-sm btn-outline-dark text-nowrap" :data-value="wave.waveNo" @click="singleCancelPrint($event)">重置</button>
  64. </td>
  65. @endcan
  66. </tr>
  67. </table>
  68. <button type="button" class="btn btn-sm " @click="pervPage" :class="'{{$param['currPage']}}'> 1? 'btn-outline-info ':'disabled'" {{--disabled="'{{$param['currPage']}}'> 1?'':true"--}}>上一页</button>
  69. <button type="button" class="btn btn-sm " @click="nextPage" :class="'{{$param['currPage']}}'<'{{$param['pageTotal']}}'?'btn-outline-info':'disabled'" :disabled="currPage == pageTotal">下一页</button>
  70. <input @keyup.enter="pageTurning($event)" class="form-control-sm ml-3 tooltipTarget"
  71. :placeholder="'当前页数:'+'{{$param['currPage']}}'+'/'+'{{$param['pageTotal']}}'" title="去往指定页">
  72. <span class="text-muted m-1">共 {{$param['count']}} 条 </span>
  73. </div>
  74. </div>
  75. @endsection
  76. @section("lastScript")
  77. <script type="text/javascript" src="{{asset('js/queryForm/queryForm200818a.js')}}"></script>
  78. <script>
  79. let vueList = new Vue({
  80. el: "#wave_div",
  81. data: {
  82. waves: [
  83. @foreach($waves as $wave)
  84. {
  85. waveNo: '{{$wave->waveno}}',
  86. waveStatus: '{{$wave->wavestatus}}',
  87. codename_c: '{{$wave->codename_c}}',
  88. descr: '{{$wave->descr}}',
  89. descr_c: '{{$wave->descr_c}}',
  90. addTime: '{{$wave->addtime}}',
  91. addWho: '{{$wave->addwho}}',
  92. waveRule: '{{$wave->waverule}}',
  93. waveDispatchId: '{{$wave->wavedispatchid}}',
  94. userDefine1: '{{$wave->userdefine1}}',
  95. userDefine2: '{{$wave->userdefine2}}',
  96. pickerPrint: '{{$wave->pickerPrint}}',
  97. pickerPrintTime: '{{$wave->pickerPrintTime}}',
  98. expressPrinting: '{{$wave->expressPrinting}}',
  99. expressPrintTime: '{{$wave->expressPrintTime}}',
  100. UdfPrintFlag2:'{{$wave->udfprintflag2}}'
  101. },
  102. @endforeach
  103. ],
  104. form: '',
  105. checkData: [],
  106. pageTotal:'{{$param['pageTotal']}}',
  107. currPage:'{{$param['currPage']}}',
  108. },
  109. mounted: function () {
  110. $('#wave_div').removeClass('d-none')
  111. let data = [[
  112. {name: 'start_time', type: 'dateTime', tip: '选择显示指定日期的起始时间', placeholder: ''},
  113. {name: 'end_time', type: 'dateTime', tip: '选择显示指定日期的结束时间', placeholder: ''},
  114. {name: 'wave_num', type: 'input', tip: '波次编号:如模糊搜索需要在条件前后输入%号,回车提交', placeholder: ''},
  115. ]];
  116. this.form = new query({
  117. el: '#form_div',
  118. condition: data,
  119. })
  120. this.form.init();
  121. $(".tooltipTarget").tooltip({'trigger': 'hover'});
  122. },
  123. methods: {
  124. singleCancelPrint: function ($event) {
  125. let ids = $($event.target).attr("data-value");
  126. if (ids) {
  127. this.cancelPrint(ids);
  128. }
  129. },
  130. batchCancelPrint: function () {
  131. if (this.checkData === 0) {
  132. tempTip.show('没有勾选记录');
  133. return;
  134. }
  135. let ids = this.getCheckedIds();
  136. this.cancelPrint(ids);
  137. },
  138. cancelPrint: function (ids, type = 'string') {
  139. let _this = this;
  140. // console.log(ids);
  141. tempTip.setDuration(99999)
  142. tempTip.waitingTip('取消中,请稍候')
  143. axios.post("{{url("order/wave/cancelPrinting")}}", {ids: ids}).then(function (res) {
  144. tempTip.setDuration(5000)
  145. tempTip.cancelWaitingTip();
  146. if (res.data.success) {
  147. _this.waves.forEach(function (wave) {
  148. if (ids.includes(wave.waveNo)) {
  149. console.log(wave.waveNo);
  150. wave.expressPrinting = '';
  151. wave.expressPrintTime = '';
  152. wave.UdfPrintFlag2 = 'N';
  153. }
  154. })
  155. tempTip.setDuration(3000);
  156. tempTip.showSuccess('重置打印成功!');
  157. if (type === 'array') {
  158. _this.checkData = [];
  159. }
  160. $(".checkItem").prop("checked",false);
  161. } else {
  162. tempTip.setDuration(2500);
  163. tempTip.show('标记勾选内容重置打印失败,错误:' + response.data.fail_info);
  164. }
  165. }).catch(function (err) {
  166. tempTip.setDuration(4000);
  167. tempTip.show('网络错误:' + err);
  168. });
  169. },
  170. pageTurning: function (event) {
  171. let page = $(event.target).val();
  172. if (!page) {
  173. return;
  174. }
  175. window.location = this.form.goPage(page);
  176. },
  177. pervPage() {
  178. window.location = this.form.pervPage();
  179. },
  180. nextPage() {
  181. window.location = this.form.nextPage();
  182. },
  183. exportExcel(string = 'all'){
  184. // let data = this.getSearch();
  185. let search = '';
  186. if(string === "all"){
  187. }else if(string === 'pitch'){
  188. if(this.getCheckedIds().length === 0){
  189. tempTip.show('没有勾选记录');
  190. return;
  191. }
  192. if(this.checkData){
  193. let seachs =this.checkData.map(function (value) {
  194. return "'"+value+"'";
  195. })
  196. search = "wave_num="+this.checkData.join(',');
  197. }
  198. }
  199. let url = window.location.search ;
  200. url = url.length< 2 ? '' : url.substring(1);
  201. console.log(search,url);
  202. window.open("{{url('oder/wave/exportExcel?')}}"+search+url);
  203. // todo
  204. /* let instance = axios.create({
  205. {{--url:'{{url("wave/exportExcel")}}',--}}
  206. responseType:'blob',
  207. data:data,
  208. });
  209. instance.post().then(function(res){
  210. let blob = res.data;
  211. let url = URL.createObjectURL(blob);
  212. let fileName = new Date().toLocaleDateString() + "--波次记录.xml";
  213. let a = document.createElement('a');
  214. $("body").append($(a).attr("href",url).attr("download",fileName)) ;
  215. a.click();
  216. a.remove()
  217. }).catch(function(err){
  218. console.log("err",err);
  219. });*/
  220. },
  221. getSearch(){
  222. let search = window.location.search,data = {};
  223. if(!search || search.length <=1 ){
  224. return {};
  225. }
  226. let index =search.indexOf("?");
  227. search = (search.substr(index)).split('&');
  228. search.forEach(function(map){
  229. let arr = map.split('=');
  230. let key = arr[0],value = arr[2];
  231. if(value.include(',')){
  232. value = value.split(',');
  233. }
  234. data[key] = value;
  235. });
  236. return data;
  237. },
  238. checkAll(){
  239. let checked = $("#all").is(":checked");
  240. $(".checkItem").prop("checked",checked === true);
  241. if(checked){
  242. this.checkData = this.getCheckedIds();
  243. }else{
  244. this.checkData = [];
  245. }
  246. },
  247. getCheckedIds(){
  248. // HACK
  249. let values = [];
  250. let items = $(".checkItem:checked");
  251. let len = items.length,index =0;
  252. for (index =0;index <len;index++ ){
  253. values.push($(items[index]).val());
  254. }
  255. return values;
  256. },
  257. selectedColor(waveNo){
  258. if(waveNo === this.selectedWaveNo){
  259. this.selectedWaveNo = '';
  260. return;
  261. }
  262. this.selectedWaveNo = waveNo;
  263. }
  264. }
  265. });
  266. </script>
  267. @endsection