Kaynağa Gözat

临时工申请系统 添加搜索

ANG YU 4 yıl önce
ebeveyn
işleme
f8ef9047a1

+ 46 - 2
app/Filters/LaborApplyFilters.php

@@ -11,10 +11,16 @@ use Illuminate\Support\Carbon;
 class LaborApplyFilters
 {
     protected $request;
+    /** @var $queryBuilder Builder */
     protected $queryBuilder;
     protected $filters = [
-        'created_at_start',
-        'created_at_end',
+        'created_at_start',//创建起始时间
+        'created_at_end',//创建截止时间
+        'apply_user',//申请人
+        'warehouse',//仓库
+        'status',//状态
+        'remark',//用工要求
+        'user_work_group',//仓库小组
     ];
 
     protected $orderIssueQuery;
@@ -47,4 +53,42 @@ class LaborApplyFilters
     {
         $this->queryBuilder->whereDate('created_at', '<=', $created_at_end);
     }
+    //user_work_group
+    public function apply_user($apply_user)
+    {
+        $user_ids = \App\User::query()
+            ->select('id')
+            ->where('name', 'like', $apply_user . '%')
+            ->pluck('id');
+        $this->queryBuilder->whereIn('apply_user_id', $user_ids);
+    }
+
+    public function warehouse($warehouse)
+    {
+        $warehouse = array_filter(preg_split('/[,, ]+/is', $warehouse), function ($item) {
+            return $item !== null;
+        });
+        $this->queryBuilder->whereIn('warehouse_id', $warehouse);
+    }
+
+    public function status($status)
+    {
+        $status = array_filter(preg_split('/[,, ]+/is', $status), function ($item) {
+            return $item !== null;
+        });
+        $this->queryBuilder->whereIn('status', $status);
+    }
+
+    public function remark($remark)
+    {
+        $this->queryBuilder->where('remark', 'like', $remark . '%');
+    }
+
+    public function user_work_group($user_work_group)
+    {
+        $user_work_group = array_filter(preg_split('/[,, ]+/is', $user_work_group), function ($item) {
+            return $item !== null;
+        });
+        $this->queryBuilder->whereIn('user_workgroup_id', $user_work_group);
+    }
 }

+ 29 - 2
app/Filters/LaborCompanyDispatchFilters.php

@@ -11,8 +11,11 @@ class LaborCompanyDispatchFilters
     protected $request;
     protected $queryBuilder;
     protected $filters = [
-        'dispatch_date_start',
-        'dispatch_date_end',
+        'dispatch_date_start',//起始时间
+        'dispatch_date_end',//截止时间
+        'labor_company',//劳务公司
+        'warehouse',//仓库
+        'status',//状态
     ];
 
     protected $orderIssueQuery;
@@ -45,4 +48,28 @@ class LaborCompanyDispatchFilters
     {
         $this->queryBuilder->whereDate('dispatch_date', '<=', $dispatch_date_end);
     }
+
+    public function warehouse($warehouse)
+    {
+        $warehouse = array_filter(preg_split('/[,, ]+/is', $warehouse), function ($item) {
+            return $item !== null;
+        });
+        $this->queryBuilder->whereIn('warehouse_id', $warehouse);
+    }
+
+    public function labor_company($labor_company)
+    {
+        $labor_company = array_filter(preg_split('/[,, ]+/is', $labor_company), function ($item) {
+            return $item !== null;
+        });
+        $this->queryBuilder->whereIn('labor_company_id', $labor_company);
+    }
+
+    public function status($status)
+    {
+        $status = array_filter(preg_split('/[,, ]+/is', $status), function ($item) {
+            return $item !== null;
+        });
+        $this->queryBuilder->whereIn('status', $status);
+    }
 }

+ 3 - 1
app/Http/Controllers/LaborApplyController.php

@@ -39,7 +39,9 @@ class LaborApplyController extends Controller
         $labor_applies = $builder
             ->orderByDesc('id')
             ->simplePaginate();
-        return view('personnel.laborApply.index', compact('labor_applies'));
+        $warehouses = Warehouse::all();
+        $user_work_groups = UserWorkgroup::all();
+        return view('personnel.laborApply.index', compact('labor_applies','warehouses','user_work_groups'));
     }
 
     public function create()

+ 4 - 1
app/Http/Controllers/LaborCompanyDispatchController.php

@@ -7,6 +7,7 @@ use App\LaborApply;
 use App\LaborCompany;
 use App\LaborCompanyDispatch;
 use App\User;
