| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- let vueList=new Vue({
- el:"#list",
- data:{
- filterParams:{created_at:'',owner_id:'',order_number:'',logistic_number_return:'',mobile_sender:'',barcode_goods:'',
- is_checked:'',created_at_start:'',created_at_end:'',id_quality_label:'',is_loaded:'',checked_numbers:'',paginate:'50'},
- checkBoxAll:[],
- rejectedBills:rejectedBills,
- rejectedBills_checkBoxes:[],
- owners:owners,
- qualityLabels:qualityLabels,
- },
- mounted:function(){
- $(".tooltipTarget").tooltip({'trigger':'hover'});
- this.initInputs();
- $('#list').removeClass('d-none');
- },
- methods:{
- filterRun:function(){
- let form=$("<form method='get'></form>");
- this.filterParams['page']='';
- for(let key in this.filterParams){
- if(this.filterParams[key]){
- form.append($("<input type='hidden' name='"+key+"' value='"+this.filterParams[key]+"'>"));
- }
- }
- $("body").append(form);
- form.submit();
- },
- created_at_startChange:function(e){
- this.filterParams.created_at_start=e.target.value;
- this.filterRun();
- },
- created_at_endChange:function(e){
- this.filterParams.created_at_end=e.target.value;
- this.filterRun();
- },
- owner_idChange:function(e){
- this.filterParams.owner_id=e.target.value;
- this.filterRun();
- },
- is_checkedChange:function(e){
- this.filterParams.is_checked=e.target.value;
- this.filterRun();
- },
- id_quality_labelChange:function(e){
- this.filterParams.id_quality_label=e.target.value;
- this.filterRun();
- },
- is_loadedChange:function(e){
- this.filterParams.is_loaded=e.target.value;
- this.filterRun();
- },
- mobile_senderChange:function(e){
- this.filterParams.mobile_sender=e.target.value;
- this.filterRun();
- },
- checked_numbersChange:function(e){
- this.filterParams.checked_numbers=e.target.value;
- this.filterRun();
- },
- initInputs:function(){
- let data=this;
- // let uriParts = decodeURI(location.href).split("?");
- // if(uriParts.length>1){
- // let params = uriParts[1].split('&');
- // params.forEach(function(paramPair){
- // let pair=paramPair.split('=');
- // let key = pair[0], val = pair[1];
- // $('input[name="'+key+'"]').val(val);
- // $('select[name="'+key+'"]').val(val);
- // data.filterParams[key]=val;
- // });
- // }
- for(let key in paginateParams){
- let val = paginateParams[key];
- $('input[name="'+key+'"]').val(val);
- $('select[name="'+key+'"]').val(val);
- data.filterParams[key]=val;
- }
- },
- edit:function(e){
- let id = $(e.target).parents('tr').attr('data-id');
- let editFullUri = editUrl+id+"/edit";
- // location.href = editFullUri;
- let form=$('<form action=\"'+editFullUri+'\" method="post" target="_blank"></form>');
- form.append('<input type="hidden" name="filterParams" value=\''+JSON.stringify(this.filterParams)+'\'/>');
- form.append(csrfInput);
- $('body').append(form);
- form.submit();
- },
- destroy:function(rejectedBill){
- if(!confirm('确定要删除退货信息“' + rejectedBill.owner.name+':'+rejectedBill.logistic_number_return+ '”吗?')){return;}
- let data=this;
- let url = destroyUrl+rejectedBill.id;
- axios.delete(url,{id:rejectedBill.id})
- .then(function (response) {
- if(response.data.success){
- for (let i = 0; i < data.rejectedBills.length; i++) {
- if (data.rejectedBills[i].id===rejectedBill.id){
- data.rejectedBills.splice(i,1);
- break;
- }
- }
- tempTip.setDuration(1000);
- tempTip.showSuccess('删除退货信息"'+rejectedBill.owner.name+':'+rejectedBill.logistic_number_return+'"成功!')
- }else{
- tempTip.setDuration(1000);
- tempTip.show('删除退货信息"'+rejectedBill.owner.name+':'+rejectedBill.logistic_number_return+'"失败!')
- }
- })
- .catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('删除退货信息失败!'+'网络错误:' + err);
- console.log(err);
- });
- },
- created_at_startEntering:function(e){
- if(e.key==='Enter'){
- this.created_at_startChange(e)
- }
- },
- created_at_endEntering:function(e){
- if(e.key==='Enter'){
- this.created_at_endChange(e)
- }
- },
- owner_idEntering:function(e){
- if(e.key==='Enter'){
- e.target.value=$('#owner_id').val();
- this.owner_idChange(e);
- e.target.value='';
- }
- },
- locateOwner:function (e) {
- str = e.target.value.trim()
- if (str==='')return ;
- $("#owner_id option").attr("selected",false);
- let selectingOption=$("#owner_id").find("option:contains("+str+")").eq(0);
- selectingOption.attr("selected",true);
- // this.filterParams.owner_id=selectingOption.val();
- },
- order_numberEntering:function(e){
- if(e.key==='Enter'){
- this.filterParams.order_number=e.target.value;
- this.filterRun();
- }
- },
- barcode_goodsEntering:function(e){
- if(e.key==='Enter'){
- this.filterParams.barcode_goods=e.target.value;
- this.filterRun();
- }
- },
- logistic_number_returnEntering:function(e){
- if(e.key==='Enter'){
- this.filterParams.logistic_number_return=e.target.value;
- this.filterRun();
- }
- },
- logistic_numberEntering:function(e){
- if(e.key==='Enter'){
- this.filterParams.logistic_number=e.target.value;
- this.filterRun();
- }
- },
- cancelCheckConfirmAll:function(){
- $('#checkConfirmingAll').tooltip('hide');
- setTimeout(function () {
- $(".tooltipTarget").tooltip({'trigger':'hover'})
- }, 10);
- this.checkBoxAll=false;
- this.rejectedBills.forEach(function(rejectedBill){
- if(rejectedBill.is_checked===-1)
- rejectedBill.is_checked='0';
- })
- },
- setIsLoaded_batch:function(e){
- let _this=this;
- if(_this.rejectedBills_checkBoxes.length===0){
- tempTip.show('没有勾选记录');
- $(e.target).val("");
- return;
- }
- let val=$(e.target).val();
- let is_loaded=0;
- let is_loadedLabel='否';
- if(val==="1"){
- is_loaded=1;
- is_loadedLabel='是';
- }else if(val==="2"){
- is_loaded=2;
- is_loadedLabel='待推单';
- }else if(val==="null"){
- is_loaded='null';
- is_loadedLabel='无需入库';
- }
- if(!confirm("确定要标记所有勾选入库情况为'"+is_loadedLabel+"'吗")){return;}
- axios.post(ajaxCheckUrl,{ids:_this.rejectedBills_checkBoxes,is_loaded:is_loaded}).then(function(response){
- if(response.data.success){
- _this.rejectedBills_checkBoxes.forEach(function(id){
- _this.rejectedBills.forEach(function(bill){
- if(bill.id===id){
- bill.is_loaded=is_loaded;
- }
- });
- });
- tempTip.setDuration(1000);
- tempTip.showSuccess('修改勾选记录的入库状态成功');
- }else{
- tempTip.setDuration(2500);
- tempTip.show('修改勾选记录的入库状态失败,错误:'+response.data.fail_info);
- }
- }).catch(function (e) {
- alert('网络连接错误:'+e);
- tempTip.setDuration(2500);
- tempTip.show('审核勾选内容失败,网络连接错误:'+e);
- console.log(e);
- });
- $(e.target).val("")
- },
- checkBoxAllToggle:function(e){
- let _this=this;
- if(_this.rejectedBills_checkBoxes.length>=this.rejectedBills.length){
- _this.rejectedBills_checkBoxes=[];
- _this.checkBoxAll=[];
- }
- else{
- _this.rejectedBills_checkBoxes=[];
- this.rejectedBills.forEach(function(bill){
- _this.rejectedBills_checkBoxes.push(bill.id);
- _this.checkBoxAll=[1];
- });
- }
- },
- checkAll:function(){
- let _this=this;
- if(_this.rejectedBills_checkBoxes.length===0){
- tempTip.show('没有勾选记录');
- return
- }
- if(!confirm("确定要标记所有勾选内容为'已审核'吗")){return;}
- axios.post(ajaxCheckAllURL,{ids:_this.rejectedBills_checkBoxes}).then(function(response){
- if(response.data.success){
- response.data.rejecteds.forEach(function (rejected) {
- _this.rejectedBills.forEach(function(rejectedBill){
- if(parseInt(rejectedBill.id)===parseInt(rejected.id)){
- rejectedBill.is_checked=1;
- rejectedBill.checked_numbers=rejected.checked_numbers;
- }
- });
- });
- tempTip.setDuration(1000);
- tempTip.showSuccess('审核勾选内容成功');
- }else{
- tempTip.setDuration(2500);
- tempTip.show('审核勾选内容失败,错误:'+response.data.fail_info);
- }
- }).catch(function (e) {
- alert('网络连接错误:'+e);
- tempTip.setDuration(2500);
- tempTip.show('审核勾选内容失败,网络连接错误:'+e);
- console.log(e);
- })
- },
- finishAll:function(){
- let _this=this;
- if(_this.rejectedBills_checkBoxes.length===0){
- tempTip.show('没有勾选记录');
- return
- }
- if(!confirm("确定要标记所有勾选内容为'已完结'吗")){return;}
- axios.post(ajaxFinishAllUrl,{ids:_this.rejectedBills_checkBoxes}).then(function(response){
- if(response.data.success){
- _this.rejectedBills.forEach(function(rejectedBill){
- _this.rejectedBills_checkBoxes.forEach(function (checkedId) {
- if(rejectedBill.id===checkedId){
- rejectedBill.is_finished=1;
- }
- });
- });
- tempTip.setDuration(1000);
- tempTip.showSuccess('标记勾选内容为完结成功');
- }else{
- tempTip.setDuration(2500);
- tempTip.show('标记勾选内容为完结失败,错误:'+response.data.fail_info);
- }
- }).catch(function (e) {
- alert('网络连接错误:'+e);
- tempTip.setDuration(2500);
- tempTip.show('标记勾选内容完结失败,网络连接错误:'+e);
- console.log(e);
- })
- },
- exportExcel:function(e){
- let _this=this;
- let val=$(e.target).val();
- $(e.target).val("");
- let form;
- if(val==="1"){
- if(_this.rejectedBills_checkBoxes.length===0){
- tempTip.show('没有勾选记录');
- return;
- }
- form=$('<form action=\"'+exportExcelURL+'\" method="post" target="_blank"></form>');
- form.append('<input type="hidden" name="ids" value=\''+JSON.stringify(_this.rejectedBills_checkBoxes)+'\'/>');
- }
- if(val==="2"){
- if(!confirm("确定要导出当前条件下全部页的结果吗?")){return;}
- if(total>100000){
- tempTip.okWindow('当前导出记录超过100000条,将不会导出已完结的记录','知道了')
- }
- form=$('<form action=\"'+exportExcelOnFilterParamsURL+'\" method="post" target="_blank"></form>');
- form.append('<input type="hidden" name="filterParams" value=\''+JSON.stringify(_this.filterParams)+'\'/>');
- }
- form.append(csrfInput);
- $('#list').append(form);
- form.submit();
- tempTip.setDuration(5000);
- tempTip.showSuccess("导出成功,如无结果则是被浏览器拦截新窗口,请尝试再次请求,或关闭浏览器对当前页面的弹出窗口拦截")
- },
- setPaginate:function(e){
- let _this=this;
- // let val=$(e.target).val();
- this.filterParams.paginate=e.target.value;
- this.filterRun();
- },
- },
- computed:{
- isBeingFilterConditions:function(){
- for(let key in this.filterParams){
- if(this.filterParams[key]){
- if(key==='paginate')continue;
- if(key==='page')continue;
- return true
- }
- }
- return false;
- }
- },
- filters:{
- yesNo:function (val) {
- if(!val||val===0||val==='0'){return '否'}
- return '是'
- },
- yesNoIsLoaded:function (val) {
- switch(val){
- case 0:case '0':return '否';
- case 1:case '1':return '是';
- case 2:case '2':return '待推单';
- case null:case 'null':return '无需入库';
- }
- return '';
- }
- }
- });
|