Pārlūkot izejas kodu

人事录入补卡,错误信息返回

haozi 5 gadi atpakaļ
vecāks
revīzija
8b73b1b65f

+ 5 - 4
app/Http/Controllers/PersonnelController.php

@@ -183,7 +183,7 @@ class PersonnelController extends Controller
     public function storeReplenishClock(Request $request){
         if(!Gate::allows('人事管理-录入补卡')){ return redirect(url('/'));  }
         $errors=$this->validatorUserDutyCheck($request)->errors();
-        if (count($errors)>0)return ['success'=>false,'data'=>$errors];
+        if (count($errors)>0)return ['success'=>false,'error'=>$errors];
         $user_id=$request->input('user_id');
         $checked_at=$request->input('checked_at');
         $type=$request->input('type');
@@ -195,9 +195,9 @@ class PersonnelController extends Controller
         ]);
         $checkedAtDate=Carbon::parse($checked_at)->format('Y-m-d');
         $userDutyCheckImport=UserDutyCheck::where('user_id',$user_id)->where('checked_at','like',$checkedAtDate.'%')->where('type','登入')->orderBy('id','desc')->first();
-        if ($userDutyCheckImport&&$userDutyCheck->type=='登入')return ['success'=>false,'data'=>'已存在进场记录!'];
+        if ($userDutyCheckImport&&$userDutyCheck->type=='登入')return ['result'=>true,'data'=>'已存在进场记录!'];
         $userDutyCheckExport=UserDutyCheck::where('user_id',$user_id)->where('checked_at','like',$checkedAtDate.'%')->where('type','登出')->orderBy('id','desc')->first();
-        if ($userDutyCheckExport&&$userDutyCheck->type=='登出')return ['success'=>false,'data'=>'已存在出场记录!'];
+        if ($userDutyCheckExport&&$userDutyCheck->type=='登出')return ['result'=>true,'data'=>'已存在出场记录!'];
         $userDutyCheck->save();
         $this->log(__METHOD__,"录入补卡".__FUNCTION__,json_encode($userDutyCheck),Auth::user()['id']);
         $laborReport=LaborReport::where('user_id',$userDutyCheck->user_id)->where('created_at','like',$checkedAtDate.'%')->orderBy('id','desc')->first();
@@ -231,7 +231,8 @@ class PersonnelController extends Controller
             'type'=>'required',
         ],[
             'date_format'=>':attribute 格式错误',
-        ],['checked_at'=>'日期']);
+        ],['checked_at'=>'日期'
+            ,'type'=>'补卡类型']);
         return $validator;
     }
     //打卡审核类型

+ 14 - 2
app/Http/Controllers/ProcessController.php

@@ -620,7 +620,6 @@ class ProcessController extends Controller
      */
     public function update(Request $request, $id)
     {
-
         if(!Gate::allows('二次加工管理-编辑')){ return redirect(url('/'));  }
         $errors=$this->validatorProcess($request)->errors();
         if (count($errors)>0)return ['error'=>$errors,'data'=>"process"];
@@ -671,6 +670,7 @@ class ProcessController extends Controller
 
     //删除二次加工内容单
     public function deleteProcessContent($id){
+        if(!Gate::allows('二次加工管理-删除')){ return redirect(url('/'));  }
         $processContent=ProcessesContent::find($id);
         if (!$processContent) return ['success'=>false,'data'=>'未找到对应二次加工内容单'];
         $processContent->delete();
@@ -679,6 +679,7 @@ class ProcessController extends Controller
 
     //回滚二次加工单状态
     function rollback(Request $request){
+        if(!Gate::allows('二次加工管理-回滚')){ return redirect(url('/'));  }
         if (!$request->id)return ['success'=>false];
         $process=Process::find($request->id);
         switch ($process->status){
@@ -695,6 +696,17 @@ class ProcessController extends Controller
         return ['success'=>true,'data'=>$process->status];
     }
 
+    //回收站
+    function recycle(Request $request){
+        $processes=Process::onlyTrashed()->paginate($request->paginate??50);
+        return view('process.recycle',compact('processes'));
+    }
+
+    //回收站恢复
+    function recover(Request $request){
+        $checkData=$request->checkData;
+        return ['success'=>Process::withTrashed()->whereIn('id',$checkData)->restore()];
+    }
     /**
      * Remove the specified resource from storage.
      *
@@ -703,7 +715,7 @@ class ProcessController extends Controller
      */
     public function destroy($id)
     {
-        //
+        return ['success'=>Process::destroy($id)];
     }
 
     //执行

+ 30 - 2
app/Http/Controllers/TestController.php

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
 
 use App\Authority;
 use App\Batch;
+use App\City;
 use App\Events\CancelOrder;
 use App\Events\WmsReceiveNewEvent;
 use App\Http\Controllers\Api\thirdPart\flux\WaybillController;
@@ -203,9 +204,36 @@ class TestController extends Controller
             $authority->delete();
         });
     }
-    /*1*/
-    function test(){
 
+    /*1*/
+    function test()
+    {/**/
+        $data=[];
+        $data['destination_city_id']=1;
+        $data['destination']="陕西省零鲁区鲱鱼大街404号260";
+        $waybill=Waybill::find(1);
+        if ($data['destination_city_id'] && $waybill->destination_city_id != $data['destination_city_id']){
+            $city=City::find($data['destination_city_id']);
+            if ($city && (mb_strpos($data['destination'],$city->name)===false || mb_strpos($data['destination'],$city->province_name)===false)){
+                if (mb_strpos($data['destination'],$city->name)===false && mb_strpos($data['destination'],$city->province_name)===false){
+                    $data['destination']=$city->province_name.$city->name.$data['destination'];
+                    goto sign;
+                }
+                if (mb_strpos($data['destination'],$city->province_name)===false){
+                    $data['destination']=$city->province_name.$data['destination'];
+                }
+                if (mb_strpos($data['destination'],$city->name)===false){var_dump(3);
+                    $province_name=$city->province_name;
+                    $start_index=mb_strpos($data['destination'],$city->province_name.'省');
+                    if ($start_index===false)$start_index=mb_strpos($data['destination'],$city->province_name);
+                    else $province_name=$province_name.'省';
+                    $strBefore=mb_substr($data['destination'],$start_index,mb_strlen($province_name));
+                    $strAfter=mb_substr($data['destination'],$start_index+mb_strlen($province_name));
+                    $data['destination']=$strBefore.$city->name.$strAfter;
+                }
+            }
+        }
+        sign:
     }
 
 }

+ 29 - 42
app/Http/Controllers/WaybillsController.php

@@ -33,7 +33,7 @@ class WaybillsController extends Controller
     public function preciseQuery(string $column,Request $request,$waybills){
         $today=Carbon::now()->subDays(15);
         $waybillsTem=clone $waybills;
-        $waybillsTem=$waybillsTem->where($column,'like','%'.$request->input($column).'%')->where('created_at','>',$today->format('Y-m-d'));
+        $waybillsTem=$waybillsTem->where($column,'like','%'.$request->input($column).'%')->where('waybills.created_at','>',$today->format('Y-m-d'));
         if($waybillsTem->count()==0
             ||$waybillsTem->first()[$column]==$request->input($column)){
             $waybills=$waybills->where($column,$request->input($column));
@@ -77,11 +77,11 @@ class WaybillsController extends Controller
         }
         if ($request->input('created_at_start')){
             $created_at_start=$request->input('created_at_start')." 00:00:00";
-            $waybills=$waybills->where('created_at','>=',$created_at_start);
+            $waybills=$waybills->where('waybills.created_at','>=',$created_at_start);
         }
         if ($request->input('created_at_end')){
             $created_at_end=$request->input('created_at_end')." 23:59:59";
-            $waybills=$waybills->where('created_at','<=',$created_at_end);
+            $waybills=$waybills->where('waybills.created_at','<=',$created_at_end);
         }
         if ($request->input('status')){
             $waybills=$waybills->where('status',$request->input('status'));
@@ -112,52 +112,16 @@ class WaybillsController extends Controller
         })->all();
         $waybills = $this->getWaybills();
         $waybills=$waybills->whereIn('owner_id',$ownerIds);
+        if ($request->uriType=='ZF')$waybills=$waybills->where('type','直发车');
+        if ($request->uriType=='ZX')$waybills=$waybills->where('type','专线');
         if ($data != null ) {
             $waybills=$this->conditionQuery($request,$waybills);
         } else {
             $waybills = $waybills->paginate(50);
         }
-        return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'']);
+        return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>$request->uriType??'']);
     }
 
