93 lines
3.4 KiB
PHP
93 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\project;
|
||
|
||
|
||
use app\adminapi\lists\BaseAdminDataLists;
|
||
use app\common\model\project\Project;
|
||
use app\common\model\project\ProjectCostBudget;
|
||
use app\common\model\project\ProjectCostBudgetDetail;
|
||
use app\common\lists\ListsSearchInterface;
|
||
use app\common\model\project\ProjectCostTempSet;
|
||
|
||
|
||
/**
|
||
* 费用预算明细列表
|
||
* Class ProjectCostBudgetDetailLists
|
||
* @package app\adminapi\listsproject
|
||
*/
|
||
class ProjectCostBudgetDetailLists extends BaseAdminDataLists implements ListsSearchInterface
|
||
{
|
||
|
||
|
||
/**
|
||
* @notes 设置搜索条件
|
||
* @return \string[][]
|
||
* @author likeadmin
|
||
* @date 2024/01/16 14:32
|
||
*/
|
||
public function setSearch(): array
|
||
{
|
||
return [
|
||
'=' => ['project_id', 'cost_budget_id'],
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取费用预算明细列表
|
||
* @return array
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
* @author likeadmin
|
||
* @date 2024/01/16 14:32
|
||
*/
|
||
public function lists(): array
|
||
{
|
||
return ProjectCostBudgetDetail::where($this->searchWhere)
|
||
->field('id,project_id,cost_budget_id,project_cost_temp_id,unit,amount,standard,remark')
|
||
->limit($this->limitOffset, $this->limitLength)
|
||
->order(['id' => 'desc'])
|
||
->select()->each(function($data){
|
||
$cost_budget = ProjectCostBudget::field('cost_budget_code')->where('id',$data['cost_budget_id'])->findOrEmpty();
|
||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||
$project_cost_temp = ProjectCostTempSet::field('first_level_subject,second_level_subject,third_level_subject,is_travel')->where('id',$data['project_cost_temp_id'])->findOrEmpty();
|
||
$data['cost_budget_code'] = $cost_budget['cost_budget_code'];
|
||
$data['project_name'] = $project['name'];
|
||
$data['project_code'] = $project['project_code'];
|
||
$data['first_level_subject'] = $project_cost_temp['first_level_subject'];
|
||
$data['second_level_subject'] = $project_cost_temp['second_level_subject'];
|
||
$data['third_level_subject'] = $project_cost_temp['third_level_subject'];
|
||
$data['is_travel'] = $project_cost_temp['is_travel'];
|
||
$data['is_travel_text'] = $project_cost_temp->is_travel_text;
|
||
return $data;
|
||
})
|
||
->toArray();
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取费用预算明细数量
|
||
* @return int
|
||
* @author likeadmin
|
||
* @date 2024/01/16 14:32
|
||
*/
|
||
public function count(): int
|
||
{
|
||
return ProjectCostBudgetDetail::where($this->searchWhere)->count();
|
||
}
|
||
|
||
} |