update
This commit is contained in:
parent
76d97aa53a
commit
d7c71c15d3
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use app\adminapi\lists\BaseAdminDataLists;
|
use app\adminapi\lists\BaseAdminDataLists;
|
||||||
use app\common\lists\ListsSearchInterface;
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
use app\common\model\auth\Admin;
|
||||||
use app\common\model\dept\Dept;
|
use app\common\model\dept\Dept;
|
||||||
use app\common\model\dept\Orgs;
|
use app\common\model\dept\Orgs;
|
||||||
|
|
||||||
@ -38,13 +39,14 @@
|
|||||||
$this->where[] = ['org_id','in',$orgs];
|
$this->where[] = ['org_id','in',$orgs];
|
||||||
}
|
}
|
||||||
return Dept::where($this->searchWhere)->where($this->where)
|
return Dept::where($this->searchWhere)->where($this->where)
|
||||||
->field('id,name,org_id,mobile,status,sort,create_time')
|
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||||
->select()->each(function($item){
|
->select()->each(function($item){
|
||||||
$org = Orgs::where('id',$item['org_id'])->findOrEmpty();
|
$org = Orgs::where('id',$item['org_id'])->findOrEmpty();
|
||||||
$item['org_name'] = $org->isEmpty() ? '' : $org['name'];
|
$item['org_name'] = $org->isEmpty() ? '' : $org['name'];
|
||||||
$item['status_text'] = $item->status_text;
|
$item['status_text'] = $item->status_text;
|
||||||
|
$admin = Admin::field('name')->where('id',$item['leader_id'])->findOrEmpty();
|
||||||
|
$item['leader_name'] = !$admin->isEmpty() ? $admin['name'] : '';
|
||||||
return $item;
|
return $item;
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
@ -43,7 +43,8 @@ class DeptLogic extends BaseLogic
|
|||||||
'name' => $params['name'],
|
'name' => $params['name'],
|
||||||
'mobile' => $params['mobile'] ?? '',
|
'mobile' => $params['mobile'] ?? '',
|
||||||
'status' => $params['status'],
|
'status' => $params['status'],
|
||||||
'sort' => $params['sort'] ?? 0
|
'sort' => $params['sort'] ?? 0,
|
||||||
|
'leader_id' => $params['leader_id'] ?? 0,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +65,8 @@ class DeptLogic extends BaseLogic
|
|||||||
'name' => $params['name'],
|
'name' => $params['name'],
|
||||||
'mobile' => $params['mobile'] ?? '',
|
'mobile' => $params['mobile'] ?? '',
|
||||||
'status' => $params['status'],
|
'status' => $params['status'],
|
||||||
'sort' => $params['sort'] ?? 0
|
'sort' => $params['sort'] ?? 0,
|
||||||
|
'leader_id' => $params['leader_id'] ?? 0,
|
||||||
]);
|
]);
|
||||||
return true;
|
return true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -100,13 +102,12 @@ class DeptLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function detail($params): array
|
public static function detail($params): array
|
||||||
{
|
{
|
||||||
$data = Dept::field('id,name,org_id,mobile,status,sort,create_time')->where('id',$params['id'])->findOrEmpty();
|
$data = Dept::where('id',$params['id'])->findOrEmpty();
|
||||||
if($data->isEmpty()){
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
$org = Orgs::where('id',$data['org_id'])->findOrEmpty();
|
$org = Orgs::where('id',$data['org_id'])->findOrEmpty();
|
||||||
$data['org_name'] = $org->isEmpty() ? '' : $org['name'];
|
$data['org_name'] = $org->isEmpty() ? '' : $org['name'];
|
||||||
$data['status_text'] = $data->status_text;
|
$data['status_text'] = $data->status_text;
|
||||||
|
$admin = Admin::field('name')->where('id',$data['leader_id'])->findOrEmpty();
|
||||||
|
$data['leader_name'] = !$admin->isEmpty() ? $admin['name'] : '';
|
||||||
return $data->toArray();
|
return $data->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,13 +44,20 @@ class OaFlowLogic extends BaseLogic
|
|||||||
if($params['check_type'] == 3){
|
if($params['check_type'] == 3){
|
||||||
$flow_list = $params['flow_list'];
|
$flow_list = $params['flow_list'];
|
||||||
foreach($flow_list as &$v){
|
foreach($flow_list as &$v){
|
||||||
$v['flow_type'] = 5;
|
$v['flow_type'] = 4;
|
||||||
}
|
}
|
||||||
$params['flow_list'] = $flow_list;
|
$params['flow_list'] = $flow_list;
|
||||||
}
|
}
|
||||||
if($params['check_type'] == 2){
|
if($params['check_type'] == 2){
|
||||||
$params['flow_list'] = '';
|
$params['flow_list'] = '';
|
||||||
}
|
}
|
||||||
|
if($params['check_type'] == 1){
|
||||||
|
$flow_list = $params['flow_list'];
|
||||||
|
foreach($flow_list as &$v){
|
||||||
|
unset($v['flow_name']);
|
||||||
|
}
|
||||||
|
$params['flow_list'] = $flow_list;
|
||||||
|
}
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
OaFlow::create([
|
OaFlow::create([
|
||||||
@ -86,13 +93,20 @@ class OaFlowLogic extends BaseLogic
|
|||||||
if($params['check_type'] == 3){
|
if($params['check_type'] == 3){
|
||||||
$flow_list = $params['flow_list'];
|
$flow_list = $params['flow_list'];
|
||||||
foreach($flow_list as &$v){
|
foreach($flow_list as &$v){
|
||||||
$v['flow_type'] = 5;
|
$v['flow_type'] = 4;
|
||||||
}
|
}
|
||||||
$params['flow_list'] = $flow_list;
|
$params['flow_list'] = $flow_list;
|
||||||
}
|
}
|
||||||
if($params['check_type'] == 2){
|
if($params['check_type'] == 2){
|
||||||
$params['flow_list'] = '';
|
$params['flow_list'] = '';
|
||||||
}
|
}
|
||||||
|
if($params['check_type'] == 1){
|
||||||
|
$flow_list = $params['flow_list'];
|
||||||
|
foreach($flow_list as &$v){
|
||||||
|
unset($v['flow_name']);
|
||||||
|
}
|
||||||
|
$params['flow_list'] = $flow_list;
|
||||||
|
}
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
OaFlow::where('id', $params['id'])->update([
|
OaFlow::where('id', $params['id'])->update([
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
*/
|
*/
|
||||||
public function sceneEdit()
|
public function sceneEdit()
|
||||||
{
|
{
|
||||||
return $this->only(['id', 'org_id', 'name', 'mobile', 'status'])->append('name', 'checkUniqueByEdit');;
|
return $this->only(['id', 'org_id', 'name', 'mobile', 'status','leader_id'])->append('name', 'checkUniqueByEdit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,10 +175,10 @@ class OaFlowValidate extends BaseValidate
|
|||||||
if(!isset($v['flow_type']) || !isset($v['flow_uids'])){
|
if(!isset($v['flow_type']) || !isset($v['flow_uids'])){
|
||||||
return '固定审批流数据参数缺失';
|
return '固定审批流数据参数缺失';
|
||||||
}
|
}
|
||||||
if(empty($v['flow_type']) || !in_array($v['flow_type'],[1,2,3,4])){
|
if(empty($v['flow_type']) || !in_array($v['flow_type'],[1,2,3])){
|
||||||
return '固定审批流第'.($k+1).'行的类型未选择';
|
return '固定审批流第'.($k+1).'行的类型未选择';
|
||||||
}
|
}
|
||||||
if($v['flow_type'] > 2 && empty($v['flow_uids'])){
|
if($v['flow_type'] > 1 && empty($v['flow_uids'])){
|
||||||
return '固定审批流第'.($k+1).'行的指定人未选择';
|
return '固定审批流第'.($k+1).'行的指定人未选择';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user