96 lines
3.4 KiB
PHP
96 lines
3.4 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||
// +----------------------------------------------------------------------
|
||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||
// | 开源版本可自由商用,可去除界面版权logo
|
||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||
// | 访问官网:https://www.likeadmin.cn
|
||
// | likeadmin团队 版权所有 拥有最终解释权
|
||
// +----------------------------------------------------------------------
|
||
// | author: likeadminTeam
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\adminapi\lists\jxgl;
|
||
|
||
|
||
use app\adminapi\lists\BaseAdminDataLists;
|
||
use app\common\model\auth\Admin;
|
||
use app\common\model\jxgl\OaExamine;
|
||
use app\common\lists\ListsSearchInterface;
|
||
use app\common\model\jxgl\OaExamineDetail;
|
||
use app\common\model\jxgl\OaSelfExamine;
|
||
|
||
|
||
/**
|
||
* 考核下属记录列表
|
||
* Class OaExamineLists
|
||
* @package app\adminapi\listsjxgl
|
||
*/
|
||
class OaExamineLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
{
|
||
|
||
private $where = [];
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2024/06/04 13:37
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['examine_type'],
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取考核下属记录列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2024/06/04 13:37
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
$params = $this->request->get();
|
||
if(!empty($params['bkh_user'])){
|
||
$admin_ids = Admin::where('name','like','%'.$params['bkh_user'].'%')->column('id');
|
||
$this->where[] = ['bkh_user_id','in',$admin_ids];
|
||
}
|
||
$this->where[] = ['kh_user_id','=',$this->adminId];
|
||
return OaExamine::withoutField('update_time,delete_time')->where($this->searchWhere)->where($this->where)
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['id' => 'desc'])
|
||
->select()->each(function($data){
|
||
$self_examine = OaSelfExamine::where('id',$data['self_examine_id'])->findOrEmpty();
|
||
$data['kh_user_name'] = Admin::where('id',$data['kh_user_id'])->value('name');
|
||
$data['bkh_user_name'] = Admin::where('id',$data['bkh_user_id'])->value('name');
|
||
$data['examine_type_text'] = $data->examine_type_text;
|
||
$data['examine_month'] = $self_examine['examine_month'];
|
||
$data['total_score'] = OaExamineDetail::where('examine_id',$data['id'])->sum('score');
|
||
$data['total_self_score'] = OaExamineDetail::where('examine_id',$data['id'])->sum('self_score');
|
||
$data['total_superior_score'] = OaExamineDetail::where('examine_id',$data['id'])->sum('superior_score');
|
||
$data['final_score'] = bcadd($data['total_self_score'],$data['total_superior_score'],2) / 2;
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取考核下属记录数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2024/06/04 13:37
|
||
*/
|
||
public function count(): int
|
||
{
|
||
return OaExamine::where($this->searchWhere)->where($this->where)->count();
|
||
}
|
||
|
||
} |