Merge pull request 'update' (#82) from zhangwei into dev
Reviewed-on: #82
This commit is contained in:
commit
f7618bfaf6
@ -16,8 +16,10 @@ namespace app\adminapi\lists\project;
|
|||||||
|
|
||||||
|
|
||||||
use app\adminapi\lists\BaseAdminDataLists;
|
use app\adminapi\lists\BaseAdminDataLists;
|
||||||
|
use app\common\model\project\Project;
|
||||||
use app\common\model\project\ProjectAttendanceDetail;
|
use app\common\model\project\ProjectAttendanceDetail;
|
||||||
use app\common\lists\ListsSearchInterface;
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
use app\common\model\project\ProjectPersonnel;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,9 +39,7 @@ class ProjectAttendanceDetailLists extends BaseAdminDataLists implements ListsSe
|
|||||||
*/
|
*/
|
||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
return [];
|
||||||
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -55,10 +55,19 @@ class ProjectAttendanceDetailLists extends BaseAdminDataLists implements ListsSe
|
|||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
return ProjectAttendanceDetail::where($this->searchWhere)
|
return ProjectAttendanceDetail::where($this->searchWhere)
|
||||||
->field(['id', 'attendance_id', 'project_id', 'person_id', 'work_start_time', 'work_end_time', 'work_record_num', 'daily_salary', 'daily_living', 'daily_subsidy', 'daily_other', 'daily_income', 'remark'])
|
->field(['id', 'attendance_code', 'project_id', 'person_id', 'attendance_date', 'work_start_time', 'work_end_time', 'work_record_num', 'daily_salary', 'daily_living', 'daily_subsidy', 'daily_other', 'daily_income', 'remark'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()
|
->select()->each(function($item){
|
||||||
|
$project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty();
|
||||||
|
$person = ProjectPersonnel::field('name,idcard,work_type')->where('id',$item['person_id'])->findOrEmpty();
|
||||||
|
$item['project_name'] = $project['name'];
|
||||||
|
$item['project_code'] = $project['project_code'];
|
||||||
|
$item['person_name'] = $person['name'];
|
||||||
|
$item['person_idcard'] = $person['idcard'];
|
||||||
|
$item['work_type_text'] = $person->work_type_text;
|
||||||
|
return $item;
|
||||||
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,10 @@
|
|||||||
namespace app\adminapi\logic\project;
|
namespace app\adminapi\logic\project;
|
||||||
|
|
||||||
|
|
||||||
|
use app\common\model\project\Project;
|
||||||
use app\common\model\project\ProjectAttendanceDetail;
|
use app\common\model\project\ProjectAttendanceDetail;
|
||||||
use app\common\logic\BaseLogic;
|
use app\common\logic\BaseLogic;
|
||||||
|
use app\common\model\project\ProjectPersonnel;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
|
|
||||||
@ -119,6 +121,14 @@ class ProjectAttendanceDetailLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function detail($params): array
|
public static function detail($params): array
|
||||||
{
|
{
|
||||||
return ProjectAttendanceDetail::findOrEmpty($params['id'])->toArray();
|
$data = ProjectAttendanceDetail::findOrEmpty($params['id'])->toArray();
|
||||||
|
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||||
|
$person = ProjectPersonnel::field('name,idcard,work_type')->where('id',$data['person_id'])->findOrEmpty();
|
||||||
|
$data['project_name'] = $project['name'];
|
||||||
|
$data['project_code'] = $project['project_code'];
|
||||||
|
$data['person_name'] = $person['name'];
|
||||||
|
$data['person_idcard'] = $person['idcard'];
|
||||||
|
$data['work_type_text'] = $person->work_type_text;
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -39,4 +39,9 @@ class ProjectAttendanceDetail extends BaseModel
|
|||||||
{
|
{
|
||||||
return !empty($value) ? date('Y-m-d H:i:s',$value) : '';
|
return !empty($value) ? date('Y-m-d H:i:s',$value) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAttendanceDateAttr($value): string
|
||||||
|
{
|
||||||
|
return !empty($value) ? date('Y-m-d',$value) : '';
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user