|
|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
|
|
|
|
|
|
use App\Models\Admin;
|
|
|
|
|
use App\Models\Visit;
|
|
|
|
|
use App\Models\VisitLog;
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
@ -68,6 +69,14 @@ class VisitController extends CommonController
|
|
|
|
|
$q->where('audit_admin_id', $this->getUserId());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 权限设置
|
|
|
|
|
$user = $this->getUser();
|
|
|
|
|
$adminIds = Admin::roleAllowAdminIds($user, $departmentIds);
|
|
|
|
|
$query->where(function ($qry) use ($adminIds, $departmentIds, $user) {
|
|
|
|
|
$qry->whereIn('department_id', $departmentIds)->orWhere(function ($qry) use ($adminIds) {
|
|
|
|
|
$qry->whereIn('admin_id', $adminIds);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
})->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc');
|
|
|
|
|
if (isset($all['is_export']) && !empty($all['is_export'])) {
|
|
|
|
|
return (new FastExcel($list->limit(5000)->get()->toArray()))->download('访问记录' . date('YmdHis') . '.csv', function ($info) {
|
|
|
|
|
@ -119,7 +128,7 @@ class VisitController extends CommonController
|
|
|
|
|
if ($validator->fails()) {
|
|
|
|
|
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
|
|
|
|
|
}
|
|
|
|
|
$detail = Visit::with('logs.admin','logs.user', 'audit.auditAdmin', 'visitTime', 'acceptAdmin.department', 'acceptAdminSignFile', 'acceptGoodsAdmin.department', 'visitArea', 'audit.auditAdmin')->find($all['id']);
|
|
|
|
|
$detail = Visit::with('logs.admin', 'logs.user', 'audit.auditAdmin', 'visitTime', 'acceptAdmin.department', 'acceptAdminSignFile', 'acceptGoodsAdmin.department', 'visitArea', 'audit.auditAdmin')->find($all['id']);
|
|
|
|
|
return $this->success($detail);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|