update
This commit is contained in:
parent
f51c412d88
commit
291c1fd189
@ -416,7 +416,7 @@
|
||||
$params['check_admin_ids'] ='';
|
||||
}
|
||||
}else{
|
||||
$next_step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>($data['check_step_sort']+1)])->find();
|
||||
$next_step = Db::name('oa_flow_step')->where(['action_id'=>$params['id'],'sort'=>($data['check_step_sort']+1),'type'=>1])->find();
|
||||
if($next_step){
|
||||
//存在下一步审核
|
||||
if($next_step['flow_type'] == 1){
|
||||
@ -444,7 +444,7 @@
|
||||
$params['check_admin_ids'] ='';
|
||||
}
|
||||
}
|
||||
if($params['check_status'] == 1 && empty($param['check_admin_ids'])){
|
||||
if($params['check_status'] == 1 && empty($params['check_admin_ids'])){
|
||||
return $this->fail('找不到下一步的审批人,该审批流程设置有问题,请联系HR或者管理员');
|
||||
}
|
||||
//审核通过数据操作
|
||||
|
@ -7,6 +7,7 @@
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\dept\Dept;
|
||||
use app\common\model\works\bgsp\OaFlow;
|
||||
use app\common\model\works\bgsp\OaFlowType;
|
||||
use think\facade\Db;
|
||||
|
||||
class ExpenseController extends BaseAdminController
|
||||
@ -219,6 +220,48 @@
|
||||
}
|
||||
|
||||
public function lists(){
|
||||
|
||||
$params = $this->request->get(['start_time','end_time','status','page_no','page_size']);
|
||||
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
|
||||
$where = [];
|
||||
if(!empty($params['start_time']) && !empty($params['end_time'])){
|
||||
if(strtotime($params['end_time']) <= strtotime($params['start_time'])){
|
||||
return $this->fail('结束时间不等小于开始时间');
|
||||
}
|
||||
$where[] = ['create_time','between',[strtotime($params['start_time']),strtotime($params['end_time'])]];
|
||||
}
|
||||
if(!empty($params['status'])){
|
||||
$where[] = match ($params['status']){
|
||||
1=> ['check_status','=',0], //待审核
|
||||
2=> ['check_status','=',1], //审核中
|
||||
3=> [['check_status','=',2],['pay_admin_id','=',0],['pay_time','=',0]], //审批通过,待打款
|
||||
4=> ['check_status','=',3], //审核不通过
|
||||
5=> ['check_status','=',4], //撤销审核
|
||||
6=> [['check_status','=',2],['pay_admin_id','>',0],['pay_time','>',0]], //撤销审核
|
||||
};
|
||||
}else{
|
||||
$where[] = ['check_status','in','1,2,3,4'];
|
||||
}
|
||||
$lists = Db::name('oa_expense')->field('id,code,income_month,expense_time,admin_id,check_admin_ids,check_status,pay_admin_id,pay_time,create_time,detail')->where('admin_id',$this->adminId)->where($where)
|
||||
->page($page_no, $page_size)->order('id desc')->select()->each(function($data){
|
||||
$admin = Admin::field('name,dept_id')->where('id',$data['admin_id'])->findOrEmpty();
|
||||
$dept = Dept::where('id',$admin['dept_id'])->value('name');
|
||||
$check_admin_users = Admin::where('id','in',$data['check_admin_ids'])->column('name');
|
||||
$data['user_name'] = $admin['name'];
|
||||
$data['dept_name'] = $dept ?? '';
|
||||
$data['check_admin_users'] = !empty($check_admin_users) ? implode(',',$check_admin_users) : '';
|
||||
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
|
||||
$data['income_month'] = date('Y-m',$data['income_month']);
|
||||
$data['expense_time'] = date('Y-m-d',$data['expense_time']);
|
||||
$data['pay_time'] = !empty($data['pay_time']) ? date('Y-m-d H:i:s',$data['pay_time']) : '';
|
||||
$data['pay_admin_name'] = Admin::where('id',$data['pay_admin_id'])?->value('name');
|
||||
$data['check_status_text'] = match ($data['check_status']){
|
||||
0=>'待审核',1=>'审核中',2=>'审核通过',3=>'审核不通过',4=>'撤销审核'
|
||||
};
|
||||
if(!empty($data['pay_admin_id']) && !empty()){}
|
||||
return $data;
|
||||
})->toArray();
|
||||
$count = Db::name('oa_expense')->where($where)->where('admin_id',$this->adminId)->count();
|
||||
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user