main
panliang 2024-04-29 10:38:39 +08:00
parent 8fa087bf46
commit 9934878995
2 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,7 @@ class EmployeeController extends AdminController
->valueField('id')
->columnRatio(3)
->clearable(),
amisMake()->TextControl()->name('employee_search')->label(__('store.employees'))->placeholder('姓名/电话')->columnRatio(3)->clearable(),
amisMake()->TextControl()->name('search')->label(__('store.employees'))->placeholder('姓名/电话')->columnRatio(3)->clearable(),
]),
]))
->filterDefaultVisible()

View File

@ -24,10 +24,10 @@ class EmployeeController extends Controller
$filter = $request->all();
$query = Employee::with(['jobs', 'store', 'adminUser'])->filter($filter)->enable();
if (!in_array(UserRole::Admin->value, $role)) {
if (!in_array(UserRole::Admin, $role)) {
$query->whereIn('store_id', [$user->store_id]);
}
$list = $query->paginate($request->input('per_page'));
$list = $query->orderBy('id', 'desc')->paginate($request->input('per_page'));
return EmployeeResource::collection($list);
}