search.blade.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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. infoShow:false,
  134. splitGroupBySize:{},
  135. },
  136. mounted: function () {
  137. $('#wave_div').removeClass('d-none')
  138. let data = [[
  139. {name: 'start_time', type: 'dateTime', tip: '选择显示指定日期的起始时间', placeholder: ''},
  140. {name: 'end_time', type: 'dateTime', tip: '选择显示指定日期的结束时间', placeholder: ''},
  141. {name: 'wave_num', type: 'input', tip: '波次编号:如模糊搜索需要在条件前后输入%号,回车提交', placeholder: '波次编号'},
  142. ]];
  143. this.form = new query({
  144. el: '#form_div',
  145. condition: data,
  146. });
  147. this.form.init();
  148. $(".tooltipTarget").tooltip({'trigger': 'hover'});
  149. },
  150. methods: {
  151. repairBatch(){
  152. if (!this.batchCodes) return;
  153. window.tempTip.postBasicRequest("{{url('order/wave/repairBatch')}}",{"codes":this.batchCodes.split(",")},res=>{
  154. return res;
  155. },true);
  156. },
  157. singleCancelPrint: function ($event) {
  158. let ids = $($event.target).attr("data-value");
  159. if (ids) {
  160. this.cancelPrint(ids);
  161. }
  162. },
  163. batchCancelPrint: function () {
  164. if (this.checkData === 0) {
  165. tempTip.show('没有勾选记录');
  166. return;
  167. }
  168. let ids = this.getCheckedIds();
  169. this.cancelPrint(ids);
  170. },
  171. cancelPrint: function (ids, type = 'string') {
  172. let _this = this;
  173. tempTip.setDuration(99999)
  174. tempTip.waitingTip('取消中,请稍候')
  175. axios.post("{{url("order/wave/cancelPrinting")}}", {ids: ids}).then(function (res) {
  176. tempTip.setDuration(5000)
  177. tempTip.cancelWaitingTip();
  178. if (res.data.success) {
  179. _this.waves.forEach(function (wave) {
  180. if (ids.includes(wave.waveNo)) {
  181. wave.expressPrinting = '';
  182. wave.expressPrintTime = '';
  183. wave.UdfPrintFlag2 = 'N';
  184. }
  185. })
  186. tempTip.setDuration(3000);
  187. tempTip.showSuccess('重置打印成功!');
  188. if (type === 'array') {
  189. _this.checkData = [];
  190. }
  191. $(".checkItem").prop("checked",false);
  192. } else {
  193. tempTip.setDuration(2500);
  194. tempTip.show('标记勾选内容重置打印失败,错误:' + res.data.fail_info);
  195. }
  196. }).catch(function (err) {
  197. tempTip.setDuration(4000);
  198. tempTip.show('网络错误:' + err);
  199. });
  200. },
  201. pageTurning: function (event) {
  202. let page = $(event.target).val();
  203. if (!page) {
  204. return;
  205. }
  206. window.location = this.form.goPage(page);
  207. },
  208. pervPage() {
  209. window.location = this.form.pervPage();
  210. },
  211. nextPage() {
  212. window.location = this.form.nextPage();
  213. },
  214. exportExcel(string = 'all'){
  215. // let data = this.getSearch();
  216. let search = '';
  217. if(string === "all"){
  218. }else if(string === 'pitch'){
  219. if(this.getCheckedIds().length === 0){
  220. tempTip.show('没有勾选记录');
  221. return;
  222. }
  223. if(this.checkData){
  224. let seachs =this.checkData.map(function (value) {
  225. return "'"+value+"'";
  226. })
  227. search = "wave_num="+this.checkData.join(',');
  228. }
  229. }
  230. let url = window.location.search ;
  231. url = url.length< 2 ? '' : url.substring(1);
  232. window.open("{{url('order/wave/exportExcel?')}}"+search+url);
  233. },
  234. getSearch(){
  235. let search = window.location.search,data = {};
  236. if(!search || search.length <=1 ){
  237. return {};
  238. }
  239. let index =search.indexOf("?");
  240. search = (search.substr(index)).split('&');
  241. search.forEach(function(map){
  242. let arr = map.split('=');
  243. let key = arr[0],value = arr[2];
  244. if(value.include(',')){
  245. value = value.split(',');
  246. }
  247. data[key] = value;
  248. });
  249. return data;
  250. },
  251. checkAll(){
  252. let checked = $("#all").is(":checked");
  253. $(".checkItem").prop("checked",checked === true);
  254. if(checked){
  255. this.checkData = this.getCheckedIds();
  256. }else{
  257. this.checkData = [];
  258. }
  259. },
  260. getCheckedIds(){
  261. // HACK
  262. let values = [];
  263. let items = $(".checkItem:checked");
  264. let len = items.length,index =0;
  265. for (index =0;index <len;index++ ){
  266. values.push($(items[index]).val());
  267. }
  268. return values;
  269. },
  270. selectedColor(waveNo){
  271. if(waveNo === this.selectedWaveNo){
  272. this.selectedWaveNo = '';
  273. return;
  274. }
  275. this.selectedWaveNo = waveNo;
  276. },
  277. splitBatch(){
  278. window.tempTip.setDuration(2000);
  279. if (this.checkData.length<1){
  280. window.tempTip.show("未选中记录行");
  281. return;
  282. }
  283. if (!this.splitSize){
  284. window.tempTip.show("未输入分割大小");
  285. return;
  286. }
  287. window.tempTip.postBasicRequest("{{url('order/wave/split')}}",{codes:this.checkData,split:this.splitSize},res=>{})
  288. },
  289. exePrint(){
  290. window.tempTip.setDuration(2000);
  291. if (this.checkData.length<1){
  292. window.tempTip.show("未选中记录行");
  293. return;
  294. }
  295. window.tempTip.postBasicRequest("{{url('order/wave/printChild')}}",{codes:this.checkData},res=>{
  296. this.splitGroupBySize = res;
  297. this.infoShow = true;
  298. setTimeout(()=>{
  299. for(let key in this.splitGroupBySize){
  300. for (let i=1;i<=this.splitGroupBySize[key];i++){
  301. window.setBarcode(key+'-'+i, "#"+key+"-"+i, 3, 70, true)
  302. }
  303. }
  304. },100);
  305. setTimeout(()=>{
  306. exe();
  307. },200);
  308. })
  309. let exe = ()=>{
  310. let iframe=document.getElementById("print-iframe");
  311. this.infoShow=true;
  312. if(!iframe){
  313. iframe = document.createElement('IFRAME');
  314. iframe.setAttribute("id", "print-iframe");
  315. iframe.setAttribute('style', 'position:absolute;width:0;height:0;left:-500px;top:-500px;');
  316. document.body.appendChild(iframe);
  317. }else iframe.contentWindow.document.getElementById("iframe-content").remove();
  318. let doc = iframe.contentWindow.document;
  319. let el = document.getElementById("printContent");
  320. doc.write('<LINK rel="stylesheet" type="text/css" href="{{ asset(mix("css/app.css")) }}">');
  321. doc.write('<div id="iframe-content">' + el.innerHTML + '</div>');
  322. doc.close();
  323. iframe.contentWindow.focus();
  324. this.infoShow=false;
  325. setTimeout(function () {
  326. iframe.contentWindow.print();
  327. if (navigator.userAgent.indexOf("MSIE") > 0){
  328. document.body.removeChild(iframe);
  329. }
  330. },200);
  331. };
  332. },
  333. }
  334. });
  335. </script>
  336. @endsection