generated from liutk/owl-admin-base
Fix
parent
1fce3af888
commit
8267ed071c
|
|
@ -173,16 +173,29 @@ class WorkflowController extends AdminController
|
||||||
|
|
||||||
public function getValueOptions(Request $request)
|
public function getValueOptions(Request $request)
|
||||||
{
|
{
|
||||||
$type = $request->input('type');
|
$options = match (CheckType::tryFrom($request->input('type'))) {
|
||||||
$options = [];
|
CheckType::Job => Keyword::where('parent_key', 'job')->get(['key', 'name']),
|
||||||
if ($type == CheckType::Job->value) {
|
CheckType::User => Employee::enable()->get(['id', 'name']),
|
||||||
$options = Keyword::where('parent_key', 'job')->select(['key as value', 'name as label'])->get();
|
default => collect(),
|
||||||
}
|
};
|
||||||
if ($type == CheckType::User->value) {
|
|
||||||
$options = Employee::enable()->select(['id as value', 'name as label'])->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->response()->success($options);
|
return $this->response()->success(
|
||||||
|
$options->map(function ($item) {
|
||||||
|
switch (get_class($item)) {
|
||||||
|
case Keyword::class:
|
||||||
|
return ['value' => $item->key, 'label' => $item->name];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Employee::class:
|
||||||
|
return ['value' => $item->id, 'label' => $item->name];
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return $item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})->all()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function apply(Request $request)
|
public function apply(Request $request)
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ class TaskController extends Controller
|
||||||
$orderBy = <<<'MySQL'
|
$orderBy = <<<'MySQL'
|
||||||
CASE
|
CASE
|
||||||
WHEN task_status = 1 THEN 100
|
WHEN task_status = 1 THEN 100
|
||||||
|
WHEN task_status = 9 THEN 50
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END
|
END
|
||||||
MySQL;
|
MySQL;
|
||||||
|
|
@ -56,7 +57,7 @@ MySQL;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
->orderBy(DB::raw($orderBy), 'DESC')
|
->orderBy(DB::raw($orderBy), 'DESC')
|
||||||
->orderBy('start_at', 'ASC')
|
->orderBy('start_at', 'DESC')
|
||||||
->orderBy('end_at', 'ASC')
|
->orderBy('end_at', 'ASC')
|
||||||
->simplePaginate($request->query('per_page', 20));
|
->simplePaginate($request->query('per_page', 20));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue