Skip to content

Commit ab8c6de

Browse files
lizhiganglizhigang
lizhigang
authored and
lizhigang
committed
[Fix]部门主管经理未设置处理
1 parent 5a9b430 commit ab8c6de

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed

app/Http/Controllers/EntryController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function store(Request $request)
9393
return redirect()->to('/');
9494
}catch(\Exception $e){
9595
DB::rollback();
96-
dd($e);
96+
return redirect()->back()->with(['success'=>-1,'message'=>$e->getMessage()]);
9797
}
9898
}
9999

@@ -206,7 +206,7 @@ public function resend(Request $request){
206206

207207
}catch(\Exception $e){
208208
DB::rollback();
209-
dd($e);
209+
return redirect()->back()->with(['success'=>-1,'message'=>$e->getMessage()]);
210210
}
211211

212212
}
@@ -227,7 +227,7 @@ public function cancel(Request $request){
227227

228228
}catch(\Exception $e){
229229
DB::rollback();
230-
dd($e);
230+
return redirect()->back()->with(['success'=>-1,'message'=>$e->getMessage()]);
231231
}
232232

233233
}

app/Http/Controllers/FlowController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function publish(Request $request){
199199
]);
200200

201201
}catch(\Exception $e){
202-
dd($e);
202+
return redirect()->back()->with(['status_code'=>1,'message'=>$e->getMessage()]);
203203
}
204204
}
205205
}

app/Http/Controllers/ProcController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ public function unpass(Request $request,$id){
135135

136136
DB::commit();
137137
}catch(\Exception $e){
138-
dd($e);
139138
DB::rollback();
139+
return redirect()->back()->with(['success'=>-1,'message'=>$e->getMessage()]);
140140
}
141141

142142
return response()->json(['status_code'=>0]);

app/Http/Controllers/ProcessController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function store(Request $request)
9494
return response()->json($res);
9595
}catch(\Exception $e){
9696
DB::rollback();
97-
dd($e);
97+
return redirect()->back()->with(['status_code'=>-1,'message'=>$e->getMessage()]);
9898
}
9999
}
100100

@@ -365,7 +365,7 @@ public function destroy(Request $request,$id)
365365
return response()->json(['status_code'=>0,'message'=>'删除成功']);
366366
}catch(\Exception $e){
367367
DB::rollback();
368-
dd($e);
368+
return redirect()->back()->with(['status_code'=>-1,'message'=>$e->getMessage()]);
369369
}
370370
}
371371

app/Service/Workflow/Workflow.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,17 @@ protected function getProcessAuditorIds(Entry $entry,$process_id){
2424

2525
if($flowlink->auditor=='-1001'){
2626
//发起人部门主管
27+
if(empty($entry->emp->dept)){
28+
return $auditor_ids;
29+
}
2730
$auditor_ids[]=$entry->emp->dept->director_id;
2831
}
2932

3033
if($flowlink->auditor=='-1002'){
3134
//发起人部门经理
35+
if(empty($entry->emp->dept)){
36+
return $auditor_ids;
37+
}
3238
$auditor_ids[]=$entry->emp->dept->manager_id;
3339
}
3440
}else{
@@ -97,7 +103,7 @@ public function setFirstProcessAuditor(Entry $entry,Flowlink $flowlink){
97103
//步骤流转
98104
//步骤审核人
99105
$auditors=Emp::whereIn('id',$auditor_ids)->get();
100-
if(empty($auditors)){
106+
if($auditors->count()<1){
101107
throw new \Exception("下一步骤未找到审核人", 1);
102108
}
103109
$time=time();
@@ -163,9 +169,13 @@ public function flowlink($process_id){
163169
}
164170

165171
$auditor_ids=$this->getProcessAuditorIds($proc->entry,$flowlink->next_process_id);
172+
if(empty($auditor_ids)){
173+
throw new \Exception("下一步骤未找到审核人", 1);
174+
}
175+
166176
$auditors=Emp::whereIn('id',$auditor_ids)->get();
167177

168-
if(empty($auditors)){
178+
if($auditors->count()<1){
169179
throw new \Exception("下一步骤未找到审核人", 1);
170180
}
171181

@@ -281,7 +291,7 @@ public function flowlink($process_id){
281291
$auditor_ids=$this->getProcessAuditorIds($proc->entry,$flowlink->next_process_id);
282292
$auditors=Emp::whereIn('id',$auditor_ids)->get();
283293

284-
if(empty($auditors)){
294+
if($auditors->count()<1){
285295
throw new \Exception("下一步骤未找到审核人", 1);
286296
}
287297
foreach($auditors as $v){
@@ -334,7 +344,7 @@ protected function goToProcess(Entry $entry,$process_id){
334344

335345
$auditors=Emp::whereIn('id',$auditor_ids)->get();
336346

337-
if(empty($auditors)){
347+
if($auditors->count()<1){
338348
throw new \Exception("下一步骤未找到审核人", 1);
339349
}
340350
$time=time();

resources/views/layouts/app.blade.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@
116116
$(function(){
117117
var success='{{Session::get("success")}}';
118118
var message='{{Session::get("message")}}';
119-
if(success){
119+
if(success==1){
120120
toastr.success(message);
121+
}else if(success==-1){
122+
toastr.error(message);
121123
}
122124
123125
//后台删除公共函数

0 commit comments

Comments
 (0)