-    public function indexZF(Request $request){
-        if(!Gate::allows('运输管理-查询')){ return redirect(url('/'));  }
-        $data=$request->input();
-        if ($data != null ) {
-
-            $waybills = $this->getWaybills()->where('type','直发车');
-
-            $waybills=$this->conditionQuery($request,$waybills);
-            $carries = Carrier::get();
-            $owners = Owner::filterAuthorities()->get();
-            return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZF']);
-        } else {
-            $waybills = $this->getWaybills()->where('type','直发车')->paginate(50);
-            $carries = Carrier::get();
-            $owners = Owner::filterAuthorities()->get();
-            return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZF']);
-
-        }
-    }
-
-    public function indexZX(Request $request){
-        if(!Gate::allows('运输管理-查询')){ return redirect(url('/'));  }
-        $data=$request->input();
-        if ($data != null ) {
-            $waybills = $this->getWaybills()->where('type','专线');
-
-            $waybills=$this->conditionQuery($request,$waybills);
-            $carries = Carrier::get();
-            $owners = Owner::filterAuthorities()->get();
-            return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZX']);
-        } else {
-            $waybills = $this->getWaybills()->where('type','专线')->paginate(50);
-            $carries = Carrier::get();
-            $owners = Owner::filterAuthorities()->get();
-            return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZX']);
-
-        }
-    }
 
     public function create()
     {
@@ -245,6 +209,29 @@ class WaybillsController extends Controller
         $this->validatorWaybillDispatch($request,$id)->validate();
 
         $data=$request->input();
+        if (!isset($data['destination']))$data['destination']=$waybill->destination;
+        if ($data['destination_city_id'] && $waybill->destination_city_id != $data['destination_city_id']){
+            $city=City::find($data['destination_city_id']);
+            if ($city && (mb_strpos($data['destination'],$city->name)===false || mb_strpos($data['destination'],$city->province_name)===false)){
+                if (mb_strpos($data['destination'],$city->name)===false && mb_strpos($data['destination'],$city->province_name)===false){
+                    $data['destination']=$city->province_name.$city->name.$data['destination'];
+                    goto sign;
+                }
+                if (mb_strpos($data['destination'],$city->province_name)===false){
+                    $data['destination']=$city->province_name.$data['destination'];
+                }
+                if (mb_strpos($data['destination'],$city->name)===false){var_dump(3);
+                    $province_name=$city->province_name;
+                    $start_index=mb_strpos($data['destination'],$city->province_name.'省');
+                    if ($start_index===false)$start_index=mb_strpos($data['destination'],$city->province_name);
+                    else $province_name=$province_name.'省';
+                    $strBefore=mb_substr($data['destination'],$start_index,mb_strlen($province_name));
+                    $strAfter=mb_substr($data['destination'],$start_index+mb_strlen($province_name));
+                    $data['destination']=$strBefore.$city->name.$strAfter;
+                }
+            }
+        }
+        sign:
         $total_receivable=0;
         $waybill->fill($data);
         if ($waybill->save()){

+ 3 - 1
app/Process.php

@@ -4,12 +4,14 @@ namespace App;
 
 use Illuminate\Database\Eloquent\Model;
 use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\SoftDeletes;
 
 class Process extends Model
 {
     use ModelTimeFormat;
+    use SoftDeletes;
     protected $fillable=[
-        'code','owner_id','process_method_id','unit_price','status','remark','amount','completed_amount','created_at','updated_at'
+        'code','owner_id','process_method_id','unit_price','status','remark','amount','completed_amount','created_at','updated_at','deleted_at'
     ];
     protected $appends=[
         'owner_name','process_method_name',

+ 5 - 1
app/Waybill.php

@@ -14,7 +14,7 @@ class Waybill extends Model
         'status','type','waybill_number','owner_id','wms_bill_number','origination','destination','recipient','recipient_mobile','charge','ordering_remark',
         'carrier_id','carrier_bill','origination_city_id','destination_city_id','warehouse_weight','warehouse_weight_unit_id','carrier_weight','carrier_weight_unit_id','carType_id',
         'car_owner_info','fee','pick_up_fee','other_fee','collect_fee','dispatch_remark','waybill_price_model_id','warehouse_weight_other','warehouse_weight_unit_id_other'
-        ,'carrier_weight_other','carrier_weight_unit_id_other','source_bill','mileage','amount','inquire_tel','amount_unit_id',
+        ,'carrier_weight_other','carrier_weight_unit_id_other','source_bill','mileage','amount','inquire_tel','amount_unit_id','other_charge','other_charge_remark'
     ];
     protected $appends=[
         'origination_city_name',
@@ -28,6 +28,7 @@ class Waybill extends Model
         'amount_unit_name',
         'upload_file_url',
         'upload_file_type',
+        'destination_province_name'
     ];
 
     public function owner(){
@@ -105,6 +106,9 @@ class Waybill extends Model
     public  function  getDestinationCityNameAttribute(){
         return $this['destination_city']? $this['destination_city']['name']:null;
     }
+    function getDestinationProvinceNameAttribute(){
+        return $this['destination_city'] ? $this['destination_city']['province_name']:null;
+    }
     public function getWarehouseWeightUnitNameAttribute(){
         return $this['warehouse_weight_unit']? $this['warehouse_weight_unit']['name']:null;
     }

+ 2 - 2
database/migrations/2019_11_22_094253_create_cities_table.php

@@ -53,7 +53,7 @@ class CreateCitiesTable extends Migration
         $Henan=['郑州','开封','洛阳','平顶山','安阳','鹤壁','新乡','焦作','濮阳','许昌','漯河','三门峡','商丘','周口','驻马店','南阳','信阳','济源'];
         $Hainan=['海口','三亚'];
         $ShangHai=['上海'];
-        $provinces=['陕西','甘肃','宁夏','青海','新疆','江苏','江','安徽','江西','福建','重庆','四川','云南',
+        $provinces=['陕西','甘肃','宁夏','青海','新疆','江苏','江','安徽','江西','福建','重庆','四川','云南',
             '贵州','西藏','黑龙江','吉林','辽宁','山东','北京','天津','广西','广东','河北','山西','内蒙古',
             '湖北','湖南','河南','海南','香港','澳门','台湾','上海'];
         for ($i=0;$i<count($provinces);$i++){
@@ -111,7 +111,7 @@ class CreateCitiesTable extends Migration
                     ]);
                 }
             }
-            if ($provinces[$i]=="江"){
+            if ($provinces[$i]=="江"){
                 $province=\App\Province::where('name','=',$provinces[$i])->first();
                 for ($j=0;$j<count($ZheJiang);$j++){
                     \App\City::create([

+ 1 - 1
database/migrations/2020_06_28_162934_add_authorrities_personal_duty_check_type.php

@@ -30,7 +30,7 @@ class AddAuthorritiesPersonalDutyCheckType extends Migration
     public function down()
     {
         foreach ($this->authNames as $name){
-            \App\Authority::where(['name'=>$name,'alias_name'=>$name])->destroy();
+            \App\Authority::where(['name'=>$name,'alias_name'=>$name])->delete();
         }
     }
 }

+ 50 - 0
database/migrations/2020_07_02_135957_add_authority_table_process_rollback.php

@@ -0,0 +1,50 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddAuthorityTableProcessRollback extends Migration
+{
+
+    protected $authNames=[
+        '二次加工管理-回滚',
+    ];
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        foreach ($this->authNames as $name){
+            \App\Authority::create(['name'=>$name,'alias_name'=>$name,'permission'=>'允许']);
+        }
+        Schema::table('processes',function (Blueprint $table){
+            $table->softDeletes();
+        });
+        Schema::table('waybills',function (Blueprint $table){
+            $table->decimal('other_charge',7,3)->nullable()->comment('其他收费,原其他费用为其他支出');
+            $table->text('other_charge_remark')->nullable()->comment('其他费用备注');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        foreach ($this->authNames as $name){
+            \App\Authority::where(['name'=>$name,'alias_name'=>$name])->delete();
+        }
+        Schema::table('processes',function (Blueprint $table){
+            $table->dropSoftDeletes();
+        });
+        Schema::table('waybills',function (Blueprint $table){
+            $table->dropColumn('other_charge');
+            $table->dropColumn('other_charge_remark');
+        });
+    }
+}

+ 1 - 0
public/js/app.js

@@ -61738,6 +61738,7 @@ var datetime = {
       time.target.value = time.target.value.replace(/^([3-9])([\d]{1})/, "2$2");
       time.target.value = time.target.value.replace(/^([2-9]{1})([4-9]{1})/, "$13");
       time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1}):([6-9]{1})/, "$1$2:5");
+      time.target.value = time.target.value.replace(/^([\d]{1})([\d]{1})$/, "$1$2:");
     }, 10);
   }
 };

+ 2 - 1
resources/js/utilities/datetimeRelating.js

@@ -21,7 +21,8 @@ const datetime={
             time.target.value=time.target.value.replace(/^([3-9])([\d]{1})/,"2$2");
             time.target.value=time.target.value.replace(/^([2-9]{1})([4-9]{1})/,"$13");
             time.target.value=time.target.value.replace(/^([\d]{1})([\d]{1}):([6-9]{1})/,"$1$2:5");
+            time.target.value=time.target.value.replace(/^([\d]{1})([\d]{1})$/,"$1$2:");
         },10);
     },
 };
-module.exports=datetime;
+module.exports=datetime;

+ 20 - 3
resources/views/auth/login.blade.php

@@ -21,7 +21,7 @@
                                                    oninput="setTimeout(function(){vue.errors.name=''},10)"
                                                    name="name" v-model="inputting.name" required autocomplete="name" autofocus>
 
-                                            <span class="invalid-feedback d-block" v-if="errors.name">
+                                            <span class="invalid-feedback" v-if="errors.name">
                                                 <strong v-for="msg in errors.name">@{{ msg }}</strong>
                                             </span>
                                         </div>
@@ -32,10 +32,10 @@
 
                                         <div class="col-md-8">
                                             <input id="password" type="password" class="form-control " :class="[errors.password?'is-invalid':'']"
-                                                   oninput="setTimeout(function(){vue.errors.password=''},10)"
+                                                   @keypress="passwordInput($event)"
                                                    v-model="inputting.password" name="password" required autocomplete="current-password">
 
-                                            <span class="invalid-feedback d-block" v-if="errors.password">
+                                            <span class="invalid-feedback" v-if="errors.password">
                                                 <strong v-for="msg in errors.password">@{{ msg }}</strong>
                                             </span>
                                         </div>
@@ -80,14 +80,29 @@
     <script>
         let vue=new Vue({
                 el:"#list",
+                mounted:function(){
+                    $('.invalid-feedback').addClass('d-block')
+                },
                 data:{
                     inputting:{name:'',password:'',is_json:true},
                     errors: {name:'',password:'',},
                 },
+                methods:{
+                    passwordInput:function(e){
+                        setTimeout(function(){vue.errors.password=''},10);
+                        if(e.key==='Enter'){
+                            loginSubmit()
+                        }
+                    },
+                }
             }
         )
         function loginSubmit() {
+            tempTip.setDuration('99999');
+            tempTip.waitingTip('提交中');
             axios.post('{{ route('login') .'?rand='.microtime(true)}}',vue.inputting).then(function (response) {
+                tempTip.setDuration('2000');
+                tempTip.cancelWaitingTip();
                 if(response.data.success!==true){
                     if(response.data.errors){
                         vue.errors=response.data.errors;
@@ -98,6 +113,8 @@
                         return;
                     }
                 }else{
+                    tempTip.setDuration('99999');
+                    tempTip.waitingTip('页面跳转中');
                     location=response.data.url;
                 }
             })

+ 5 - 3
resources/views/personnel/checking-in/createReplenishClock.blade.php

@@ -45,6 +45,7 @@
                                 <option value="登入">登入</option>
                                 <option value="登出">登出</option>
                             </select>
+                            <small v-if="errors.type && errors.type.length>0 " class="text-danger">@{{ errors.type[0] }}</small>
                         </td>
                         <td><button @click="storeReplenishClock(userLabor)" class="btn btn-info w-100">提交补卡</button></td>
                     </tr>
@@ -102,6 +103,7 @@
                     let _this=this;
                     axios.post("{{url('personnel/checking-in/storeReplenishClock')}}",{user_id:user_id,checked_at:checked_at,type:type})
                         .then(function (response) {
+                            console.log(response.data.data);
                             if (response.data.success){
                                 _this.userLabors.every(function (userLabor) {
                                     if (userLabor.user_id==userLabor.user_id) {
@@ -116,12 +118,12 @@
                                 _this.errors={'checked_at':[],'type':[],};
                                 return;
                             }
-                            _this.errors=response.data.data;
-                            if (!response.data.success){
-                                tempTip.setDuration(3000);
+                            if (response.data.result){
+                                tempTip.setDuration(4000);
                                 tempTip.show(response.data.data);
                                 return;
                             }
+                            _this.errors=response.data.error;
                         }).catch(function (err) {
                             tempTip.setDuration(4000);
                             tempTip.show('录入补卡失败!网络错误:'+err);

+ 62 - 21
resources/views/process/index.blade.php

@@ -223,7 +223,7 @@
                 </div><!-- /.modal-content -->
             </div><!-- /.modal -->
         </div>
-            <table class="table table-striped table-sm text-nowrap table-hover">
+            <table class="table table-striped table-sm text-nowrap">
                 <tr>
                     <th>
                         <label for="all">
@@ -247,17 +247,19 @@
                     <th style="min-width: 200px">本单数量</th>
                     <th style="min-width: 200px">商品条码</th>
                     <th style="min-width: 200px">商品名称 </th>
+                    <th></th>
                 </tr>
                 <template>
-                <tr v-for="(processOne,i) in processes" :id="processOne.id?processOne.id:processes[i-1].id+'-2'">
+                <tr v-for="(processOne,i) in processes" :id="processOne.id?processOne.id:processes[i-1].id+'-2'" :name="'process_table_'+processOne.serial_number" @mouseover="changeStyle('process_table_'+processOne.serial_number,true)" @mouseout="changeStyle('process_table_'+processOne.serial_number,false)">
                     <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">
                         <input class="checkItem" type="checkbox" :value="processOne.id" v-model="checkData">
                     </td>
-                    <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">@{{ i+1 }}</td>
-                    <td v-if="processOne.id" style="min-width:150px" :rowspan="processOne.is_multi_row?2:''">
+                    <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.serial_number }}</td>
+                    <td v-if="processOne.id" style="min-width:200px" :rowspan="processOne.is_multi_row?2:''">
                         <p v-if="!processOne.openProcessHour && processOne.status=='驳回'" class="text-muted">已驳回</p>
                         <p v-if="!processOne.openProcessHour && processOne.status=='已完成'" class="text-success">已完成</p>
-                        <button v-if="!processOne.openProcessHour && processOne.status!='已完成' && processOne.status!='待接单'" class="btn btn-sm btn-outline-dark" style="opacity: 0.65" @click="rollback(processOne.id)">回滚</button>
+                        @can("二次加工管理-回滚")
+                        <button v-if="!processOne.openProcessHour && processOne.status!='已完成' && processOne.status!='待接单'" class="btn btn-sm btn-outline-dark" style="opacity: 0.65" @click="rollback(processOne.id)">回滚</button>@endcan
                         @can("二次加工管理-接单与驳回")
                         <button v-if="!processOne.openProcessHour && (processOne.status=='待接单' || processOne.status=='驳回' || processOne.status=='加工中' || processOne.status=='待加工')" @click="processEdit(processOne.id)" class="btn btn-sm btn-outline-info pull-left">编辑</button>
                         <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReject(processOne.id)" class="btn btn-sm btn-outline-dark pull-left">驳回</button>
@@ -304,7 +306,7 @@
                     <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.status }}</td>
                     <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.remark }}</td>
                     <td colspan="5" style="margin:0;padding:0;">
-                        <table class="table table-sm table-striped p-0 m-0" v-if="processUnfold[processOne.code+processOne.id] || processOne.processesContents.length==1 ||
+                        <table class="table table-sm table-striped" style="margin:0;padding:0;" v-if="processUnfold[processOne.code+processOne.id] || processOne.processesContents.length==1 ||
                         (processOne.is_multi_row &&  (processOne.processesContents.length)-(processFullSum[processOne.code])==1) || (!processOne.id &&  processFullSum[processOne.code]==1)">
                             <tr v-for="processesContent in processOne.processesContents"
                                 v-if="processOne.is_multi_row || !processOne.id ? !processOne.id  ? processesContent.type=='成品单' :processesContent.type=='原料单' : true">
@@ -327,24 +329,30 @@
                                </td>
                             </tr>
                         </table>
-                        <div v-else  style="position: relative;height: 40px;" :style="{background: !processOne.id ? '#e8eef6' :'rgb(246, 238, 232)'}">
-                            <div v-for="(processesContent,i) in arrayFilter(processOne.processesContents,processOne)" class="w-100 row ml-1" style="transform: scale(0.5)" :style="[{ 'margin-top' :  i*4+'px'},{opacity:1/0.7}]"
-                               {{--v-if="processOne.is_multi_row || !processOne.id ? !processOne.id  ? processesContent.type=='成品单' :processesContent.type=='原料单' : true"--}}>
-                                <span style="width: 19%">@{{ processesContent.bill_type }}</span>
-                                <span style="width: 19.5%">@{{ processesContent.wms_code }}</span>
-                                <span style="width: 20%">@{{ processesContent.amount }}</span>
-                                <span style="width: 18%">
-                                    <ul class="p-0 m-0 list-unstyled list-inline" v-if="processesContent.commodity">
-                                        <li v-for="barcode in processesContent.commodity.barcodes"><small>@{{ barcode.code }}</small></li>
-                                    </ul>
-                                </span>
-                                <span :title="processesContent.commodity_name" class="text-muted tooltipTarget" style="width:23.5%;overflow:hidden">@{{ processesContent.commodity_name }}</span>
+                        <div v-else class="m-0" style="height: 35px" :style="{background: (!processOne.id || processOne.is_multi_row)  ? (!processOne.id) ? '#e8eef6' :'rgb(246, 238, 232)' : (processOne.processesContents.length>0 ? ((processOne.processesContents[0].type=='成品单') ? '#e8eef6' : 'rgb(246, 238, 232)') :'')}">
+                            <div v-for="(processesContent,i) in arrayFilter(processOne.processesContents,processOne)"  class=" row  p-0" style="float: left;margin-right: 20px" :style="[{opacity:1/0.7},{transform:'scale('+(1/Math.ceil(arrayFilter(processOne.processesContents,processOne).length/4))+')'},
+                            {'margin-left': arrayFilter(processOne.processesContents,processOne).length >4 ? (-20*parseInt(arrayFilter(processOne.processesContents,processOne).length/2))+'px' : '0px'},{'margin-top': (-3*parseInt(arrayFilter(processOne.processesContents,processOne).length/2))+'px'}]">
+                                <span>@{{ processesContent.bill_type }}</span>&nbsp;&nbsp;
+                                <span>@{{ processesContent.wms_code }}</span>&nbsp;&nbsp;
+                                <span>@{{ processesContent.amount }}</span>&nbsp;&nbsp;
+                                <span>
+                                    <small v-if="processesContent.commodity && processesContent.commodity.barcodes.length>0">
+                                        @{{ processesContent.commodity.barcodes[0].code }}
+                                    </small>
+                                </span>&nbsp;&nbsp;
+                                <span :title="processesContent.commodity_name" class="text-muted tooltipTarget" style="max-width:100px;overflow:hidden;">@{{ processesContent.commodity_name }}</span>
                             </div>
                         </div>
