更新细节

This commit is contained in:
yaooo 2023-12-20 14:35:08 +08:00
parent 6b7c1fdbd5
commit 1111ca32c9
6 changed files with 31 additions and 12 deletions

View File

@ -61,7 +61,7 @@ class CostBudgetAdjustDetailLists extends BaseAdminDataLists implements ListsSea
->leftJoin('cost_budget_adjust cbd','cbd.id = cbad.cost_budget_adjust_id')
->leftJoin('orgs o','o.id = cbd.org_id')
->leftJoin('dept d','d.id = cbd.dept_id')
->field('cbad.*, d.name as dept_name, o.name as org_name, cbd.years, cs.sn, cs.subject1, cs.subject2')
->field('cbad.*, d.name as dept_name, o.name as org_name, cbd.years, cbd.document_preparation_time, cs.sn, cs.subject1, cs.subject2')
->limit($this->limitOffset, $this->limitLength)
->order(['cbad.id' => 'desc'])
->select()->each(function($item, $key){

View File

@ -61,7 +61,7 @@ class CostBudgetDetailLists extends BaseAdminDataLists implements ListsSearchInt
->leftJoin('cost_budget cb','cb.id = cbd.cost_budget_id')
->leftJoin('orgs o','o.id = cb.org_id')
->leftJoin('dept d','d.id = cb.dept_id')
->field('cbd.*, d.name as dept_name, o.name as org_name, cb.years, cs.sn, cs.subject1, cs.subject2')
->field('cbd.*, d.name as dept_name, o.name as org_name, cb.years, cb.document_preparation_time, cs.sn, cs.subject1, cs.subject2')
->limit($this->limitOffset, $this->limitLength)
->order(['cbd.id' => 'desc'])
->select()->each(function($item, $key){

View File

@ -152,6 +152,11 @@ class CostBudgetAdjustLogic extends BaseLogic
{
$costBudgetAdjust = CostBudgetAdjust::findOrEmpty($params['id']);
$costBudgetAdjust->detail;
foreach ($costBudgetAdjust->detail as &$item) {
$item->subject;
}
$costBudgetAdjust->org;
$costBudgetAdjust->dept;
return $costBudgetAdjust->toArray();
}
}

View File

@ -31,10 +31,12 @@ class CostBudgetAdjustValidate extends BaseValidate
* @var string[]
*/
protected $rule = [
'id' => 'require',
'approve_id' => 'require',
'years' => 'require',
'document_preparation_time' => 'require',
'id' => 'require',
'org_id' => 'require',
'dept_id' => 'require',
'approve_id' => 'require',
'years' => 'require',
'document_preparation_time' => 'require',
];
@ -43,10 +45,10 @@ class CostBudgetAdjustValidate extends BaseValidate
* @var string[]
*/
protected $field = [
'id' => 'id',
'approve_id' => '审批id',
'years' => '年份',
'document_preparation_time' => '制单时间',
'id' => 'id',
'approve_id' => '审批id',
'years' => '年份',
'document_preparation_time' => '制单时间',
];

View File

@ -40,6 +40,15 @@ class CostBudgetAdjust extends BaseModel
public function detail()
{
return $this->hasMany(\app\common\model\cost\CostBudgetAdjustDetail::class, 'cost_budget_adjust_id', 'id');
}
}
public function org()
{
return $this->hasOne(\app\common\model\dept\Orgs::class, 'id', 'org_id');
}
public function dept()
{
return $this->hasOne(\app\common\model\dept\Dept::class, 'id', 'dept_id');
}
}

View File

@ -30,5 +30,8 @@ class CostBudgetAdjustDetail extends BaseModel
protected $name = 'cost_budget_adjust_detail';
protected $deleteTime = 'delete_time';
public function subject()
{
return $this->belongsTo(\app\common\model\cost\CostSubject::class, 'cost_subject_id');
}
}