更新
:i# Please enter the commit message for your changes. Lines starting
This commit is contained in:
@@ -512,6 +512,8 @@ class FirstVisitConversionLogic
|
||||
$channelCode,
|
||||
$channel['channel_name'] ?? '',
|
||||
$channel['source_tag_name'] ?? '',
|
||||
$channel['legacy_channel_name'] ?? '',
|
||||
$channel['legacy_source_tag_name'] ?? '',
|
||||
]
|
||||
), static fn (string $value): bool => $value !== '')));
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ class ConversionLogic
|
||||
'departments' => self::buildDepartmentOptions($visibleAdminIds, $eligibleDeptIds, $allowedDeptIds),
|
||||
'assistants' => DiagnosisLogic::getAssistants($adminId, $adminInfo),
|
||||
'doctors' => self::buildDoctorOptions($visibleAdminIds),
|
||||
'media_channels' => self::buildMediaChannelOptions($visibleAdminIds, $eligibleDeptIds, $allowedDeptIds),
|
||||
'media_channels' => self::buildMediaChannelOptions(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -411,40 +411,16 @@ class ConversionLogic
|
||||
}
|
||||
|
||||
/**
|
||||
* 媒体渠道下拉:按可见部门绑定的渠道收窄。
|
||||
* 媒体渠道下拉:返回全局启用渠道;事实数据仍由 DataScope 单独约束。
|
||||
*
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
private static function buildMediaChannelOptions(?array $visibleAdminIds, array $eligibleDeptIds, ?array $allowedDeptIds = null): array
|
||||
private static function buildMediaChannelOptions(): array
|
||||
{
|
||||
$allOptions = MediaChannelService::getOptions();
|
||||
if ($visibleAdminIds === null) {
|
||||
return $allOptions;
|
||||
}
|
||||
if (!AccountCost::supportsDeptBinding()) {
|
||||
return $allOptions;
|
||||
}
|
||||
|
||||
$allowedDeptIds ??= self::resolveFilterAllowedDeptIds($visibleAdminIds, $eligibleDeptIds);
|
||||
if ($allowedDeptIds === []) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$allowedCodes = Db::name('account_cost')
|
||||
->whereIn('dept_id', $allowedDeptIds)
|
||||
->where('media_channel_code', '<>', '')
|
||||
->distinct(true)
|
||||
->column('media_channel_code');
|
||||
$allowedCodeSet = array_fill_keys(array_filter(array_map('strval', $allowedCodes)), true);
|
||||
if ($allowedCodeSet === []) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return array_values(array_filter($allOptions, static function ($option) use ($allowedCodeSet): bool {
|
||||
$code = is_array($option) ? (string)($option['code'] ?? '') : '';
|
||||
|
||||
return $code !== '' && isset($allowedCodeSet[$code]);
|
||||
}));
|
||||
// Channels are dimension values, while account_cost rows are optional
|
||||
// facts. Using cost bindings as an option whitelist hid valid labels and
|
||||
// made the dropdown change when department/assistant filters changed.
|
||||
return MediaChannelService::getOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user