This commit is contained in:
chenbo 2024-02-28 11:07:33 +08:00
parent d1c85499ba
commit fa330ad525
3 changed files with 87 additions and 86 deletions

View File

@ -39,6 +39,7 @@ class ProjectRectificationLists extends BaseAdminDataLists implements ListsSearc
{
return [
'=' => ['num', 'project', 'project_num'],
];
}
@ -54,8 +55,8 @@ class ProjectRectificationLists extends BaseAdminDataLists implements ListsSearc
*/
public function lists(): array
{
return ProjectRectification::where($this->searchWhere)
->field(['id', 'dataid', 'num', 'project', 'project_num', 'wt_unit', 'xm_master', 'zx_type', 'zg_master', 'dj_person', 'apptime', 'problem', 'deal_desc'])
return ProjectRectification::with(['projectInfo'])
->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()

View File

@ -41,10 +41,9 @@ class ProjectRectificationLogic extends BaseLogic
Db::startTrans();
try {
ProjectRectification::create([
'dataid' => $params['dataid'],
'num' => $params['num'],
'project' => $params['project'],
'project_num' => $params['project_num'],
'dataid' => generate_sn(ProjectRectification::class, 'dataid'),
'num' => generate_sn(ProjectRectification::class, 'num'),
'project_id' => $params['project_id'],
'wt_unit' => $params['wt_unit'],
'xm_master' => $params['xm_master'],
'zx_type' => $params['zx_type'],
@ -79,10 +78,7 @@ class ProjectRectificationLogic extends BaseLogic
Db::startTrans();
try {
ProjectRectification::where('id', $params['id'])->update([
'dataid' => $params['dataid'],
'num' => $params['num'],
'project' => $params['project'],
'project_num' => $params['project_num'],
'project_id' => $params['project_id'],
'wt_unit' => $params['wt_unit'],
'xm_master' => $params['xm_master'],
'zx_type' => $params['zx_type'],
@ -127,6 +123,6 @@ class ProjectRectificationLogic extends BaseLogic
*/
public static function detail($params): array
{
return ProjectRectification::findOrEmpty($params['id'])->toArray();
return ProjectRectification::with(['projectInfo'])->findOrEmpty($params['id'])->toArray();
}
}

View File

@ -16,6 +16,7 @@ namespace app\common\model\project_process_management;
use app\common\model\BaseModel;
use app\common\model\cost_project\CostProject;
use think\model\concern\SoftDelete;
@ -30,5 +31,8 @@ class ProjectRectification extends BaseModel
protected $name = 'project_rectification';
protected $deleteTime = 'delete_time';
public function projectInfo()
{
return $this->hasOne(CostProject::class, 'id', 'project_id');
}
}