+use App\Warehouse;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\Request;
 use Illuminate\Support\Carbon;
@@ -35,7 +36,9 @@ class LaborCompanyDispatchController extends Controller
         $labor_company_dispatches = $builder
             ->orderByDesc('id')
             ->simplePaginate();
-        return view('personnel.laborApply.dispatch.index', compact('labor_company_dispatches'));
+        $warehouses = Warehouse::all();
+        $labor_companies = LaborCompany::all();
+        return view('personnel.laborApply.dispatch.index', compact('labor_company_dispatches', 'warehouses', 'labor_companies'));
     }
 
     public function edit(LaborCompanyDispatch $laborCompanyDispatch)

+ 74 - 5
resources/views/personnel/laborApply/dispatch/index.blade.php

@@ -20,7 +20,7 @@
                                     class="fa fa-thermometer-full" style="color: red" aria-hidden="true"></i></span>
                         </div>
                     </td>
-                    <td class="">
+                    <td>
                         @can('人事管理-临时工申请协调-劳务派遣明细')
                             <div class="float-left ml-3" v-if="labor_company_dispatch.status==='人事确认'">
                                 <form :action="getBaseUrl(labor_company_dispatch) + '/laborCompanyReceivingOrder'"
@@ -62,10 +62,10 @@
                             </div>
                         @endcan()
                     </td>
-
                     <td>@{{ labor_company_dispatch.labor_company.name }}</td>
                     <td>@{{ labor_company_dispatch.labor_company.warehouse.name }}</td>
-                    <td>@{{ labor_company_dispatch.status }}</td>
+                    <td><span :class="getStatusClass(labor_company_dispatch.status)">@{{ labor_company_dispatch.status }}</span>
+                    </td>
                     <td>@{{ labor_company_dispatch.man_num }}</td>
                     <td>@{{ labor_company_dispatch.woman_num }}</td>
                     <td>
@@ -91,7 +91,7 @@
                             </a>
                         </div>
                     </td>
-                    <td>@{{  labor_company_dispatch.dispatch_date.slice(0, 10)  }}</td>
+                    <td>@{{ labor_company_dispatch.dispatch_date.slice(0, 10) }}</td>
 
                 </tr>
             </table>
@@ -113,7 +113,27 @@
                         {!! $labor_company_dispatch !!},
                     @endforeach
                 ],
-                selectTr: 0
+                selectTr: 0,
+                warehouses: [
+                        @foreach( $warehouses as $item )
+                    {
+                        name: '{{ $item->id }}', value: '{{ $item->name }}'
+                    },
+                    @endforeach
+                ],
+                labor_companies: [
+                        @foreach( $labor_companies as $item )
+                    {
+                        name: '{{ $item->id }}', value: '{{ $item->name }}'
+                    },
+                    @endforeach
+                ],
+                statuses: [
+                    {name: 1, value: '创建'},
+                    {name: 2, value: '人事确认'},
+                    {name: 3, value: '劳务接单'},
+                    {name: 4, value: '任务完结'},
+                ]
             },
             mounted() {
                 $('#list').removeClass('d-none');
@@ -121,8 +141,36 @@
                 $(".up").slideUp();
                 let data = [
                     [
+                        //起始时间
                         {name: 'dispatch_date_start', type: 'dateTime', tip: '选择显示分配时间的起始时间'},
+                        //仓库
+                        {
+                            name: 'warehouse',
+                            type: 'select_multiple_select',
+                            tip: ['输入关键词快速定位下拉列表,回车确定', '仓库'],
+                            placeholder: ['仓库', '定位或多选仓库'],
+                            data: _this.warehouses
+                        },
+                        //状态
+                        {
+                            name: 'status',
+                            type: 'select_multiple_select',
+                            tip: ['输入关键词快速定位下拉列表,回车确定', '状态'],
+                            placeholder: ['状态', '定位或多选状态'],
+                            data: _this.statuses
+                        },
+                    ],
+                    [
+                        //截止时间
                         {name: 'dispatch_date_end', type: 'dateTime', tip: '选择显示分配时间的截止时间'},
+                        //劳务公司
+                        {
+                            name: 'labor_company',
+                            type: 'select_multiple_select',
+                            tip: ['输入关键词快速定位下拉列表,回车确定', '劳务公司'],
+                            placeholder: ['劳务公司', '定位或多选劳务公司'],
+                            data: _this.labor_companies
+                        },
                     ]
                 ]
                 _this.form = new query({
@@ -175,6 +223,27 @@
                     url = "{{ url('personnel/laborApply/laborCompanyDispatch') }}/" + labor_company_dispatch.id;
                     return url;
                 },
+                //获取状态的徽章(badge)组件的外观
+                getStatusClass(status) {
+                    let result = '';
+                    switch (status) {
+                        case '创建':
+                            result = 'badge badge-light'
+                            break;
+                        case '指派成功':
+                            result = 'badge badge-info'
+                            break;
+                        case '劳务接单':
+                            result = 'badge badge-primary'
+                            break;
+                        case '任务完结':
+                            result = 'badge badge-success'
+                            break;
+                        default:
+                            result = 'badge badge-info'
+                    }
+                    return result;
+                }
             },
         });
     </script>

