searchAnalyze.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. let vueList=new Vue({
  2. el:"#list",
  3. data:{
  4. filterParams:{created_at:'',owner_id:'',
  5. //,order_number:'',logistic_number_return:'',mobile_sender:'',barcode_goods:'',
  6. //is_checked:'',
  7. created_at_start:'',created_at_end:'',
  8. //id_quality_label:'',
  9. //is_loaded:'',
  10. //checked_numbers:'',
  11. // paginate:'50'
  12. },
  13. checkBoxAll:[],
  14. rejectedBills:rejectedBills,
  15. rejectedBills_checkBoxes:[],
  16. owners:owners,
  17. qualityLabels:qualityLabels,
  18. },
  19. mounted:function(){
  20. $(".tooltipTarget").tooltip({'trigger':'hover'});
  21. this.initInputs();
  22. $('#list').removeClass('d-none');
  23. },
  24. methods:{
  25. filterRun:function(){
  26. let form=$("<form method='get'></form>");
  27. this.filterParams['page']='';
  28. for(let key in this.filterParams){
  29. if(this.filterParams[key]){
  30. form.append($("<input type='hidden' name='"+key+"' value='"+this.filterParams[key]+"'>"));
  31. }
  32. }
  33. $("body").append(form);
  34. form.submit();
  35. },
  36. searchByFilters:function(e){
  37. this.filterRun();
  38. },
  39. created_at_startChange:function(e){
  40. this.filterParams.created_at_start=e.target.value;
  41. this.filterRun();
  42. },
  43. created_at_endChange:function(e){
  44. this.filterParams.created_at_end=e.target.value;
  45. this.filterRun();
  46. },
  47. owner_idChange:function(e){
  48. this.filterParams.owner_id=e.target.value;
  49. this.filterRun();
  50. },
  51. is_checkedChange:function(e){
  52. this.filterParams.is_checked=e.target.value;
  53. this.filterRun();
  54. },
  55. id_quality_labelChange:function(e){
  56. this.filterParams.id_quality_label=e.target.value;
  57. this.filterRun();
  58. },
  59. is_loadedChange:function(e){
  60. this.filterParams.is_loaded=e.target.value;
  61. this.filterRun();
  62. },
  63. initInputs:function(){
  64. let data=this;
  65. let uriParts = decodeURI(location.href).split("?");
  66. if(uriParts.length>1){
  67. let params = uriParts[1].split('&');
  68. params.forEach(function(paramPair){
  69. let pair=paramPair.split('=');
  70. let key = pair[0], val = pair[1];
  71. $('input[name="'+key+'"]').val(val);
  72. $('select[name="'+key+'"]').val(val);
  73. data.filterParams[key]=val;
  74. });
  75. }
  76. for(let key in paginateParams){
  77. let val = paginateParams[key];
  78. $('input[name="'+key+'"]').val(val);
  79. $('select[name="'+key+'"]').val(val);
  80. data.filterParams[key]=val;
  81. }
  82. },
  83. // edit:function(e){
  84. // let id = $(e.target).parents('tr').attr('data-id');
  85. // let editFullUri = editUrl+id+"/edit";
  86. // // location.href = editFullUri;
  87. // let form=$('<form action=\"'+editFullUri+'\" method="post" target="_blank"></form>');
  88. // form.append('<input type="hidden" name="filterParams" value=\''+JSON.stringify(this.filterParams)+'\'/>');
  89. // form.append(csrfInput);
  90. // $('body').append(form);
  91. // form.submit();
  92. // },
  93. // destroy:function(rejectedBill){
  94. // if(!confirm('确定要删除退货信息“' + rejectedBill.owner.name+':'+rejectedBill.logistic_number_return+ '”吗?')){return;}
  95. // let data=this;
  96. // let url = destroyUrl+rejectedBill.id;
  97. // axios.delete(url,{id:rejectedBill.id})
  98. // .then(function (response) {
  99. // if(response.data.success){
  100. // for (let i = 0; i < data.rejectedBills.length; i++) {
  101. // if (data.rejectedBills[i].id===rejectedBill.id){
  102. // data.rejectedBills.splice(i,1);
  103. // break;
  104. // }
  105. // }
  106. // tempTip.setDuration(1000);
  107. // tempTip.showSuccess('删除退货信息"'+rejectedBill.owner.name+':'+rejectedBill.logistic_number_return+'"成功!')
  108. // }else{
  109. // tempTip.setDuration(1000);
  110. // tempTip.show('删除退货信息"'+rejectedBill.owner.name+':'+rejectedBill.logistic_number_return+'"失败!')
  111. // }
  112. // })
  113. // .catch(function (err) {
  114. // tempTip.setDuration(3000);
  115. // tempTip.show('删除退货信息失败!'+'网络错误:' + err);
  116. // console.log(err);
  117. // });
  118. // },
  119. submitFilterOnEnter:function(e){
  120. if(e.key==='Enter'){
  121. this.filterRun();
  122. }
  123. },
  124. created_at_startEntering:function(e){
  125. if(e.key==='Enter'){
  126. this.created_at_startChange(e)
  127. }
  128. },
  129. created_at_endEntering:function(e){
  130. if(e.key==='Enter'){
  131. this.created_at_endChange(e)
  132. }
  133. },
  134. owner_idEntering:function(e){
  135. if(e.key==='Enter'){
  136. e.target.value=$('#owner_id').val();
  137. this.owner_idChange(e);
  138. e.target.value='';
  139. }
  140. },
  141. locateOwner:function (e) {
  142. str = e.target.value.trim()
  143. if (str==='')return ;
  144. $("#owner_id option").attr("selected",false);
  145. let selectingOption=$("#owner_id").find("option:contains("+str+")").eq(0);
  146. selectingOption.attr("selected",true);
  147. this.filterParams.owner_id=selectingOption.val();
  148. },
  149. // mobile_senderEntering:function(e){
  150. // this.filterParams.mobile_sender=e.target.value;
  151. // if(e.key==='Enter'){
  152. // this.filterRun();
  153. // }
  154. // },
  155. // order_numberEntering:function(e){
  156. // this.filterParams.order_number=e.target.value;
  157. // if(e.key==='Enter'){
  158. // this.filterRun();
  159. // }
  160. // },
  161. // barcode_goodsEntering:function(e){
  162. // this.filterParams.barcode_goods=e.target.value;
  163. // if(e.key==='Enter'){
  164. // this.filterRun();
  165. // }
  166. // },
  167. // checked_numbersEntering:function(e){
  168. // this.filterParams.checked_numbers=e.target.value;
  169. // if(e.key==='Enter'){
  170. // this.filterRun();
  171. // }
  172. // },
  173. logistic_number_returnEntering:function(e){
  174. this.filterParams.logistic_number_return=e.target.value;
  175. if(e.key==='Enter'){
  176. this.filterRun();
  177. }
  178. },
  179. logistic_numberEntering:function(e){
  180. this.filterParams.logistic_number=e.target.value;
  181. if(e.key==='Enter'){
  182. this.filterRun();
  183. }
  184. },
  185. cancelCheckConfirmAll:function(){
  186. $('#checkConfirmingAll').tooltip('hide');
  187. setTimeout(function () {
  188. $(".tooltipTarget").tooltip({'trigger':'hover'})
  189. }, 10);
  190. this.checkBoxAll=false;
  191. this.rejectedBills.forEach(function(rejectedBill){
  192. if(rejectedBill.is_checked===-1)
  193. rejectedBill.is_checked='0';
  194. })
  195. },
  196. // setIsLoaded_batch:function(val){
  197. // let _this=this;
  198. // if(_this.rejectedBills_checkBoxes.length===0){
  199. // tempTip.show('没有勾选记录');
  200. // $(e.target).val("");
  201. // return;
  202. // }
  203. // let is_loaded=0;
  204. // let is_loadedLabel='否';
  205. // if(parseInt(val)===1){
  206. // is_loaded=1;
  207. // is_loadedLabel='是';
  208. // }else if(parseInt(val)===2){
  209. // is_loaded=2;
  210. // is_loadedLabel='待推单';
  211. // }else if(parseInt(val)===4){
  212. // is_loaded=4;
  213. // is_loadedLabel='待确认';
  214. // }else if(val==="null"){
  215. // is_loaded='null';
  216. // is_loadedLabel='无需入库';
  217. // }
  218. // if(!confirm("确定要标记所有勾选入库情况为'"+is_loadedLabel+"'吗")){return;}
  219. // axios.post(ajaxCheckUrl,{ids:_this.rejectedBills_checkBoxes,is_loaded:is_loaded}).then(function(response){
  220. // if(response.data.success){
  221. // _this.rejectedBills_checkBoxes.forEach(function(id){
  222. // _this.rejectedBills.forEach(function(bill){
  223. // if(bill.id===id){
  224. // bill.is_loaded=is_loaded;
  225. // }
  226. // });
  227. // });
  228. // tempTip.setDuration(1000);
  229. // tempTip.showSuccess('修改勾选记录的入库状态成功');
  230. // }else{
  231. // tempTip.setDuration(2500);
  232. // tempTip.show('修改勾选记录的入库状态失败,错误:'+response.data.fail_info);
  233. // }
  234. // }).catch(function (e) {
  235. // alert('网络连接错误:'+e);
  236. // tempTip.setDuration(2500);
  237. // tempTip.show('审核勾选内容失败,网络连接错误:'+e);
  238. // console.log(e);
  239. // });
  240. // $(e.target).val("")
  241. // },
  242. checkBoxAllToggle:function(e){
  243. let _this=this;
  244. if(_this.rejectedBills_checkBoxes.length>=this.rejectedBills.length){
  245. _this.rejectedBills_checkBoxes=[];
  246. _this.checkBoxAll=[];
  247. }
  248. else{
  249. _this.rejectedBills_checkBoxes=[];
  250. this.rejectedBills.forEach(function(bill){
  251. _this.rejectedBills_checkBoxes.push(bill.id);
  252. _this.checkBoxAll=[1];
  253. });
  254. }
  255. },
  256. // checkAll:function(){
  257. // let _this=this;
  258. // if(_this.rejectedBills_checkBoxes.length===0){
  259. // tempTip.show('没有勾选记录');
  260. // return
  261. // }
  262. // if(!confirm("确定要标记所有勾选内容为'已审核'吗")){return;}
  263. // axios.post(ajaxCheckAllURL,{ids:_this.rejectedBills_checkBoxes}).then(function(response){
  264. // if(response.data.success){
  265. // response.data.rejecteds.forEach(function (rejected) {
  266. // _this.rejectedBills.forEach(function(rejectedBill){
  267. // if(parseInt(rejectedBill.id)===parseInt(rejected.id)){
  268. // rejectedBill.is_checked=1;
  269. // rejectedBill.checked_numbers=rejected.checked_numbers;
  270. // }
  271. // });
  272. // });
  273. // tempTip.setDuration(1000);
  274. // tempTip.showSuccess('审核勾选内容成功');
  275. // }else{
  276. // tempTip.setDuration(2500);
  277. // tempTip.show('审核勾选内容失败,错误:'+response.data.fail_info);
  278. // }
  279. // }).catch(function (e) {
  280. // alert('网络连接错误:'+e);
  281. // tempTip.setDuration(2500);
  282. // tempTip.show('审核勾选内容失败,网络连接错误:'+e);
  283. // console.log(e);
  284. // })
  285. // },
  286. // confirmBeStored:function($e,id){
  287. // let _this=this;
  288. // axios.post(ajaxConfirmBeStoredUrl,{id:id}).then(function(response){
  289. // if(response.data.success){
  290. // _this.rejectedBills.forEach(function(rejectedBill){
  291. // if(rejectedBill.id===id){
  292. // rejectedBill.is_loaded=1;
  293. // }
  294. // });
  295. // tempTip.setDuration(1000);
  296. // tempTip.showSuccess('确认入库成功');
  297. // }else{
  298. // tempTip.setDuration(2500);
  299. // tempTip.okWindow('数据异常无法确认!请在WMS确定入库状态后,勾选该条目手动修改相应入库状态!','知道了')
  300. // }
  301. // }).catch(function (e) {
  302. // alert('确认失败,网络连接错误:'+e);
  303. // tempTip.setDuration(2500);
  304. // tempTip.show('确认失败,网络连接错误:'+e);
  305. // console.log(e);
  306. // })
  307. // },
  308. // finishAll:function(){
  309. // let _this=this;
  310. // if(_this.rejectedBills_checkBoxes.length===0){
  311. // tempTip.show('没有勾选记录');
  312. // return
  313. // }
  314. // if(!confirm("确定要标记所有勾选内容为'已完结'吗")){return;}
  315. // axios.post(ajaxFinishAllUrl,{ids:_this.rejectedBills_checkBoxes}).then(function(response){
  316. // if(response.data.success){
  317. // _this.rejectedBills.forEach(function(rejectedBill){
  318. // _this.rejectedBills_checkBoxes.forEach(function (checkedId) {
  319. // if(rejectedBill.id===checkedId){
  320. // rejectedBill.is_finished=1;
  321. // }
  322. // });
  323. // });
  324. // tempTip.setDuration(1000);
  325. // tempTip.showSuccess('标记勾选内容为完结成功');
  326. // }else{
  327. // tempTip.setDuration(2500);
  328. // tempTip.show('标记勾选内容为完结失败,错误:'+response.data.fail_info);
  329. // }
  330. // }).catch(function (e) {
  331. // alert('网络连接错误:'+e);
  332. // tempTip.setDuration(2500);
  333. // tempTip.show('标记勾选内容完结失败,网络连接错误:'+e);
  334. // console.log(e);
  335. // })
  336. // },
  337. exportExcel:function(val){
  338. let _this=this;
  339. let form;
  340. if(parseInt(val)===1){
  341. if(_this.rejectedBills_checkBoxes.length===0){
  342. tempTip.show('没有勾选记录');
  343. return;
  344. }
  345. form=$('<form action=\"'+exportExcelURL+'\" method="post" target="_blank"></form>');
  346. form.append('<input type="hidden" name="ids" value=\''+JSON.stringify(_this.rejectedBills_checkBoxes)+'\'/>');
  347. }
  348. if(parseInt(val)===2){
  349. if(!confirm("确定要导出当前条件下全部页的结果吗?")){return;}
  350. /* if(total>100000){
  351. tempTip.okWindow('当前导出记录超过100000条,将不会导出已完结的记录','知道了')
  352. }*/
  353. form=$('<form action=\"'+exportExcelOnFilterParamsURL+'\" method="post" target="_blank"></form>');
  354. form.append('<input type="hidden" name="owner_id" value=\''+JSON.stringify(_this.filterParams.owner_id)+'\'/>');
  355. }
  356. form.append('<input type="hidden" name="created_at_start" value=\''+JSON.stringify(_this.filterParams.created_at_start)+'\'/>');
  357. form.append('<input type="hidden" name="created_at_end" value=\''+JSON.stringify(_this.filterParams.created_at_end)+'\'/>');
  358. form.append(csrfInput);
  359. $('#list').append(form);
  360. form.submit();
  361. tempTip.setDuration(5000);
  362. tempTip.showSuccess("导出成功,如无结果则是被浏览器拦截新窗口,请尝试再次请求,或关闭浏览器对当前页面的弹出窗口拦截")
  363. },
  364. },
  365. computed:{
  366. isBeingFilterConditions:function(){
  367. for(let key in this.filterParams){
  368. if(this.filterParams[key]){
  369. if(key==='paginate')continue;
  370. if(key==='page')continue;
  371. return true
  372. }
  373. }
  374. return false;
  375. }
  376. },
  377. // filters:{
  378. // yesNo:function (val) {
  379. // if(!val||val===0||val==='0'){return '否'}
  380. // return '是'
  381. // },
  382. // yesNoIsLoaded:function (val) {
  383. // switch(val){
  384. // case 0:case '0':return '否';
  385. // case 1:case '1':return '是';
  386. // case 2:case '2':return '待推单';
  387. // case 3:case '3':return '交互异常';
  388. // case 4:case '4':return '待确认';
  389. // case null:case 'null':return '无需入库';
  390. // }
  391. // return '';
  392. // }
  393. // }
  394. });