Skip to content

Commit c186e92

Browse files
lizhiganglizhigang
lizhigang
authored and
lizhigang
committed
[Fix]属性设置节点判断
1 parent a630d8a commit c186e92

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

app/Http/Controllers/ProcessController.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,22 @@ public function update(Request $request, $id)
142142

143143
$process=Process::findOrFail($id);
144144

145+
if(in_array($data['process_position'], [9])){
146+
if(Flowlink::where('process_id',$id)->where("type","Condition")->count()>1){
147+
return redirect()->back()->with(['status_code'=>1,'message'=>'该节点是分支节点,不能设置为结束或起始步骤']);
148+
}
149+
}
150+
151+
if(in_array($data['process_position'], [0])){
152+
Process::where(['flow_id'=>$process->flow_id,'position'=>0])->update([
153+
'position'=>1
154+
]);
155+
156+
Process::where(['flow_id'=>$process->flow_id,'id'=>$id])->update([
157+
'position'=>0
158+
]);
159+
}
160+
145161
$process->update([
146162
'process_name'=>$process_name,
147163
'style_color'=>$style_color,
@@ -410,6 +426,13 @@ public function setFirst(Request $request){
410426
$flow_id=$request->input('flow_id',0);
411427
$process_id=$request->input('process_id',0);
412428

429+
if(Flowlink::where('process_id',$process_id)->where("type","Condition")->where('next_process_id','>','-1')->count()>1){
430+
return response()->json([
431+
'status_code'=>1,
432+
'message'=>'该节点是分支节点,不能设置为结束步骤'
433+
]);
434+
}
435+
413436
Process::where(['flow_id'=>$flow_id,'position'=>0])->update([
414437
'position'=>1
415438
]);
@@ -427,7 +450,7 @@ public function setLast(Request $request){
427450
$flow_id=$request->input('flow_id',0);
428451
$process_id=$request->input('process_id',0);
429452

430-
if(Flowlink::where('process_id',$process_id)->where('next_process_id','>','-1')->count()>1){
453+
if(Flowlink::where('process_id',$process_id)->where("type","Condition")->where('next_process_id','>','-1')->count()>1){
431454
return response()->json([
432455
'status_code'=>1,
433456
'message'=>'该节点是分支节点,不能设置为结束步骤'

app/Service/Workflow/Workflow.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public function flowlink(int $process_id){
247247
$this->goToProcess($proc->entry->parent_entry,$proc->entry->enter_process->child_back_process);
248248
$proc->entry->parent_entry->process_id=$proc->entry->enter_process->child_back_process;
249249
}else{
250-
//默认进入当前子流程步骤下一步
250+
//默认进入父流程步骤下一步
251251
$parent_flowlink=Flowlink::where(['process_id'=>$proc->entry->enter_process->id,"type"=>"Condition"])->first();
252252

253253
//判断是否为最后一步
@@ -263,12 +263,12 @@ public function flowlink(int $process_id){
263263
$this->goToProcess($proc->entry->parent_entry,$parent_flowlink->next_process_id);
264264

265265
$proc->entry->parent_entry->process_id=$parent_flowlink->next_process_id;
266+
$proc->entry->parent_entry->status=0;
266267
}
267268
}
268269

269270
$proc->entry->parent_entry->child=0;
270-
$proc->entry->parent_entry->status=0;
271-
271+
272272
$proc->entry->parent_entry->save();
273273
}
274274

resources/views/flow/design.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<!-- <li id="addson"><i class="icon-plus"></i>&nbsp;<span class="_label">添加子步骤</span></li> -->
8787
<!-- <li id="copy"><i class="icon-check"></i>&nbsp;<span class="_label">复制</span></li> -->
8888
<li id="delete"><i class="icon-trash"></i>&nbsp;<span class="_label">删除</span></li>
89-
<li id="begin"><i class="icon-play"></i>&nbsp;<span class="_label">设为第一步</span></li>
89+
<!-- <li id="begin"><i class="icon-play"></i>&nbsp;<span class="_label">保存</span></li> -->
9090
<!-- <li id="stop"><i class="icon-stop"></i>&nbsp;<span class="_label">设最后一步</span></li> -->
9191
</ul>
9292
</div>

resources/views/proc/index.blade.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
@elseif($v->status==-1)
4848
<button class="btn btn-xs btn-danger">驳回</button>
4949
@endif
50-
5150
@if($child=\App\Entry::where('pid',$v->entry->id)->whereIn('enter_proc_id',explode(',',$v->id))->first())
5251
<a href="/proc/children?entry_id={{$child->id}}" class="btn btn-xs btn-primary">子流程</a>
5352
@endif

0 commit comments

Comments
 (0)