search.blade.php 14 KB

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