engineering/app/adminapi/lists/cost_project/CostProjectLists.php
2024-02-29 11:59:01 +08:00

141 lines
4.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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\cost_project;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsExcelInterface;
use app\common\model\cost_project\CostProject;
use app\common\lists\ListsSearchInterface;
/**
* 造价项目台账列表
* Class CostProjectLists
* @package app\adminapi\listscost_project
*/
class CostProjectLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/02/21 09:23
*/
public function setSearch(): array
{
return [
'=' => ['cost_project_id'],
'%like%' => ['superior_sort', 'name'],
];
}
/**
* @notes 获取造价项目台账列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/02/21 09:23
*/
public function lists(): array
{
$task_allocation = $this->request->param('task_allocation', 0);
// 筛选出关联了任务类别的项目
if ($task_allocation == 1) {
return CostProject::alias('p')
->join('task_type t', 'p.id=t.cost_project_id')
->where($this->searchWhere)
->field('p.*')
->limit($this->limitOffset, $this->limitLength)
->with(['contract'])
->order(['id' => 'desc'])
->select()
->toArray();
}
return CostProject::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->with(['contract'])
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取造价项目台账数量
* @return int
* @author likeadmin
* @date 2024/02/21 09:23
*/
public function count(): int
{
$task_allocation = $this->request->param('task_allocation', 0);
// 筛选出关联了任务类别的项目
if ($task_allocation == 1) {
return CostProject::alias('p')->join('task_type t', 'p.id=t.cost_project_id')->where($this->searchWhere)->count();
}
return CostProject::where($this->searchWhere)->count();
}
public function setFileName(): string
{
return '造价项目';
}
/**
* @notes 导出字段
* @return string[]
* @author 段誉
* @date 2022/11/24 16:17
*/
public function setExcelFields(): array
{
return [
'id' => 'id',
'project_num' => '项目编号',
'project_name' => '项目名称',
'contract_id' => '关联合同',
'types' => '咨询类型',
'industry' => '行业',
'province' => '所在省份',
'city' => '所在市区',
'address' => '具体地址',
'starting' => '计划开始日期',
'endtime' => '计划结束日期',
'jhgq' => '计划工期(天)',
'org_id' => '组织id',
'depar' => '项目所属部门',
'principal' => '项目负责人',
'person' => '项目相关人员',
'invest' => '项目总投资(万元)',
'budget' => '预算造价(万元)',
'cost' => '送审造价(万元)',
'approval' => '审定造价(万元)',
'aunit' => '委托单位',
'Acontact' => '委托方联系人',
'acontactnum' => '联系电话',
'generalize' => '登记日期',
'note' => '项目规模及概括',
'remark' => '注意事项'
];
}
}