-                        <div v-if="!processUnfold[processOne.code+processOne.id] && processOne.processesContents.length>1" class="text-center">
+                        <div v-if="!processUnfold[processOne.code+processOne.id] && processOne.processesContents.length>1 &&
+                        ((processFullSum[processOne.code]!=processOne.processesContents.length && (processOne.processesContents.length)-(processFullSum[processOne.code])!=1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id  ? false :true) : true)) ||
+                        processFullSum[processOne.code] && processFullSum[processOne.code]>1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id  ? true :false) : true))" class="text-center mb-0"
+                             :style="{background : (processFullSum[processOne.code]!=processOne.processesContents.length && (processOne.processesContents.length)-(processFullSum[processOne.code])!=1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id  ? false :true) : true)) ? 'rgb(246, 238, 232)' : '#e8eef6'}">
                         <b v-if="processFullSum[processOne.code]!=processOne.processesContents.length && (processOne.processesContents.length)-(processFullSum[processOne.code])!=1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id  ? false :true) : true)" style="cursor:pointer;color: #4aa0e6;text-decoration:underline" @click="unfold(processOne.code,processOne.id,'原料单')">点击展开原料单</b>
                         <b v-if="processFullSum[processOne.code] && processFullSum[processOne.code]>1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id  ? true :false) : true)" style="cursor:pointer;color: #4aa0e6;text-decoration:underline" @click="unfold(processOne.code,processOne.id,'成品单')">点击展开成品单</b></div>
                     </td>
