fixed
This commit is contained in:
parent
554f1f7a47
commit
65fa27fedd
@ -20,6 +20,10 @@ use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\project\ProjectLists;
|
||||
use app\adminapi\logic\project\ProjectLogic;
|
||||
use app\adminapi\validate\project\ProjectValidate;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\project\Project;
|
||||
|
||||
|
||||
/**
|
||||
@ -103,6 +107,41 @@ class ProjectController extends BaseAdminController
|
||||
$result = ProjectLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
//项目合同列表
|
||||
public function contracts(): \think\response\Json
|
||||
{
|
||||
$params = $this->request->get(['project_id','page_no','page_size']);
|
||||
if(empty($params['project_id'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
|
||||
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
|
||||
$project = Project::where('id',$params['project_id'])->findOrEmpty();
|
||||
if($project->isEmpty()){
|
||||
return $this->fail('项目数据不存在');
|
||||
}
|
||||
$data = Contract::field('id,customer_id,contract_name,contract_code,contract_type,contract_status,business_director,contract_date,amount,amount_daxie')
|
||||
->where('customer_id',$project['custom_id'])
|
||||
->select()->each(function($item)use($project){
|
||||
$item['contract_type_text'] = $item->contract_type_text;
|
||||
$item['contract_status_text'] = $item->contract_status_text;
|
||||
$custom = Custom::field('name')->where('id',$item['customer_id'])->findOrEmpty();
|
||||
$admin = Admin::field('name')->where('id',$item['business_director'])->findOrEmpty();
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['project_code'] = $project['project_code'];
|
||||
$item['custom_name'] = $custom['name'];
|
||||
$item['business_director_name'] = $admin['name'];
|
||||
return $item;
|
||||
})->toArray();
|
||||
$count = Contract::field('id')->where('customer_id',$project['custom_id'])->count();
|
||||
$result = [
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize,
|
||||
'lists' => $data
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
}
|
@ -16,8 +16,11 @@ namespace app\adminapi\lists\custom_service;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\custom\Custom;
|
||||
use app\common\model\custom_service\CustomService;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\project\Project;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
@ -64,9 +67,13 @@ class CustomServiceLists extends BaseAdminDataLists implements ListsSearchInterf
|
||||
->order(['cs.id' => 'desc'])
|
||||
->select()->each(function($item, $key){
|
||||
//关联数据后续添加
|
||||
$item['approve_no'] = '付款单号';
|
||||
$item['approve_step'] = '流程步骤';
|
||||
$item['approve_settle_status'] = 1;
|
||||
$project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty();
|
||||
$custom = Custom::field('name')->where('id',$item['custom_id'])->findOrEmpty();
|
||||
$admin = Admin::field('name')->where('id',$item['processed_admin_id'])->findOrEmpty();
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['project_code'] = $project['project_code'];
|
||||
$item['custom_name'] = $custom['name'];
|
||||
$item['processed_admin_name'] = $admin['name'];
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
|
@ -16,6 +16,7 @@ namespace app\common\model\contract;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\dict\DictData;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
@ -49,5 +50,17 @@ class Contract extends BaseModel
|
||||
{
|
||||
return $this->hasOne(\app\common\model\dept\Dept::class, 'id', 'dept_id');
|
||||
}
|
||||
|
||||
public function getContractTypeTextAttr($value,$data): string
|
||||
{
|
||||
$dictData = DictData::where('type_value','contract_type')->column('name','value');
|
||||
return $dictData[$data['contract_type']];
|
||||
}
|
||||
|
||||
public function getContractStatusTextAttr($value,$data): string
|
||||
{
|
||||
$dictData = DictData::where('type_value','contract_status')->column('name','value');
|
||||
return $dictData[$data['contract_status']];
|
||||
}
|
||||
|
||||
}
|
@ -32,7 +32,7 @@ class CustomService extends BaseModel
|
||||
|
||||
public function getDateAttr($value)
|
||||
{
|
||||
return empty($value) ? '' : date('Y-m-d H:i:s', $value);
|
||||
return empty($value) ? '' : date('Y-m-d', $value);
|
||||
}
|
||||
|
||||
public function custom()
|
||||
|
Loading…
x
Reference in New Issue
Block a user