更新审批流程
This commit is contained in:
parent
598acfebea
commit
1be5682baf
|
@ -642,6 +642,97 @@ class OaApprove extends ApiController
|
|||
}
|
||||
}
|
||||
|
||||
//查看流程
|
||||
public function view()
|
||||
{
|
||||
$param = get_params();
|
||||
$this->uid = JWT_UID;
|
||||
$detail = Db::name('Approve')->where('id',$param['id'] ?? 0)->find();
|
||||
if (empty($detail)) {
|
||||
$this->apiError("审批流程不存在");
|
||||
}
|
||||
$check_record = [];
|
||||
if($detail['start_time']>0){
|
||||
$detail['start_time'] = date('Y-m-d H:i',$detail['start_time']);
|
||||
}
|
||||
if($detail['end_time']>0){
|
||||
$detail['end_time'] = date('Y-m-d H:i',$detail['end_time']);
|
||||
}
|
||||
if($detail['detail_time']>0){
|
||||
$detail['detail_time'] = date('Y-m-d',$detail['detail_time']);
|
||||
}
|
||||
|
||||
$detail['days'] = floor($detail['duration']*10/80);
|
||||
$detail['hours'] = (($detail['duration']*10)%80)/10;
|
||||
|
||||
$detail['create_user'] = Db::name('Admin')->where('id',$detail['admin_id'])->value('name');
|
||||
$flows = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>1,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
|
||||
$detail['check_user'] = '-';
|
||||
$detail['copy_user'] = '-';
|
||||
$check_user_ids = [];
|
||||
if($detail['check_status']<2){
|
||||
if($flows['flow_type']==1){
|
||||
$detail['check_user'] = '部门负责人';
|
||||
$check_user_ids = explode(',',$detail['check_admin_ids']);
|
||||
}
|
||||
else if($flows['flow_type']==2){
|
||||
$detail['check_user'] = '上级部门负责人';
|
||||
$check_user_ids = explode(',',$detail['check_admin_ids']);
|
||||
}
|
||||
else{
|
||||
$check_user_ids = explode(',',$flows['flow_uids']);
|
||||
$check_user = Db::name('Admin')->where('id','in',$flows['flow_uids'])->column('name');
|
||||
$detail['check_user'] = implode(',',$check_user);
|
||||
}
|
||||
}
|
||||
if($detail['copy_uids'] !=''){
|
||||
$copy_user = Db::name('Admin')->where('id','in',$detail['copy_uids'])->column('name');
|
||||
$detail['copy_user'] = implode(',',$copy_user);
|
||||
}
|
||||
if($detail['file_ids'] !=''){
|
||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||
$detail['fileArray'] = $fileArray;
|
||||
}
|
||||
|
||||
$is_check_admin = 0;
|
||||
$is_create_admin = 0;
|
||||
if($detail['admin_id'] == $this->uid){
|
||||
$is_create_admin = 1;
|
||||
}
|
||||
if(in_array($this->uid,$check_user_ids)){
|
||||
$is_check_admin = 1;
|
||||
//当前审核节点详情
|
||||
$step = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>1,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
|
||||
if($step['flow_type'] == 4){
|
||||
$check_count = Db::name('FlowRecord')->where(['action_id'=>$detail['id'],'type'=>1,'step_id'=>$step['id'],'check_user_id'=>$this->uid])->count();
|
||||
if($check_count>0){
|
||||
$is_check_admin = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$check_record = Db::name('FlowRecord')->field('f.*,a.name,a.thumb')
|
||||
->alias('f')
|
||||
->join('Admin a', 'a.id = f.check_user_id', 'left')
|
||||
->where(['f.action_id'=>$detail['id'],'f.type'=>1])
|
||||
->order('check_time desc')
|
||||
->select()->toArray();
|
||||
foreach ($check_record as $kk => &$vv) {
|
||||
$vv['check_time_str'] = date('Y-m-d H:i', $vv['check_time']);
|
||||
$vv['status_str'] = '提交';
|
||||
if($vv['status'] == 1){
|
||||
$vv['status_str'] = '审核通过';
|
||||
}
|
||||
else if($vv['status'] == 2){
|
||||
$vv['status_str'] = '审核拒绝';
|
||||
}
|
||||
if($vv['status'] == 3){
|
||||
$vv['status_str'] = '撤销';
|
||||
}
|
||||
}
|
||||
// is_create_admin 是否为创建人 is_check_admin 是否为审核人
|
||||
$this->apiSuccess('获取成功', compact('is_create_admin', 'is_check_admin', 'check_record', 'detail', 'flows'));
|
||||
}
|
||||
|
||||
//发起审批记录
|
||||
public function index()
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<div class="layui-row">
|
||||
{volist name="list" id="vo"}
|
||||
{eq name="vo.type" value="$v.id"}
|
||||
<div class="layui-col-md4" data-type="{$vo.id}" title="{$vo.title}"><div><i class="iconfont {$vo.icon}"></i>{$vo.title}-{$vo.id}</div></div>
|
||||
<div class="layui-col-md4" data-type="{$vo.id}" title="{$vo.title}"><div><i class="iconfont {$vo.icon}"></i>{$vo.title}</div></div>
|
||||
{/eq}
|
||||
{/volist}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue