更新报销处理
This commit is contained in:
parent
658a22b7ec
commit
9ad7e6d2f2
|
@ -15,7 +15,6 @@ use app\finance\model\Expense as ExpenseList;
|
|||
use app\finance\validate\ExpenseCheck;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
|
||||
class FinanceExpense extends ApiController
|
||||
{
|
||||
|
@ -398,8 +397,14 @@ class FinanceExpense extends ApiController
|
|||
//查看
|
||||
public function view()
|
||||
{
|
||||
$this->checkAuth();
|
||||
$this->uid = JWT_UID;
|
||||
$param = get_params();
|
||||
$id = empty(get_params('id')) ? 0 : get_params('id');
|
||||
$detail = (new ExpenseList())->detail($id);
|
||||
if (empty($detail)) {
|
||||
$this->apiError('报销流程不存在');
|
||||
}
|
||||
$flows = Db::name('FlowStep')->where(['action_id'=>$detail['id'],'type'=>2,'sort'=>$detail['check_step_sort'],'delete_time'=>0])->find();
|
||||
$detail['check_user'] = '-';
|
||||
$detail['copy_user'] = '-';
|
||||
|
@ -453,6 +458,7 @@ class FinanceExpense extends ApiController
|
|||
->select()->toArray();
|
||||
foreach ($check_record as $kk => &$vv) {
|
||||
$vv['check_time_str'] = date('Y-m-d H:i', $vv['check_time']);
|
||||
$vv['check_time'] = date('Y-m-d H:i:s', $vv['check_time']);
|
||||
$vv['status_str'] = '提交';
|
||||
if($vv['status'] == 1){
|
||||
$vv['status_str'] = '审核通过';
|
||||
|
@ -464,34 +470,33 @@ class FinanceExpense extends ApiController
|
|||
$vv['status_str'] = '撤销';
|
||||
}
|
||||
}
|
||||
|
||||
View::assign('is_create_admin', $is_create_admin);
|
||||
View::assign('is_check_admin', $is_check_admin);
|
||||
View::assign('check_record', $check_record);
|
||||
View::assign('detail', $detail);
|
||||
View::assign('flows', $flows);
|
||||
View::assign('uid', $this->uid);
|
||||
return view();
|
||||
// is_create_admin 是否为创建人 is_check_admin 是否为审核人
|
||||
$this->apiSuccess('获取成功', compact('is_create_admin', 'is_check_admin', 'check_record', 'detail', 'flows'));
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delete()
|
||||
{
|
||||
$this->checkAuth();
|
||||
$this->uid = JWT_UID;
|
||||
$id = get_params("id");
|
||||
$expense = (new ExpenseList())->detail($id);
|
||||
if (empty($expense)) {
|
||||
$this->apiError('报销流程不存在');
|
||||
}
|
||||
if ($expense['check_status'] == 2) {
|
||||
return to_assign(1, "已审核的报销记录不能删除");
|
||||
$this->apiError('已审核的报销记录不能删除');
|
||||
}
|
||||
if ($expense['check_status'] == 5) {
|
||||
return to_assign(1, "已打款的报销记录不能删除");
|
||||
$this->apiError('已打款的报销记录不能删除');
|
||||
}
|
||||
$data['delete_time'] = time();
|
||||
$data['id'] = $id;
|
||||
if (Db::name('expense')->update($data) !== false) {
|
||||
add_log('delete', $id);
|
||||
return to_assign(0, "删除成功");
|
||||
$this->apiSuccess('删除成功');
|
||||
} else {
|
||||
return to_assign(1, "删除失败");
|
||||
$this->apiError('删除失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -562,6 +562,7 @@ class OaApprove extends ApiController
|
|||
//查看流程
|
||||
public function view()
|
||||
{
|
||||
$this->checkAuth();
|
||||
$param = get_params();
|
||||
$this->uid = JWT_UID;
|
||||
$loginAdmin = Db::name('Admin')->where(['id' => $this->uid])->find();
|
||||
|
@ -639,7 +640,7 @@ class OaApprove extends ApiController
|
|||
->select()->toArray();
|
||||
foreach ($check_record as $kk => &$vv) {
|
||||
$vv['check_time_str'] = date('Y-m-d H:i:s', $vv['check_time']);
|
||||
$vv['check_time_'] = date('Y-m-d H:i:s', $vv['check_time']);
|
||||
$vv['check_time'] = date('Y-m-d H:i:s', $vv['check_time']);
|
||||
$vv['status_str'] = '提交';
|
||||
if($vv['status'] == 1){
|
||||
$vv['status_str'] = '审核通过';
|
||||
|
|
Loading…
Reference in New Issue