+                    <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
+                        <button type="button" class="btn btn-sm btn-outline-danger" @click="destroy(processOne.code,processOne.id)">删</button>
+                    </td>
                 </tr>
                 <tr id="addProcessDailyParticipants" v-show="processDailyParticipants.length>0">
                     <td colspan="2"></td>
@@ -538,7 +546,7 @@
                     let indexs=[];
                     for (let i=0;i<this.processes.length;i++){
                         let process=this.processes[i];
-                        // console.log(this.processes[i].id);
+                        process.serial_number=i+1;
                         process.processesContents.every(function (processesContent) {
                             if (processesContent.type==='成品单')_this.$set(_this.processFullSum,process.code,_this.processFullSum[process.code]?_this.processFullSum[process.code]+1:1);
                             return true;
@@ -1249,7 +1257,40 @@
                         tempTip.setDuration(3000);
                         tempTip.show('回滚失败!网络错误:' + err);
                         })
-                }
+                },
+                //vue绑定的name  type:移入移出类型
+                changeStyle(name,type){
+                    let domList=document.getElementsByName(name);
+                    let color='';
+                    if (type)color='rgba(0, 0, 0, 0.15)';
+                    for (let i=0;i<domList.length;i++){
+                        domList[i].style.backgroundColor = color;
+                    }
+                },
+                destroy(code,id){
+                    if (!confirm('确定要删除“'+code+"”吗?"))return;
+                    let _this=this;
+                    let delArr=[];
+                    axios.delete('{{url('process')}}/'+id)
+                        .then(function (response) {
+                            tempTip.setDuration(3000);
+                            if (response.data.success){
+                                _this.processes.forEach(function (process,i) {
+                                    if (process.code===code)
+                                        delArr.unshift(i);
+                                });
+                                delArr.forEach(function (del) {
+                                    _this.$delete(_this.processes,del);
+                                });
+                                tempTip.showSuccess('删除“'+code+'”成功!');
+                                return;
+                            }
+                            tempTip.show('删除“'+code+'”失败!该单已不存在')
+                        }).catch(function (err) {
+                            tempTip.setDuration(4000);
+                            tempTip.show("网络错误:"+err);
+                        })
+                },
             },
         });
     </script>

+ 6 - 3
resources/views/process/menu.blade.php

@@ -12,9 +12,12 @@
             </li> @endcan
             {{$slot}}
             @can('二次加工管理-查询')
-                <li class="nav-item">
-                    <a class="nav-link" href="{{url('process/statistic')}}" :class="{active:isActive('statistic',2)}">统计</a>
-                </li> @endcan
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('process/statistic')}}" :class="{active:isActive('statistic',2)}">统计</a>
+            </li> @endcan
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('process/recycle')}}" :class="{active:isActive('recycle',2)}">回收站</a>
+            </li>
             <li class="nav-item">
                 <a class="nav-link text-dark" href="{{url('process/relating')}}" :class="{active:isActive('relating',2)}">相关设置</a>
             </li>

+ 124 - 0
resources/views/process/recycle.blade.php

@@ -0,0 +1,124 @@
+@extends('layouts.app')
+@section('title')二次加工管理-回收站@endsection
+@section('content')
+<span id="nav2">
+    @component('process.menu')@endcomponent
+</span>
+<div id="page" class="d-none container-fluid">
+    <div class="card">
+        <div class="card-header form-inline">
+            <select v-model="paginate" class="form-control form-control-sm" style="max-width: 100px">
+                <option value="50">显示50条</option>
+                <option value="100">显示100条</option>
+                <option value="200">显示200条</option>
+                <option value="500">显示500条</option>
+                <option value="1000">显示1000条</option>
+            </select>
+            <button class="btn btn-sm btn-outline-danger ml-2" @click="recover()">恢复</button>
+        </div>
+        <div class="card-body">
+            <table class="table table-hover table-striped text-nowrap table-bordered">
+                <tr>
+                    <th>
+                        <label for="all">
+                            <input id="all" type="checkbox" @click="checkAll($event)">全选
+                        </label>
+                    </th>
+                    <th>序号</th>
+                    <th>任务号</th>
+                    <th>货主</th>
+                    <th>作业类型</th>
+                    <th>单价</th>
+                    <th>数量</th>
+                    <th>备注</th>
+                    <th>状态</th>
+                    <th>创建时间</th>
+                    <th>删除时间</th>
+                </tr>
+                <tr v-for="(process,i) in processes">
+                    <td v-if="process.id">
+                        <input class="checkItem" type="checkbox" :value="process.id" v-model="checkData">
+                    </td>
+                    <td>@{{ i+1 }}</td>
+                    <td>@{{ process.code }}</td>
+                    <td>@{{ process.owner_name }}</td>
+                    <td class="text-danger font-weight-bold">@{{ process.process_method_name }}</td>
+                    <td>@{{ process.unit_price }}</td>
+                    <td>@{{ process.completed_amount }}</td>
+                    <td>@{{ process.remark }}</td>
+                    <td class="text-danger">@{{ process.status }}</td>
+                    <td>@{{ process.created_at }}</td>
+                    <td>@{{ process.deleted_at }}</td>
+                </tr>
+            </table>
+        </div>
+    </div>
+
+</div>
+@stop
+
+@section('lastScript')
+    <script>
+        new Vue({
+            el:"#page",
+            data:{
+                processes:[
+                    @foreach($processes as $process)
+                    {!! $process !!},
+                    @endforeach
+                ],
+                paginate:50,
+                checkData:[],
+            },
+            mounted(){
+                $("#page").removeClass('d-none');
+            },
+            methods:{
+                //全选事件
+                checkAll(e){
+                    if (e.target.checked){
+                        this.processes.forEach((el,i)=>{
+                            if (this.checkData.indexOf(el.id) == '-1'){
+                                this.checkData.push(el.id);
+                            }
+                        });
+                    }else {
+                        this.checkData = [];
+                    }
+                },
+                recover(){
+                    tempTip.setDuration(3000);
+                    if (this.checkData.length<1){
+                        tempTip.showSuccess('尚未未选择需要恢复单!');
+                        return;
+                    }
+                    let checkData=this.checkData;
+                    let _this=this;
+                    let delArr=[];
+                    if (!confirm('确定要恢复所选内容吗?'))return;
+                    axios.post('{{url('process/recover')}}',{checkData:checkData})
+                        .then(function (response) {
+                            if (response.data.success){
+                                checkData.forEach(function (data) {
+                                    _this.processes.every(function (process,i) {
+                                        if (data===process.id){
+                                            delArr.unshift(i);return false;
+                                        }
+                                        return true;
+                                    });
+                                });
+                                delArr.forEach(function (item) {
+                                    _this.$delete(_this.processes,item);
+                                });
+                                tempTip.showSuccess('恢复成功!');
+                                return;
+                            }
+                            tempTip.show('恢复失败,未知错误!');
+                        }).catch(function (err) {
+                            tempTip.show('恢复失败,网络错误:'+err);
+                        });
+                }
+            },
+        });
+    </script>
+@stop

+ 25 - 1
resources/views/waybill/edit.blade.php

@@ -311,7 +311,7 @@
                         </div>
                     </div>
                     <div class="form-group row">
-                        <label for="other_fee" class="col-2 col-form-label text-right text-muted">其他费用(元)</label>
+                        <label for="other_fee" class="col-2 col-form-label text-right text-muted">其他支出(元)</label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('other_fee') is-invalid @enderror"
                                    name="other_fee" autocomplete="off" value="@if(old('other_fee')){{ old('other_fee') }}@else{{$waybill->other_fee}}@endif"  >
@@ -322,6 +322,30 @@
                             @enderror
                         </div>
                     </div>
+                    <div class="form-group row">
+                        <label for="other_charge" class="col-2 col-form-label text-right text-muted">其他费用(元)</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('other_charge') is-invalid @enderror"
+                                   name="other_charge" autocomplete="off" value="@if(old('other_charge')){{ old('other_charge') }}@else{{$waybill->other_charge}}@endif"  >
+                            @error('other_charge')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="other_charge_remark" class="col-2 col-form-label text-right text-muted">其他费用备注</label>
+                        <div class="col-8">
+                            <textarea class="form-control @error('other_charge_remark') is-invalid @enderror"
+                                      name="other_charge_remark" autocomplete="off"  >@if(old('other_charge_remark')){{ old('other_charge_remark') }}@else{{$waybill->other_charge_remark}}@endif</textarea>
+                            @error('other_charge_remark')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
                     <div class="form-group row">
                         <label for="dispatch_remark" class="col-2 col-form-label text-right text-muted">调度备注</label>
                         <div class="col-8">

+ 27 - 23
resources/views/waybill/index.blade.php

@@ -5,28 +5,28 @@
     <div id="nav2">
         @component('waybill.menu')
         @endcomponent
-        <div class="container-fluid nav3">
-            <div class="card menu-third" >
-                <ul class="nav nav-pills">
-                    @can('运输管理-查询')
-                        <li class="nav-item">
-                            <a class="nav-link" href="{{url('waybill/index')}}" :class="{active:isActive('',3)}">全部</a>
-                        </li> @endcan
-                    @can('运输管理-查询')
-                        <li class="nav-item">
-                            <a class="nav-link" href="{{url('waybill/index/ZX')}}" :class="{active:isActive('ZX',3)}">专线</a>
-                        </li> @endcan
-                    @can('运输管理-查询')
-                        <li class="nav-item">
-                            <a class="nav-link" href="{{url('waybill/index/ZF')}}" :class="{active:isActive('ZF',3)}">直发车</a>
-                        </li> @endcan
-                </ul>
-            </div>
-        </div>
     </div>
     <div class="container-fluid" style="min-width: 1500px;">
         <div class="d-none" id="list">
