Merge branch 'kpi-statis'
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
use app\adminapi\logic\dept\DeptLogic;
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
@@ -14,8 +15,13 @@ class AccountCostLists extends BaseAdminDataLists implements ListsSearchInterfac
|
||||
{
|
||||
public function setSearch(): array
|
||||
{
|
||||
$searchFields = ['remark', 'creator_name', 'updater_name'];
|
||||
if (AccountCost::supportsDeptBinding()) {
|
||||
$searchFields[] = 'dept_name';
|
||||
}
|
||||
|
||||
return [
|
||||
'%like%' => ['remark', 'creator_name', 'updater_name'],
|
||||
'%like%' => $searchFields,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -35,6 +41,10 @@ class AccountCostLists extends BaseAdminDataLists implements ListsSearchInterfac
|
||||
$query->where('media_channel_code', trim((string) $this->params['media_channel_code']));
|
||||
}
|
||||
|
||||
if (AccountCost::supportsDeptBinding() && !empty($this->params['dept_id'])) {
|
||||
$query->where('dept_id', (int) $this->params['dept_id']);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
@@ -58,6 +68,8 @@ class AccountCostLists extends BaseAdminDataLists implements ListsSearchInterfac
|
||||
'total_amount' => round((float) $this->baseQuery()->sum('amount'), 2),
|
||||
'days_count' => (int) $this->baseQuery()->distinct(true)->count('cost_date'),
|
||||
'media_channel_options' => MediaChannelService::getOptions(),
|
||||
'dept_options' => DeptLogic::getAllData(),
|
||||
'supports_dept_binding' => AccountCost::supportsDeptBinding(),
|
||||
'default_media_channel_code' => MediaChannelService::getDefaultCode(),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user