update
This commit is contained in:
parent
cc8c3a9a4b
commit
6347c04b78
@ -72,7 +72,7 @@
|
|||||||
};
|
};
|
||||||
return $data;
|
return $data;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
$step = Db::name('oa_flow_step')->field('id,action_id,flow_uids')->where('action_id',$params['id'])->order('sort asc')->select()->toArray();
|
$step = Db::name('oa_flow_step')->field('id,action_id,flow_uids,flow_type')->where('action_id',$params['id'])->order('sort asc')->select()->toArray();
|
||||||
foreach ($step as $key => &$val) {
|
foreach ($step as $key => &$val) {
|
||||||
$user_id_info = Admin::field('id,name')->where('id','in',$val['flow_uids'])->select()->toArray();
|
$user_id_info = Admin::field('id,name')->where('id','in',$val['flow_uids'])->select()->toArray();
|
||||||
foreach ($user_id_info as $k => &$v) {
|
foreach ($user_id_info as $k => &$v) {
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
namespace app\adminapi\controller\works\finance;
|
namespace app\adminapi\controller\works\finance;
|
||||||
|
|
||||||
use app\adminapi\controller\BaseAdminController;
|
use app\adminapi\controller\BaseAdminController;
|
||||||
|
use app\adminapi\validate\works\finance\ExpenseValidate;
|
||||||
|
|
||||||
class ExpenseController extends BaseAdminController
|
class ExpenseController extends BaseAdminController
|
||||||
{
|
{
|
||||||
public function add(){
|
public function add(){
|
||||||
$params = $this->request->post(['code','income_month','expense_time','flow_id','check_admin_ids','copy_uids','annex','detail']);
|
$params = (new ExpenseValidate())->post()->goCheck('add');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace app\adminapi\validate\works\finance;
|
namespace app\adminapi\validate\works\finance;
|
||||||
|
|
||||||
|
use app\common\model\works\bgsp\OaFlow;
|
||||||
use app\common\validate\BaseValidate;
|
use app\common\validate\BaseValidate;
|
||||||
|
|
||||||
class ExpenseValidate extends BaseValidate
|
class ExpenseValidate extends BaseValidate
|
||||||
@ -22,12 +23,89 @@
|
|||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected $field = [
|
protected $field = [
|
||||||
'id' => 'require',
|
'id' => 'id',
|
||||||
'code' => 'require',
|
'code' => '报销编码',
|
||||||
'income_month' => 'require|dateFormat:Y-m',
|
'income_month' => '入账月份',
|
||||||
'expense_time' => 'require|dateFormat:Y-m-d',
|
'expense_time' => '原始单据日期',
|
||||||
'flow_id' => 'require|checkFlow',
|
'flow_id' => '审批流程',
|
||||||
'annex' => 'checkAnnex',
|
'annex' => '附件',
|
||||||
'detail' => 'require|checkDetail',
|
'detail' => '报销选项',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 添加场景
|
||||||
|
* @return ExpenseValidate
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/05/24 14:16
|
||||||
|
*/
|
||||||
|
public function sceneAdd()
|
||||||
|
{
|
||||||
|
return $this->only(['code','income_month','expense_time','flow_id','annex','detail','check_admin_ids','copy_uids']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 编辑场景
|
||||||
|
* @return ExpenseValidate
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/05/24 14:16
|
||||||
|
*/
|
||||||
|
public function sceneEdit()
|
||||||
|
{
|
||||||
|
return $this->only(['id','code','income_month','expense_time','flow_id','annex','detail','check_admin_ids','copy_uids']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 删除场景
|
||||||
|
* @return ExpenseValidate
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/05/24 14:16
|
||||||
|
*/
|
||||||
|
public function sceneDelete()
|
||||||
|
{
|
||||||
|
return $this->only(['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 详情场景
|
||||||
|
* @return ExpenseValidate
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/05/24 14:16
|
||||||
|
*/
|
||||||
|
public function sceneDetail()
|
||||||
|
{
|
||||||
|
return $this->only(['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkFlow($value): bool|string {
|
||||||
|
$data = OaFlow::where('id',$value)->findOrEmpty();
|
||||||
|
if($data->isEmpty()){
|
||||||
|
return '审批流程信息不存在';
|
||||||
|
}
|
||||||
|
if($data['type'] != 5){
|
||||||
|
return '当前审批流信息不属于报销审批类型';
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkDetail($value): bool|string
|
||||||
|
{
|
||||||
|
if(!is_array($value)){
|
||||||
|
return '报销选项数据格式错误';
|
||||||
|
}
|
||||||
|
foreach($value as $k=>$v){
|
||||||
|
if(empty($v['amount'])){
|
||||||
|
return '报销选项第'.($k+1).'行报销金额为空';
|
||||||
|
}
|
||||||
|
if(empty($v['cate_id'])){
|
||||||
|
return '报销选项第'.($k+1).'行报销项目为空';
|
||||||
|
}
|
||||||
|
if(!in_array($v['cate_id'],[1,2,3,4,5,6])){
|
||||||
|
return '报销选项第'.($k+1).'行报销项目数据值错误';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user