-            <form  method="GET" action="@if($uriType=='ZF'){{url('waybill/index/ZF')}}@elseif($uriType=='ZX'){{url('waybill/index/ZX')}}@else{{url('waybill/index')}}@endif" id="optionSubmit">
+            <div class="container-fluid nav3">
+                <div class="card menu-third" >
+                    <ul class="nav nav-pills">
+                        @can('运输管理-查询')
+                            <li class="nav-item">
+                                <a class="nav-link" href="{{url('waybill/index')}}" :class="!filterData.uriType || filterData.uriType=='' ? 'active' :''">全部</a>
+                            </li> @endcan
+                        @can('运输管理-查询')
+                            <li class="nav-item">
+                                <a class="nav-link" href="{{url('waybill/index?uriType=ZX')}}" :class="filterData.uriType=='ZX' ? 'active' :''">专线</a>
+                            </li> @endcan
+                        @can('运输管理-查询')
+                            <li class="nav-item">
+                                <a class="nav-link" href="{{url('waybill/index?uriType=ZF')}}" :class="filterData.uriType=='ZF' ? 'active' :''">直发车</a>
+                            </li> @endcan
+                    </ul>
+                </div>
+            </div>
+            <form  method="GET" action="@if($uriType=='ZF'){{url('waybill/index?uriType=ZF')}}@elseif($uriType=='ZX'){{url('waybill/index?uriType=ZX')}}@else{{url('waybill/index')}}@endif" id="optionSubmit">
                 <table class="table table-sm table-bordered  text-nowrap mb-0" style="background: #fff;">
                     <tr v-if="isBeingFilterConditions">
                         <td colspan="4"><div class="col" style="padding:0;">
@@ -162,6 +162,8 @@
                     <th class="td-warm">上游单号</th>
                     <th class="td-warm">WMS订单号</th>
                     <th class="td-warm">运单号</th>
+                    <th class="td-warm">其他费用</th>
+                    <th class="td-warm">其他费用备注</th>
                     @can('运输管理-图片上传')<th class="td-warm">照片</th>@endcan
                     <th class="td-cool">收件人</th>
                     <th class="td-cool">收件人电话</th>
@@ -179,7 +181,7 @@
                     <th class="td-helpful">运费</th>
                     @endcan
                     <th class="td-helpful">提货费</th>
-                    <th class="td-helpful">其他费用</th>
+                    <th class="td-helpful">其他支出</th>
                     <th class="td-helpful">调度备注</th>
                     @can('运输管理-删除')
                         <th class="td-delete">操作</th>
@@ -246,6 +248,8 @@
                     <td class="td-warm toptd" :title="waybill.remark? '置顶备注:'+waybill.remark :''">@{{waybill.source_bill}}</td>
                     <td class="td-warm" >@{{waybill.wms_bill_number}}</td>
                     <td class="td-warm">@{{waybill.waybill_number}}</td>
+                    <td class="td-warm">@{{waybill.other_charge}}</td>
+                    <td class="td-warm">@{{waybill.other_charge_remark}}</td>
                     <td class="td-warm">
                         <div align="center" @mouseleave="removeCommonImg('common_img_'+waybill.id)" @mouseenter="commonImg('img_'+waybill.id,waybill.url,waybill.suffix)">
                             <img v-if="waybill.url" :id="'img_'+waybill.id"  :data-src="waybill.url+'-thumbnail.'+waybill.suffix" src="{{url('icon/img404-thumbnail.jpg')}}">
@@ -462,12 +466,13 @@
                         charge:'{{$waybill->charge}}',ordering_remark:'{{$waybill->ordering_remark}}',carrier:'{{$waybill->carrier_name}}',
                         carrier_bill:'{{$waybill->carrier_bill}}',origination_city:'{{$waybill->origination_city_name}}',
                         destination_city:'{{$waybill->destination_city_name}}',warehouse_weight:'{{$waybill->warehouse_weight}}',
+                        destination_province_name:'{{$waybill->destination_province_name}}',
                         warehouse_weight_unit:'{{$waybill->warehouse_weight_unit_name}}',carrier_weight:'{{$waybill->carrier_weight}}',
                         carrier_weight_unit:'{{$waybill->carrier_weight_unit_name}}',
                         warehouse_weight_other:'{{$waybill->warehouse_weight_other}}',
                         warehouse_weight_unit_other:'{{$waybill->warehouse_weight_unit_other_name}}',carrier_weight_other:'{{$waybill->carrier_weight_other}}',
                         carrier_weight_unit_other:'{{$waybill->carrier_weight_unit_other_name}}',
-                        amount_unit_name:'{{$waybill->amount_unit_name}}',
+                        amount_unit_name:'{{$waybill->amount_unit_name}}',other_charge:'{{$waybill->other_charge}}',other_charge_remark:'{{$waybill->other_charge_remark}}',
                         mileage:'{{$waybill->mileage}}',amount:'{{$waybill->amount}}',
                         @if($waybill->carType)carType:{!! $waybill->carType !!},car_owner_info:'{{$waybill->car_owner_info}}',@endif @can('运输管理-可见费用项') fee:'{{$waybill->fee}}',
                         pick_up_fee:'{{$waybill->pick_up_fee}}',other_fee:'{{$waybill->other_fee}}',
@@ -482,7 +487,7 @@
                     {paginate:'50',waybill_number:''
                         ,carrier_bill:'',carrier_id:''
                         ,owner_id:'',wms_bill_number:''
-                        ,created_at_start:'',created_at_end:''
+                        ,created_at_start:'',created_at_end:'',uriType:''
                         ,type:'',status:'',origination:'',destination:'',owners:{}},
                 wmsCommodities:[],
                 selectedStyle:[],
@@ -529,7 +534,6 @@
                 $('#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){

+ 4 - 0
routes/web.php

@@ -214,6 +214,10 @@ Route::group(['prefix'=>'process'],function(){
     Route::post('deleteProcessContent/{id}','ProcessController@deleteProcessContent');
     //回滚状态
     Route::post('rollback','ProcessController@rollback');
+    //回收站
+    Route::get('recycle','ProcessController@recycle');
+    //恢复
+    Route::post('recover','ProcessController@recover');
 });
 //process主方法 restful
 Route::resource('process','ProcessController');