+ 77 - 3
resources/views/personnel/laborApply/index.blade.php

@@ -21,7 +21,9 @@
                         <input class="checkItem" type="checkbox" :value="labor_apply.id">
                     </td>
                     <td>@{{ i+1 }}</td>
-                    <td>@{{ labor_apply.status }}</td>
+                    <td>
+                        <span :class="getStatusClass(labor_apply.status)">@{{ labor_apply.status }}</span>
+                    </td>
                     <td>@{{ labor_apply.created_at }}</td>
                     <td>@{{ labor_apply.remark }}</td>
                     <td>@{{ labor_apply.warehouse && labor_apply.warehouse.name }}</td>
@@ -64,7 +66,27 @@
                         {!! $labor_apply !!},
                     @endforeach
                 ],
-                selectTr: 0
+                selectTr: 0,
+                warehouses: [
+                    @foreach( $warehouses as $item )
+                    {
+                        name: '{{ $item->id }}', value: '{{ $item->name }}'
+                    },
+                    @endforeach
+                ],
+                user_work_groups: [
+                        @foreach( $user_work_groups as $item )
+                    {
+                        name: '{{ $item->id }}', value: '{{ $item->name }}'
+                    },
+                    @endforeach
+                ],
+                statuses: [
+                    {name: 1, value: '创建'},
+                    {name: 2, value: '指派成功'},
+                    {name: 3, value: '劳务接单'},
+                    {name: 4, value: '任务完结'},
+                ]
             },
             created() {
                 //计算到岗率
@@ -88,8 +110,40 @@
                 $(".up").slideUp();
                 let data = [
                     [
+                        //申请人
+                        {name: 'apply_user', type: 'input', tip: '搜索申请人', placeholder: '申请人'},
+                        //创建起始时间
                         {name: 'created_at_start', type: 'dateTime', tip: '选择显示创建时间的起始时间'},
+                        //仓库
+                        {
+                            name: 'warehouse',
+                            type: 'select_multiple_select',
+                            tip: ['输入关键词快速定位下拉列表,回车确定', '仓库'],
+                            placeholder: ['仓库', '定位或多选仓库'],
+                            data: _this.warehouses
+                        },
+                        //状态
+                        {
+                            name: 'status',
+                            type: 'select_multiple_select',
+                            tip: ['输入关键词快速定位下拉列表,回车确定', '状态'],
+                            placeholder: ['状态', '定位或多选状态'],
+                            data: _this.statuses
+                        },
+                    ],
+                    [
+                        //用工要求
+                        {name: 'remark', type: 'input', tip: '搜索用工要求', placeholder: '用工要求'},
+                        //创建截止时间
                         {name: 'created_at_end', type: 'dateTime', tip: '选择显示创建时间的截止时间'},
+                        //仓库小组
+                        {
+                            name: 'user_work_group',
+                            type: 'select_multiple_select',
+                            tip: ['输入关键词快速定位下拉列表,回车确定', '仓库小组'],
+                            placeholder: ['仓库小组', '定位或多选仓库小组'],
+                            data: _this.user_work_groups
+                        },
                     ]
                 ];
                 _this.form = new query({
@@ -128,7 +182,27 @@
                 getBaseUrl(obj) {
                     return "{{ url('personnel/laborApply') }}/" + obj.id;
                 },
-
+                //获取状态的徽章(badge)组件的外观
+                getStatusClass(status) {
+                    let result = '';
+                    switch (status) {
+                        case '创建':
+                            result = 'badge badge-light'
+                            break;
+                        case '指派成功':
+                            result = 'badge badge-info'
+                            break;
+                        case '劳务接单':
+                            result = 'badge badge-primary'
+                            break;
+                        case '任务完结':
+                            result = 'badge badge-success'
+                            break;
+                        default:
+                            result = 'badge badge-info'
+                    }
+                    return result;
+                }
             }
         });
     </script>