Просмотр исходного кода

项目管理新需求与部分BUG解决

Zhouzhendong 5 лет назад
Родитель
Сommit
9d9cbfd89f

+ 10 - 1
app/Http/Controllers/TestController.php

@@ -163,7 +163,16 @@ class TestController extends Controller
 
     public function test()
     {
-        return view("test1");
+        $waybills = Waybill::query()->with("order")->where("created_at","<=","2021-03-31 23:59:59")
+            ->whereNotNull("order_id")->get();
+        foreach ($waybills as $waybill){
+            if ($waybill->order){
+                $result = DB::selectOne(DB::raw("SELECT 1 FROM WMS_USER.DOC_ORDER_HEADER where orderno = ? and carrierid like '%DF%'"),[$waybill->order->code]);
+                if ($result && $waybill->is_to_pay==0)$waybill->update(["is_to_pay"=>1]);
+            }
+        }
+        dd("OK");
+        return view("test");
     }
     public function handle()
     {

+ 34 - 123
resources/views/transport/waybill/index.blade.php

@@ -31,7 +31,7 @@
             </div>
             <div id="form_div"></div>
             <span class="dropdown">
-                <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
+                <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
                         data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
                     导出Excel
                 </button>
@@ -46,27 +46,10 @@
                     <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
                 @endif
             </div>
-            <label for="all" class="d-none" id="cloneCheckAll">
-                <input id="all" type="checkbox" @click="checkAll($event)">全选
-            </label>
-            <table class="table table-striped table-sm table-bordered table-hover text-nowrap d-none" id="headerRoll"></table>
-            <table class="table table-striped table-sm table-bordered table-hover text-nowrap waybill-table" style="background: #fff;" id="headerParent">
-                <tr>
-                    <th class="table-header-layer-1" colspan="4"></th>
-                    <th class="table-header-layer-1" colspan="14"><span class="fa fa-file-text-o"></span> 运单信息</th>
-                    <th class="table-header-layer-1" colspan="16"><span class="fa fa-truck"></span> 运输信息</th>
-                    <th class="table-header-layer-1" colspan="5"><span class="fa fa-rmb"></span> 费用信息
-                    @can('运输管理-运单-删除')
-                        <th class="table-header-layer-1" colspan="1"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
-                    @endcan
-                </tr>
-                <tr id="header"></tr>
-
+            <table class="table table-striped table-sm table-bordered table-hover text-nowrap waybill-table td-min-width-80" style="background: #fff;" id="table">
                 <tr v-for="(waybill,i) in waybills" :style="[{color:waybill.status=='待重审'?'red':''||waybill.status=='已完结'?'green':''},{'font-weight': waybill.id==selectedStyle?'bold':''}]"
                     :id="'waybill'+waybill.id" @click="selectedColor(waybill.id,$event)" position="static" @mouseover="hidetop($event)" @mouseleave="showtop($event)">
-                    <td>
-                        <input class="checkItem" type="checkbox" :value="waybill.id" v-model="checkData">
-                    </td>
+                    <td><input class="checkItem" type="checkbox" :value="waybill.id"></td>
                     <td>
                         <span v-if=waybill.status==="未审核"||waybill.status==="待重审">
                             @can('运输管理-运单-运单审核')
@@ -168,12 +151,6 @@
                         <span v-if="waybill.carrier_bill">
                             @{{waybill.carrier_bill}}<span v-if="waybill.carType">/@{{ waybill.carType.name }}<i v-if="waybill.carType.length">(@{{waybill.carType.length}}米)</i></span>
                         </span>
-{{--                        <span v-if="waybill.type==='专线'">@{{waybill.carrier_bill}}</span>--}}
-{{--                        <span v-if="waybill.type==='直发车'">--}}
-{{--                            <span v-if="waybill.carType">--}}
-{{--                                @{{ waybill.carType.name }}<i v-if="waybill.carType.length">(@{{waybill.carType.length}}米)</i>--}}
-{{--                            </span>--}}
-{{--                        </span>--}}
                     </td>
                     <td class="td-cool">
                         <span v-if="waybill.type === '直发车'">
@@ -274,7 +251,7 @@
             background: #fffff8;
         }
         .top{
-            padding-top: 0px;
+            padding-top: 0;
             padding-left: 10px;
             margin-top: -4px;
             margin-left: -5px;
@@ -358,7 +335,6 @@
                     },
                     @endforeach
                 ],
