100 lines
3.6 KiB
PHP
100 lines
3.6 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\manage_communication;
|
||
|
||
|
||
use app\adminapi\lists\BaseAdminDataLists;
|
||
use app\common\lists\ListsSearchInterface;
|
||
use app\common\model\auth\Admin;
|
||
use app\common\model\manage_basic\ManageProject;
|
||
use app\common\model\manage_communication\ManageAcceptDoc;
|
||
|
||
|
||
/**
|
||
* 项目管理--收文管理列表
|
||
* Class ManageAcceptDocLists
|
||
* @package app\adminapi\listsmanage_communication
|
||
*/
|
||
class ManageAcceptDocLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2024/03/07 16:46
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['project_id'],
|
||
'%like%' => ['send_company', 'accept_user'],
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取项目管理--收文管理列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2024/03/07 16:46
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
$params = $this->request->get();
|
||
$condition = [];
|
||
if (isset($params['start_date']) && $params['start_date'] != '' && isset($params['end_date']) && $params['end_date'] != '') {
|
||
if (strtotime($params['end_date']) - strtotime($params['start_date']) >= 0) {
|
||
$condition[] = ['send_date', 'between', [strtotime($params['start_date'] . ' 00:00:00'), strtotime($params['end_date'] . ' 23:59:59')]];
|
||
}
|
||
}
|
||
return ManageAcceptDoc::where($this->searchWhere)->where($condition)
|
||
->field(['id', 'project_id', 'abstract', 'send_company', 'send_date', 'accept_user', 'accept_date'])
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['id' => 'desc'])
|
||
->select()->each(function ($data) {
|
||
$project = ManageProject::field('project_name')->where('id', $data['project_id'])->findOrEmpty();
|
||
$data['project_name'] = $project['project_name'];
|
||
$admin = Admin::where('id', 'in', [$data['accept_user'], $data['read_user']])->column('name', 'id');
|
||
$data['accept_user_name'] = $admin[$data['accept_user']] ?? '';
|
||
$data['read_user_name'] = $admin[$data['read_user']] ?? '';
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取项目管理--收文管理数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2024/03/07 16:46
|
||
*/
|
||
public function count(): int
|
||
{
|
||
$params = $this->request->get();
|
||
$condition = [];
|
||
if (isset($params['start_date']) && $params['start_date'] != '' && isset($params['end_date']) && $params['end_date'] != '') {
|
||
if (strtotime($params['end_date']) - strtotime($params['start_date']) >= 0) {
|
||
$condition[] = ['date', 'between', [strtotime($params['start_date'] . ' 00:00:00'), strtotime($params['end_date'] . ' 23:59:59')]];
|
||
}
|
||
}
|
||
return ManageAcceptDoc::where($this->searchWhere)->where($condition)->count();
|
||
}
|
||
|
||
} |