search.blade.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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. <button type="button" class="btn btn-sm btn-outline-primary" data-toggle="modal" data-target="#splitBatch">分割波次</button>
  39. <button type="button" class="btn btn-sm btn-outline-primary" @click="exePrint()">打印子波条码</button>
  40. </td>
  41. </tr>
  42. <tr class="text-nowrap">
  43. <th>
  44. <label for="all">
  45. <input type="checkbox" id="all" @click="checkAll()"/>
  46. </label>
  47. </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. <th>快递单打印于</th>
  60. @can("订单管理-波次-重置打印")
  61. <th>重置打印</th>
  62. @endcan
  63. </tr>
  64. <tr v-for="(wave,i) in waves" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
  65. <td>
  66. <input class="checkItem" type="checkbox" :value="wave.waveNo" v-model="checkData">
  67. </td>
  68. <td>@{{ i+1 }}</td>{{--序号--}}
  69. <td class="text-dark font-weight-bold text-nowrap">@{{ wave.waveNo }}</td>{{--波次号--}}
  70. <td class="text-muted text-nowrap">@{{ wave.codename_c }}</td>{{--波次状态--}}
  71. <td class="text-nowrap text-muted">@{{ wave.waveRule }}</td>{{--波次规则--}}
  72. <td class="text-nowrap">@{{ wave.descr }}</td>{{--波次描述--}}
  73. <td class="text-muted">@{{ wave.descr_c }}</td>{{--承运人--}}
  74. <td class="text-nowrap">@{{ wave.addWho }}</td>{{--操作员--}}
  75. <td class="text-muted">@{{ wave.addTime }}</td>{{--创建时间--}}
  76. <td class="text-nowrap">@{{ wave.pickerPrint }}</td>{{--拣货单打印人--}}
  77. <td class="text-muted">@{{ wave.pickerPrintTime }}</td>{{--拣货单打印时间--}}
  78. <td class="text-nowrap">@{{ wave.expressPrinting }}</td>{{--快递单号打印人--}}
  79. <td class="text-muted">@{{ wave.expressPrintTime }}</td>{{--快递单号打时间--}}
  80. @can("订单管理-波次-重置打印")
  81. <td class="text-center">
  82. <button :disabled="!( wave.UdfPrintFlag2 === 'Y')" type="button" class="btn btn-sm btn-outline-dark text-nowrap" :data-value="wave.waveNo" @click="singleCancelPrint($event)">重置</button>
  83. </td>
  84. @endcan
  85. </tr>
  86. </table>
  87. <button type="button" class="btn btn-sm " @click="pervPage" :class="'{{$param['currPage']}}'> 1? 'btn-outline-info ':'disabled'" {{--disabled="'{{$param['currPage']}}'> 1?'':true"--}}>上一页</button>
  88. <button type="button" class="btn btn-sm " @click="nextPage" :class="'{{$param['currPage']}}'<'{{$param['pageTotal']}}'?'btn-outline-info':'disabled'" :disabled="currPage == pageTotal">下一页</button>
  89. <input @keyup.enter="pageTurning($event)" class="form-control-sm ml-3 tooltipTarget"
  90. :placeholder="'当前页数:'+'{{$param['currPage']}}'+'/'+'{{$param['pageTotal']}}'" title="去往指定页">
  91. <span class="text-muted m-1">共 {{$param['count']}} 条 </span>
  92. </div>
  93. @include("order.wave._split")
  94. @include("order.wave._printBody")
  95. </div>
  96. @endsection
  97. @section("lastScript")
  98. <script type="text/javascript" src="{{mix('js/utilities/barcode.js')}}"></script>
  99. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  100. <script>
  101. let vueList = new Vue({
  102. el: "#wave_div",
  103. data: {
  104. waves: [
  105. @foreach($waves as $wave)
  106. {
  107. waveNo: '{{$wave->waveno}}',
  108. waveStatus: '{{$wave->wavestatus}}',
  109. codename_c: '{{$wave->codename_c}}',
  110. descr: '{{$wave->descr}}',
  111. descr_c: '{{$wave->descr_c}}',
  112. addTime: '{{$wave->addtime}}',
  113. addWho: '{{$wave->addwho}}',
  114. waveRule: '{{$wave->waverule}}',
  115. waveDispatchId: '{{$wave->wavedispatchid}}',
  116. userDefine1: '{{$wave->userdefine1}}',
  117. userDefine2: '{{$wave->userdefine2}}',
  118. pickerPrint: '{{$wave->pickerPrint}}',
  119. pickerPrintTime: '{{$wave->pickerPrintTime}}',
  120. expressPrinting: '{{$wave->expressPrinting}}',
  121. expressPrintTime: '{{$wave->expressPrintTime}}',
  122. UdfPrintFlag2:'{{$wave->udfprintflag2}}'
  123. },
  124. @endforeach
  125. ],
  126. form: '',
  127. checkData: [],
  128. pageTotal:'{{$param['pageTotal']}}',
  129. currPage:'{{$param['currPage']}}',
  130. selectTr:'',
  131. batchCodes:"",
  132. splitSize:"",
  133. batchNumber:"",
  134. infoShow:false,
  135. splitGroupBySize:{},
  136. },
  137. mounted: function () {
  138. $('#wave_div').removeClass('d-none')
  139. let data = [[
  140. {name: 'start_time', type: 'dateTime', tip: '选择显示指定日期的起始时间', placeholder: ''},
  141. {name: 'end_time', type: 'dateTime', tip: '选择显示指定日期的结束时间', placeholder: ''},
  142. {name: 'wave_num', type: 'input', tip: '波次编号:如模糊搜索需要在条件前后输入%号,回车提交', placeholder: '波次编号'},
  143. ]];
  144. this.form = new query({
  145. el: '#form_div',
  146. condition: data,
  147. });
  148. this.form.init();
  149. $(".tooltipTarget").tooltip({'trigger': 'hover'});
  150. },
  151. methods: {
  152. repairBatch(){
  153. if (!this.batchCodes) return;
  154. window.tempTip.postBasicRequest("{{url('order/wave/repairBatch')}}",{"codes":this.batchCodes.split(",")},res=>{
  155. return res;
  156. },true);
  157. },
  158. singleCancelPrint: function ($event) {
  159. let ids = $($event.target).attr("data-value");
  160. if (ids) {
  161. this.cancelPrint(ids);
  162. }
  163. },
  164. batchCancelPrint: function () {
  165. if (this.checkData === 0) {
  166. tempTip.show('没有勾选记录');
  167. return;
  168. }
  169. let ids = this.getCheckedIds();
  170. this.cancelPrint(ids);
  171. },
  172. cancelPrint: function (ids, type = 'string') {
  173. let _this = this;
  174. tempTip.setDuration(99999)
  175. tempTip.waitingTip('取消中,请稍候')
  176. axios.post("{{url("order/wave/cancelPrinting")}}", {ids: ids}).then(function (res) {
  177. tempTip.setDuration(5000)
  178. tempTip.cancelWaitingTip();
  179. if (res.data.success) {
  180. _this.waves.forEach(function (wave) {
  181. if (ids.includes(wave.waveNo)) {
  182. wave.expressPrinting = '';
  183. wave.expressPrintTime = '';
  184. wave.UdfPrintFlag2 = 'N';
  185. }
  186. })
  187. tempTip.setDuration(3000);
  188. tempTip.showSuccess('重置打印成功!');
  189. if (type === 'array') {
  190. _this.checkData = [];
  191. }
  192. $(".checkItem").prop("checked",false);
  193. } else {
  194. tempTip.setDuration(2500);
  195. tempTip.show('标记勾选内容重置打印失败,错误:' + res.data.fail_info);
  196. }
  197. }).catch(function (err) {
  198. tempTip.setDuration(4000);
  199. tempTip.show('网络错误:' + err);
  200. });
  201. },
  202. pageTurning: function (event) {
  203. let page = $(event.target).val();
  204. if (!page) {
  205. return;
  206. }
  207. window.location = this.form.goPage(page);
  208. },
  209. pervPage() {
  210. window.location = this.form.pervPage();
  211. },
  212. nextPage() {
  213. window.location = this.form.nextPage();
  214. },
  215. exportExcel(string = 'all'){
  216. // let data = this.getSearch();
  217. let search = '';
  218. if(string === "all"){
  219. }else if(string === 'pitch'){
  220. if(this.getCheckedIds().length === 0){
  221. tempTip.show('没有勾选记录');
  222. return;
  223. }
  224. if(this.checkData){
  225. let seachs =this.checkData.map(function (value) {
  226. return "'"+value+"'";
  227. })
  228. search = "wave_num="+this.checkData.join(',');
  229. }
  230. }
  231. let url = window.location.search ;
  232. url = url.length< 2 ? '' : url.substring(1);
  233. window.open("{{url('order/wave/exportExcel?')}}"+search+url);
  234. },
  235. getSearch(){
  236. let search = window.location.search,data = {};
  237. if(!search || search.length <=1 ){
  238. return {};
  239. }
  240. let index =search.indexOf("?");
  241. search = (search.substr(index)).split('&');
  242. search.forEach(function(map){
  243. let arr = map.split('=');
  244. let key = arr[0],value = arr[2];
  245. if(value.include(',')){
  246. value = value.split(',');
  247. }
  248. data[key] = value;
  249. });
  250. return data;
  251. },
  252. checkAll(){
  253. let checked = $("#all").is(":checked");
  254. $(".checkItem").prop("checked",checked === true);
  255. if(checked){
  256. this.checkData = this.getCheckedIds();
  257. }else{
  258. this.checkData = [];
  259. }
  260. },
  261. getCheckedIds(){
  262. // HACK
  263. let values = [];
  264. let items = $(".checkItem:checked");
  265. let len = items.length,index =0;
  266. for (index =0;index <len;index++ ){
  267. values.push($(items[index]).val());
  268. }
  269. return values;
  270. },
  271. selectedColor(waveNo){
  272. if(waveNo === this.selectedWaveNo){
  273. this.selectedWaveNo = '';
  274. return;
  275. }
  276. this.selectedWaveNo = waveNo;
  277. },
  278. splitBatch(){
  279. window.tempTip.setDuration(2000);
  280. window.tempTip.setIndex(999);
  281. if (this.checkData.length<1){
  282. window.tempTip.show("未选中记录行");
  283. return;
  284. }
  285. if (!this.splitSize && !this.batchNumber){
  286. window.tempTip.show("未输入分割大小");
  287. return;
  288. }
  289. window.tempTip.postBasicRequest("{{url('order/wave/split')}}",{codes:this.checkData,split:this.splitSize,number:this.batchNumber},res=>{
  290. $("#splitBatch").modal('hide');
  291. return "分割成功";
  292. },true)
  293. },
  294. exePrint(){
  295. window.tempTip.setDuration(2000);
  296. if (this.checkData.length<1){
  297. window.tempTip.show("未选中记录行");
  298. return;
  299. }
  300. window.tempTip.postBasicRequest("{{url('order/wave/printChild')}}",{codes:this.checkData},res=>{
  301. this.splitGroupBySize = res;
  302. setTimeout(()=>{
  303. for(let key in this.splitGroupBySize){
  304. for (let i=1;i<=this.splitGroupBySize[key];i++){
  305. window.setBarcode(key+'-'+i, "#"+key+"-"+i, 2, 50, true)
  306. }
  307. }
  308. },10);
  309. setTimeout(()=>{
  310. exe();
  311. },50);
  312. })
  313. let exe = ()=>{
  314. let iframe=document.getElementById("print-iframe");
  315. this.infoShow=true;
  316. if(!iframe){
  317. iframe = document.createElement('IFRAME');
  318. iframe.setAttribute("id", "print-iframe");
  319. iframe.setAttribute('style', 'position:absolute;width:0;height:0;left:-500px;top:-500px;');
  320. document.body.appendChild(iframe);
  321. }else iframe.contentWindow.document.getElementById("iframe-content").remove();
  322. let doc = iframe.contentWindow.document;
  323. let el = document.getElementById("printContent");
  324. doc.write('<LINK rel="stylesheet" type="text/css" href="{{ asset(mix("css/app.css")) }}">');
  325. doc.write('<div id="iframe-content">' + el.innerHTML + '</div>');
  326. doc.close();
  327. iframe.contentWindow.focus();
  328. this.infoShow=false;
  329. setTimeout(function () {
  330. iframe.contentWindow.print();
  331. if (navigator.userAgent.indexOf("MSIE") > 0){
  332. document.body.removeChild(iframe);
  333. }
  334. },200);
  335. };
  336. },
  337. }
  338. });
  339. </script>
  340. @endsection