-                checkData:[],
                 selectedStyle:[],
                 owners:[
                         @foreach($owners as $owner)
@@ -391,30 +367,9 @@
                 size:0,
                 selectTr:''
             },
-            watch:{
-                checkData:{
-                    handler(){
-                        if (this.checkData.length === this.waybills.length){
-                            document.querySelector('#all').checked = true;
-                            document.querySelector('#all_temp').checked = true;
-                        }else {
-                            document.querySelector('#all').checked = false;
-                            document.querySelector('#all_temp').checked = false;
-                        }
-                    },
-                    deep:true
-                },
-            },
             mounted:function(){
                 $(".tooltipTarget").tooltip({'trigger':'hover'});
                 $('#list').removeClass('d-none');
-                let waybill =  $('.table-header-layer-1')[1];
-                $('.top').css('min-width', waybill.scrollWidth);
-                /*this.imgs=Array.from(document.getElementById('list').querySelectorAll('img'));
-                this.lazy();
-                if (this.imgs&&this.imgs.length>0){
-                    window.addEventListener('scroll',this.lazy)
-                }*/
                 let data=[
                     [
                         {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
@@ -445,8 +400,6 @@
                 });
                 this.form.init();
                 let column = [
-                    {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
-                        dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
                     @can('运输管理-编辑','运输管理-运单-运单审核','运输管理-运单-调度','运输管理-编辑')
                     {name:'operation',value: '操作', neglect: true, class:"td-operation"},@endcan
                     {name:'onTop',value: '置顶', neglect: true, class:"td-operation"},
@@ -488,20 +441,23 @@
                     {name:'dispatch_remark',value: '调度备注', class:"td-helpful"},
                     @can('运输管理-运单-删除'){name:'remove',value: '操作', neglect: true, class:"td-delete"},@endcan
                 ];
-                let _this = this;
-                setTimeout(function () {
-                    let header = new Header({
-                        el: "#header",
-                        column: column,
-                        data: _this.waybills,
-                        restorationColumn: 'id',
-                        fixedTop:($('#form_div').height())+2,
-                        offset:0.5,
-                        vue : vue,
-                    });
-                    header.init();
-                },0);
+                new Header({
+                    el: "table",
+                    column: column,
+                    data: this.waybills,
+                    restorationColumn: 'id',
+                    fixedTop:($('#form_div').height())+2,
+                    before : [
+                        {colspan:'4',value: '', class:"table-header-layer-1"},
+                        {colspan:'14',value: '运单信息',font:"fa fa-file-text-o", class:"table-header-layer-1"},
+                        {colspan:'16',value: '运输信息',font:"fa fa-truck", class:"table-header-layer-1"},
+                        {colspan:'5',value: '运输信息',font:"fa fa-rmb", class:"table-header-layer-1"},
+                        @can('运输管理-运单-删除'){colspan:'1',value: '',font:"", class:"table-header-layer-1"},@endcan
+                    ],
+                }).init();
                 this.paginate = $("#paginate").val();
+                let waybill =  $('.table-header-layer-1')[1];
+                $('.top').css('min-width', waybill.scrollWidth);
             },
             methods:{
                 btnRefreshWeightZoomIn(waybill){
@@ -510,37 +466,11 @@
                 btnRefreshWeightZoomOut(waybill){
                     waybill.btn_refresh_weight='zoomOut'
                 },
-                /*lazy(){
-                    //高度
-                    let h=(window.innerWidth)+(document.documentElement.scrollTop || document.body.scrollTop);
-                    this.imgs.forEach((img,i)=>{
-                        let src = img.getAttribute('data-src');
-                        if ((h>this.getElementToPageTop(img)-500) && src){
-                            let t = new Image();
-                            t.src = src;
-                            if (t.complete) {
-                                img.src = src;
-                                this.$delete(this.imgs,i);
-                                return;
-                            }
-                            t.onload = ()=>{
-                                img.src = src;
-                                this.$delete(this.imgs,i);
-                            };
-                        }
-                    });
-                },
-                getElementToPageTop(el) {
-                    if(el.parentElement) {
-                        return this.getElementToPageTop(el.parentElement) + el.offsetTop
-                    }
-                    return el.offsetTop
-                },*/
                 waybillAudit(id,waybill_number){
                     if(!confirm('确定要通过“'+waybill_number+'”的审核吗?')){return};
                     let _this=this;
                     let w;
-                    let url = '{{url('waybill/waybillAudit')}}';
+                    let url = '{{url('transport/waybill/waybillAudit')}}';
                     axios.post(url, {id:id})
                         .then(
                             function (response) {
@@ -569,7 +499,7 @@
                 },
                 waybillDestroy(id,waybill_number,index){
                     if(!confirm('确定要删除运单号为:“'+waybill_number+'”的运单吗?')){return};
-                    let url = '{{url('waybill')}}/'+id;
+                    let url = '{{url('transport/waybill')}}/'+id;
                     let _this = this;
                     axios.delete(url).then(
                         function (response) {
@@ -592,7 +522,7 @@
                     if(!confirm('确定要驳回“'+waybill_number+'”的审核吗?')){return};
                     let _this=this;
                     let w;
-                    let url='{{url('files')}}';
+                    let url='{{url('transport/waybill/waybillRetreatAudit')}}';
                     axios.post(url,{id:id})
                         .then(
                             function (response) {
@@ -620,7 +550,7 @@
                     if(!confirm('确定要通过“'+waybill_number+'”的终审吗?')){return};
                     let _this=this;
                     let w;
-                    let url='{{url('waybill/waybillEndAudit')}}';
+                    let url='{{url('transport/waybill/waybillEndAudit')}}';
                     axios.post(url, {id:id})
                         .then(
                             function (response) {
@@ -647,21 +577,10 @@
                         tempTip.show('终审失败,网络连接错误!'+err);
                     });
                 },
-                checkAll(e){
-                    if (e.target.checked){
-                        this.waybills.forEach((el,i)=>{
-                            if (this.checkData.indexOf(el.id) == '-1'){
-                                this.checkData.push(el.id);
-                            }
-                        });
-                    }else {
-                        this.checkData = [];
-                    }
-                },
                 waybillExport(checkAllSign){
-                    let url = '{{url('waybill/export')}}';
+                    let url = '{{url('transport/waybill/export')}}';
                     let token='{{ csrf_token() }}';
-                    excelExport(checkAllSign,this.checkData,url,this.sum,token);
+                    excelExport(checkAllSign,checkData,url,this.sum,token);
                 },
                 selectedColor(id,e){
                     $('#headerParent tr[class=focusing]').removeClass('focusing')
@@ -696,7 +615,7 @@
                     let formData=new FormData();
                     formData.append("file",file);
                     formData.append("waybill_number",waybill_number);
-                    axios.post('{{url('waybill/upload')}}',formData)
+                    axios.post('{{url('transport/waybill/upload')}}',formData)
                         .then(function (response) {
                             if (!response.data.success){
                                 tempTip.setDuration(4000);
@@ -707,10 +626,6 @@
                                 if (waybill.waybill_number===waybill_number){
                                     waybill.url=response.data.data.url;
                                     waybill.suffix=response.data.data.type;
-                                    /*setTimeout(function () {
-                                        _this.imgs.push(document.getElementById('img_'+waybill.id));
-                                        _this.lazy();
-                                    },1);*/
                                     tempTip.setDuration(3000);
                                     tempTip.showSuccess("上传成功!");
                                     return true;
@@ -744,17 +659,17 @@
                     this.destroyImg([id]);
                 },
                 deleteImg(){
-                    if (this.checkData.length <= 0) {
+                    if (checkData.length <= 0) {
                         tempTip.setDuration(2000);
                         tempTip.showSuccess('没有勾选任何记录');
                         return;
                     }
                     if (!confirm('确定要删除所选图片吗?'))return;
-                    this.destroyImg(this.checkData);
+                    this.destroyImg(checkData);
                 },
                 destroyImg(id){
                     let _this = this;
-                    axios.post('{{url('waybill/deleteImg')}}',{'ids':id})
+                    axios.post('{{url('transport/waybill/deleteImg')}}',{'ids':id})
                         .then(function (response) {
                             if (!response.data.success){
                                 tempTip.setDuration(4000);
@@ -933,7 +848,7 @@
                     $('#exampleModal').modal('show');
                 },
                 submitOnTop:function(){
-                    let ajaxUrl = '{{url('waybill/ontop/top')}}';
+                    let ajaxUrl = '{{url('transport/waybill/ontop/top')}}';
                     let remark =  $("#remark").val();
                     let id = $("#onTopId").val();
                     if(remark === ''){
@@ -965,7 +880,7 @@
                 cancelOnTop:function (e) {
                     let target = $(e.target);
                     let id = target.attr('data_id');
-                    let ajaxUrl='{{url('waybill/ontop/cancel')}}';
+                    let ajaxUrl='{{url('transport/waybill/ontop/cancel')}}';
                     if(id !== null){
                         axios.post(ajaxUrl,{'id':id}).then(function (response) {
                             if(response.data.success){
@@ -1001,7 +916,7 @@
                 },
                 refreshWaveHouseWeight(wms_bill_number) {
                     let _this=this;
-                    let url='{{url('waybill/refreshWaveHouseWeight')}}';
+                    let url='{{url('transport/waybill/refreshWaveHouseWeight')}}';
                     window.axios.post(url,{'wms_bill_number':wms_bill_number}).then(function (response) {
                         if(response.data.success){
                             _this.waybills.every(function (waybill) {
@@ -1074,7 +989,7 @@
                         window.tempTip.show("上传图片超出100MB,请分开上传");
                         return;
                     }
-                    window.tempTip.postBasicRequest('{{url('waybill/batchUploadImages')}}',{images:this.images},res=>{
+                    window.tempTip.postBasicRequest('{{url('transport/waybill/batchUploadImages')}}',{images:this.images},res=>{
                         let result = res.data;
                         let errors = res.errors;
                         if (errors.length>0)this.batchUploadError =  errors;
@@ -1083,10 +998,6 @@
                                 if (waybill.id==r.id){
                                     waybill.url="/storage"+r.upload_file.url;
                                     waybill.suffix=r.upload_file.type;
-                                    /*setTimeout(()=> {
-                                        this.imgs.push(document.getElementById('img_'+waybill.id));
-                                        this.lazy();
-                                    },1);*/
                                     return true;
                                 }
                             });

+ 0 - 34
routes/web.php

@@ -311,40 +311,6 @@ Route::group(['prefix'=>'transport'],function(){
         });
     });
 });
-/** 运输 */
-Route::group(['prefix'=>'waybill'],function(){
-    /** 置顶 */
-    Route::group(['prefix'=>'ontop'],function(){
-        Route::post('top','WaybillController@waybillOnTop');
-        Route::post('cancel','WaybillController@cancelOnTop');
-    });
-    /** 判断 */
-    Route::group(['prefix'=>'is'],function(){
-        Route::post('waybillPriceModel','WaybillController@isWaybillPriceModel');
-    });
-    Route::post('deleteImg','WaybillController@deleteImg');
-    Route::post('seekOrder','WaybillController@seekOrder');
-    Route::post('upload','WaybillController@upload');
-    Route::get('relating',function (){return view('transport.waybill.menuWaybill');});
-    Route::get('recycle', 'WaybillController@recycle');
-    Route::post('refreshWaveHouseWeight','WaybillController@refreshWaveHouseWeight');
-    Route::get('index','WaybillController@index');
-    Route::get('delivering','WaybillController@delivering');
-    Route::any('deliveringExport','WaybillController@deliveringExport');
-    Route::post('storeCarrierBill','WaybillController@storeCarrierBill');
-    Route::post('addCounty','WaybillController@addCounty');
-    Route::any('waybillAudit','WaybillController@waybillAudit');
-    Route::any('waybillEdit/{id}','WaybillController@waybillEdit');
-    Route::any('waybillRetreatAudit','WaybillController@waybillRetreatAudit');
-    Route::any('waybillEndAudit','WaybillController@waybillEndAudit');
-    Route::any('export','WaybillController@export');
-    Route::any('waybillUpdate/{id}','WaybillController@waybillUpdate');
-    Route::post('batchUploadImages','WaybillController@batchUploadImages');
-
-    Route::resource('waybillFinancialSnapshot','WaybillFinancialSnapshotsController');
-    Route::resource('waybillFinancialExcepted','WaybillFinancialExceptedController');
-});
-Route::resource('waybill','WaybillController');
 
 /** 运输财务 */
 Route::group(['prefix'=>'waybillFinancialSnapshot'],function(){