haozi před 5 roky
rodič
revize
bc0c8bd34e

+ 2 - 1
app/Http/Controllers/LaborReportController.php

@@ -74,6 +74,7 @@ class LaborReportController extends Controller
             $laborReports=app('laborReportService')->get($params);
         }else{
             $laborReports=app('laborReportService')->get(["id"=>$request->data]);
+            dd($laborReports);
         }
         $data = [];
         foreach ($laborReports as $laborReport){
@@ -83,7 +84,7 @@ class LaborReportController extends Controller
                 "name" => $laborReport->name,
                 "mobile_phone" => $laborReport->mobile_phone,
                 "identity_number" => $laborReport->identity_number,
-                "labor_company" => $laborReport->labor_company,
+                "labor_company" => $laborReport->laborCompany ? $laborReport->laborCompany->name : null,
                 "enter_at" => $laborReport->enter_at,
                 "check_in_at" => $laborReport->check_in_at,
                 "check_out_at" => $laborReport->check_out_at,

+ 6 - 2
app/Services/LaborReportService.php

@@ -46,9 +46,10 @@ class LaborReportService
             'created_at_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],
             'created_at_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
             'identity_number' => ['timeLimit' => 15],
-            'name' => ['like' => '']
+            'name' => ['like' => ''],
+            'id' => ['multi' => ',']
         ];
-        $laborReports = app(QueryService::class)->query($params,$laborReports,$columnQueryRules);
+        $laborReports = app(QueryService::class)->query($params,$laborReports,$columnQueryRules,'labor_reports');
         if((Gate::allows('人事管理-临时工报表-可见全部组')||Gate::allows('人事管理-门卫审核')) && !($params["user_workgroup_id"] ?? false)){
             $laborReports->where(function ($query)use($user){
                 $query->whereIn('labor_reports.user_workgroup_id',$user?$user->getPermittingWorkgroupIds(Gate::allows('人事管理-临时工报表-可见全部组')):[])
@@ -58,6 +59,7 @@ class LaborReportService
             $laborReports->whereIn('labor_reports.user_workgroup_id',
                 $user?$user->getPermittingWorkgroupIds(Gate::allows('人事管理-临时工报表-可见全部组')):[]);
         }
+        $laborReports = app(QueryService::class)->query($params,$laborReports,$columnQueryRules,'labor_reports');
         return $laborReports;
     }
     public function paginate(array $params){
@@ -71,6 +73,8 @@ class LaborReportService
         return $this->conditionQuery($params)->selectRaw("labor_reports.*")
             ->leftJoin('user_workgroups','labor_reports.user_workgroup_id','user_workgroups.id')
                 ->selectRaw('user_workgroups.name user_workgroup_name')
+            ->leftJoin('labor_companies','labor_reports.labor_company_id','labor_companies.id')
+                ->selectRaw('labor_companies.name labor_company')
             ->sql();
     }
 

+ 13 - 8
resources/views/inventory/stockInventory/inventoryMission.blade.php

@@ -111,7 +111,7 @@
         </span>
         </form>
 
-        <div class="row d-none d-xl-block" v-if="inventoryAccountMissions.length>=1">
+        <div class="row d-none d-xl-block" v-if="inventoryAccountMissions.length>=1&&!listMode">
             <div class="col-12 col-md-12 col-sm-12">
                 <table class="table table-sm table-bordered table-info mt-2">
                     <tr>
@@ -140,10 +140,10 @@
                         <td v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.barcode }}</td>
                         <td v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.sku }}</td>
                         <td>
-                            <input type="date"  class="form-control-sm" name="produced_at"  v-model="inventoryMission.produced_at" >
+                            <input type="date"  class="form-control-sm" name="produced_at"  v-model="inventoryMission.produced_at.substr(0,10)" >
                         </td>
                         <td>
-                            <input type="date"  class="form-control-sm" name="valid_at"  v-model="inventoryMission.valid_at" >
+                            <input type="date"  class="form-control-sm" name="valid_at"  v-model="inventoryMission.valid_at.substr(0,10)" >
                         </td>
                         <td class="text-muted">
                             <input type="text"  class="form-control-sm" name="batch_number"  v-model="inventoryMission.batch_number" >
@@ -248,7 +248,7 @@
             </table>
         </div>
         <!--相同库位和条码-->
-        <table class="table table-striped table-sm table-bordered table-hover p-0 d-table  d-xl-none mt-2"  style="background: rgb(179, 214, 245);">
+        <table class="table table-striped table-sm table-bordered table-hover p-0 d-table  d-xl-none mt-2"  style="background: rgb(179, 214, 245);" v-if="!listMode">
             <tr v-for="inventoryMission in inventoryAccountMissions">
                 <td style="filter:grayscale(30%); ">
                     <div  class="mt-3">
@@ -258,11 +258,11 @@
                             <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品条码:</span><span  v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.barcode }}</span></span>
                             <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品编码:</span><span  v-if="inventoryMission.commodity">@{{ inventoryMission.commodity.sku }}</span></span>
                             <span class="mr-3 text-nowrap"><span class="font-weight-bold">生产日期:</span>
-                               <input type="date"  class="form-control-sm" name="produced_at"  v-model="inventoryMission.produced_at">
+                               <input type="date"  class="form-control-sm" name="produced_at"  v-model="inventoryMission.produced_at.substr(0,10)">
                             </span>
 
                             <span class="mr-3 text-nowrap"><span class="font-weight-bold">失效时期:</span>
-                                <input type="date"  class="form-control-sm" name="valid_at"  v-model="inventoryMission.valid_at">
+                                <input type="date"  class="form-control-sm" name="valid_at"  v-model="inventoryMission.valid_at.substr(0,10)">
                             </span>
 
                             <span class="mr-3 text-nowrap"><span class="font-weight-bold">批号:</span>
@@ -595,9 +595,14 @@
                             });
                         }
                     }
-                    _this.inventoryMissions.forEach(function (inventoryMission,i) {
+                    //拷贝_this.inventoryMissions
+                    let allData=JSON.stringify(_this.inventoryMissions);
+                    let allData1=JSON.parse(allData);
+                    allData1.forEach(function (inventoryMission,i) {
                         if (inventoryMission.location===location && barcode===inventoryMission.commodity.barcode){
-                            _this.inventoryAccountMissions.push(inventoryMission);
+                            if (! _this.inventoryAccountMissions.includes(inventoryMission)){
+                                _this.inventoryAccountMissions.push(inventoryMission);
+                            }
                         }
                     });
                 },