修改审批
This commit is contained in:
@@ -69,6 +69,26 @@ class ApprovalInstances extends Model
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
|
||||
|
||||
|
||||
// ====== ====== ====== 映射业务表 ====== ====== ======
|
||||
protected const BIZ_CLASS = [
|
||||
'stock_orders' => \app\common\model\StockOrders::class
|
||||
];
|
||||
|
||||
public function getBizTypeAttribute($value)
|
||||
{
|
||||
return self::BIZ_CLASS[$value] ?? $value;
|
||||
}
|
||||
|
||||
public function bizInfo()
|
||||
{
|
||||
return $this->morphTo('bizInfo', 'biz_type', 'biz_id');
|
||||
}
|
||||
// ====== ====== ====== 映射表业务 ====== ====== ======
|
||||
|
||||
|
||||
|
||||
public function records()
|
||||
{
|
||||
return $this->hasMany(ApprovalRecords::class, 'instance_id', 'id');
|
||||
@@ -84,18 +104,16 @@ class ApprovalInstances extends Model
|
||||
return $this->belongsTo(User::class, 'initiator_id', 'id');
|
||||
}
|
||||
|
||||
public function bizInfo()
|
||||
{
|
||||
return $this->belongsTo(StockOrders::class, 'biz_id', 'id');
|
||||
}
|
||||
// public function bizInfo2()
|
||||
// {
|
||||
// return $this->belongsTo(StockOrders::class, 'biz_id', 'id');
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取当前步骤的所有审批记录(pending 状态)
|
||||
*/
|
||||
public function currentStepRecords()
|
||||
{
|
||||
return $this->approvalRecords()
|
||||
->where('step_index', $this->current_step)
|
||||
->where('status', 'pending');
|
||||
return $this->approvalRecords()->where('step_index', $this->current_step)->where('status', 'pending');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user