待审核筛选

This commit is contained in:
2026-02-26 09:26:05 +08:00
parent ae9dd498af
commit 1951e2333c
2 changed files with 14 additions and 4 deletions
+4 -2
View File
@@ -60,10 +60,12 @@ class InvRequisitionService
$config['where']['applicant_id'] = $request->user->uid; $config['where']['applicant_id'] = $request->user->uid;
} elseif (isset($p['applicant_id']) && $p['applicant_id']) { //指定人员的申请 } elseif (isset($p['applicant_id']) && $p['applicant_id']) { //指定人员的申请
$config['where']['applicant_id'] = $p['applicant_id']; $config['where']['applicant_id'] = $p['applicant_id'];
} else { //审批人对应的记录 }
/* else { //审批人对应的记录
$config['with'] = ['approval'];
$config['where']['approval.approver_id'] = $request->user->uid; $config['where']['approval.approver_id'] = $request->user->uid;
//$config['where']['approval.action'] = 0; //$config['where']['approval.action'] = 0;
} }*/
if(isset($p['phase']) && $p['phase'] == 'approve'){//借用审批中 if(isset($p['phase']) && $p['phase'] == 'approve'){//借用审批中
$config['where']['status'] = ['in',[10,11]]; $config['where']['status'] = ['in',[10,11]];
if(isset($p['scene']) && $p['scene'] == 'approval'){ if(isset($p['scene']) && $p['scene'] == 'approval'){
@@ -54,10 +54,11 @@ class InvRequisitionController extends BaseController
public function index(Request $request) public function index(Request $request)
{ {
try { try {
$param = $request->all();
$applicant_id = $request->get('applicant_id'); $applicant_id = $request->get('applicant_id');
$raw = $this->service->serviceList($request); $raw = $this->service->serviceList($request);
$uid = $request->user->uid; $uid = $request->user->uid;
$data = $this->formatindex($raw,$applicant_id,$uid); $data = $this->formatindex($raw,$applicant_id,$uid,$param);
// $data = $this->transformData($raw, method_exists($this, 'indexFormat') // $data = $this->transformData($raw, method_exists($this, 'indexFormat')
// ? [$this, 'indexFormat'] // ? [$this, 'indexFormat']
// : null); // : null);
@@ -67,11 +68,18 @@ class InvRequisitionController extends BaseController
} }
} }
public function formatindex($p,$applicant_id,$uid){ public function formatindex($p,$applicant_id,$uid,$param){
$records = $p->getCollection() $records = $p->getCollection()
->map(fn($item) => $this->indexFormat($item, $applicant_id,$uid)) ->map(fn($item) => $this->indexFormat($item, $applicant_id,$uid))
->toArray(); ->toArray();
if(isset($param['phase']) && $param['phase'] == 'pending'){
foreach ($records as $key => $record) {
if($record['action']==1 || $record['action']==2)
unset($records[$key]);
}
}
return [ return [
'records' => $records, 'records' => $records,
'total' => $p->total(), 'total' => $p->total(),