116 lines
4.4 KiB
PHP
116 lines
4.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\financial;
|
||
|
||
|
||
use app\adminapi\lists\BaseAdminDataLists;
|
||
use app\common\lists\ListsSearchInterface;
|
||
use app\common\model\auth\Admin;
|
||
use app\common\model\dept\Dept;
|
||
use app\common\model\financial\FinancialBidMargin;
|
||
use app\common\model\GeoCity;
|
||
use app\common\model\GeoProvince;
|
||
use app\common\model\marketing\MarketingBusinessOpportunity;
|
||
use app\common\model\marketing\MarketingCustom;
|
||
|
||
|
||
/**
|
||
* 财务管理--投标保证金申请列表
|
||
* Class FinancialBidMarginLists
|
||
* @package app\adminapi\listsfinancial
|
||
*/
|
||
class FinancialBidMarginLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2024/04/13 15:24
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['bid_info_id', 'business_opportunity_id', 'part_a'],
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取财务管理--投标保证金申请列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2024/04/13 15:24
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
$params = $this->request->get();
|
||
$where = [];
|
||
if (!empty($params['end_date'])) {
|
||
$date = explode(',', $params['end_date']);
|
||
$where[] = ['end_date', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]];
|
||
}
|
||
if (!empty($params['expected_return_date'])) {
|
||
$date = explode(',', $params['expected_return_date']);
|
||
$where[] = ['expected_return_date', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]];
|
||
}
|
||
return FinancialBidMargin::withoutField('update_time,delete_time')->where($this->searchWhere)->where($where)
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['id' => 'desc'])
|
||
->select()->each(function ($data) {
|
||
$project = MarketingBusinessOpportunity::field('project_name')->where('id', $data['business_opportunity_id'])->findOrEmpty();
|
||
$company = MarketingCustom::field('name')->where('id', $data['part_a'])->findOrEmpty();
|
||
$province = GeoProvince::field('province_name')->where('province_code', $data['province'])->findOrEmpty();
|
||
$city = GeoCity::field('city_name')->where('city_code', $data['city'])->findOrEmpty();
|
||
$agent = Admin::field('name')->where('id', $data['agent'])->findOrEmpty();
|
||
$head_dept = Dept::field('name')->where('id', $data['head_dept'])->findOrEmpty();
|
||
$data['project_name'] = $project?->project_name;
|
||
$data['part_a_name'] = $company?->name;
|
||
$data['province_name'] = $province?->province_name;
|
||
$data['city_name'] = $city?->city_name;
|
||
$data['agent_name'] = $agent?->name;
|
||
$data['head_dept_name'] = $head_dept?->name;
|
||
$data['pay_type_text'] = $data->pay_type_text;
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取财务管理--投标保证金申请数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2024/04/13 15:24
|
||
*/
|
||
public function count(): int
|
||
{
|
||
$params = $this->request->get();
|
||
$where = [];
|
||
if (!empty($params['end_date'])) {
|
||
$date = explode(',', $params['end_date']);
|
||
$where[] = ['end_date', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]];
|
||
}
|
||
if (!empty($params['expected_return_date'])) {
|
||
$date = explode(',', $params['expected_return_date']);
|
||
$where[] = ['expected_return_date', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]];
|
||
}
|
||
return FinancialBidMargin::where($this->searchWhere)->where($where)->count();
|
||
}
|
||
|
||
} |