search.blade.php 14 KB

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