Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
f44defd7
Commit
f44defd7
authored
Sep 11, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量操作
parent
79a43efa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
0 deletions
+92
-0
CostService.php
application/index/service/CostService.php
+70
-0
FApplyForFee.php
application/model/FApplyForFee.php
+13
-0
FApplyForFeeCheck.php
application/model/FApplyForFeeCheck.php
+9
-0
No files found.
application/index/service/CostService.php
View file @
f44defd7
...
@@ -98,6 +98,76 @@ class CostService
...
@@ -98,6 +98,76 @@ class CostService
return
$result
;
return
$result
;
}
}
/**
* 批量费用报销审核
* status 审核状态 1总监审核 2一审审核 3二审审核 4三审审核
*
* @param $params
* @param $agent_id
* @return mixed
*/
public
function
checkArray
(
$params
,
$agent_id
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
''
;
if
(
count
(
$params
[
'id_array'
])
>
30
)
{
$result
[
'msg'
]
=
'批量操作数量超过限制'
;
return
$result
;
}
$check_
[
'apply_for_id'
]
=
$where
[
'id'
]
=
[
'in'
,
$params
[
'id_array'
]];
$check_
[
'is_del'
]
=
$where
[
'is_del'
]
=
$is_update_apply
=
0
;
$cost_data
=
$this
->
apply_model
->
findByAll
(
'id,status,agent_id'
,
$where
);
if
(
empty
(
$cost_data
))
{
$result
[
'msg'
]
=
'无该记录'
;
return
$result
;
}
$check_
[
'type'
]
=
$params
[
'status'
];
$cost_check_data
=
$this
->
check_model
->
findColumn
(
'apply_for_id'
,
$check_
);
foreach
(
$cost_data
as
$v
)
{
if
(
$v
[
'status'
]
==
$params
[
'status'
]
||
in_array
(
$v
[
'id'
],
$cost_check_data
))
{
continue
;
//已审跳过
}
$save_check
[]
=
[
'apply_for_id'
=>
$v
[
'id'
],
'agent_id'
=>
$agent_id
,
'type'
=>
$params
[
'status'
],
'remark'
=>
$params
[
'remark'
],
];
//插入审核记录
$apply_for_id
[]
=
$v
[
'id'
];
//记录更新状态
}
$this
->
apply_model
->
startTrans
();
try
{
if
(
isset
(
$apply_for_id
))
{
$is_update_apply
=
$this
->
apply_model
->
updateData
([
'status'
=>
$params
[
'status'
]],
[
'id'
=>
[
'in'
,
$apply_for_id
]]);
}
if
(
isset
(
$save_check
))
{
$this
->
check_model
->
insertDataAll
(
$save_check
);
}
$this
->
apply_model
->
commit
();
}
catch
(
\Exception
$e
)
{
$this
->
apply_model
->
rollback
();
$is_update_apply
=
0
;
}
if
(
$is_update_apply
)
{
$result
[
'status'
]
=
'successful'
;
$result
[
'msg'
]
=
'审核成功'
;
}
else
{
$result
[
'msg'
]
=
'审核失败'
;
}
return
$result
;
}
/**
/**
* 获取费用项目
* 获取费用项目
*
*
...
...
application/model/FApplyForFee.php
View file @
f44defd7
...
@@ -149,4 +149,17 @@ class FApplyForFee extends BaseModel
...
@@ -149,4 +149,17 @@ class FApplyForFee extends BaseModel
->
where
(
$where
)
->
where
(
$where
)
->
select
();
->
select
();
}
}
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
findByAll
(
$field
,
$params
)
{
return
$this
->
db_
->
field
(
$field
)
->
where
(
$params
)
->
select
();
}
}
}
application/model/FApplyForFeeCheck.php
View file @
f44defd7
...
@@ -97,4 +97,13 @@ class FApplyForFeeCheck extends BaseModel
...
@@ -97,4 +97,13 @@ class FApplyForFeeCheck extends BaseModel
->
select
();
->
select
();
return
$result
;
return
$result
;
}
}
/**
* @param $data
* @return int|string
*/
public
function
insertDataAll
(
$data
)
{
return
$this
->
db_
->
insertAll
(
$data
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment