fix(accounts): unify modal width, add notify props to create, fix quota layout
- EditAccountModal width changed from "normal" to "wide" (match CreateAccountModal) - CreateAccountModal now passes all quota notify props to QuotaLimitCard - QuotaLimitCard: when global notify disabled, hide title row, input takes full width - Quota alert email: show remaining quota + threshold (fixed/$, percentage/%) instead of usage trigger point
This commit is contained in:
@@ -1493,6 +1493,15 @@
|
||||
:dailyLimit="editQuotaDailyLimit"
|
||||
:weeklyLimit="editQuotaWeeklyLimit"
|
||||
:quotaNotifyGlobalEnabled="quotaNotifyGlobalEnabled"
|
||||
:quotaNotifyDailyEnabled="quotaNotifyDailyEnabled"
|
||||
:quotaNotifyDailyThreshold="quotaNotifyDailyThreshold"
|
||||
:quotaNotifyDailyThresholdType="quotaNotifyDailyThresholdType"
|
||||
:quotaNotifyWeeklyEnabled="quotaNotifyWeeklyEnabled"
|
||||
:quotaNotifyWeeklyThreshold="quotaNotifyWeeklyThreshold"
|
||||
:quotaNotifyWeeklyThresholdType="quotaNotifyWeeklyThresholdType"
|
||||
:quotaNotifyTotalEnabled="quotaNotifyTotalEnabled"
|
||||
:quotaNotifyTotalThreshold="quotaNotifyTotalThreshold"
|
||||
:quotaNotifyTotalThresholdType="quotaNotifyTotalThresholdType"
|
||||
:dailyResetMode="editDailyResetMode"
|
||||
:dailyResetHour="editDailyResetHour"
|
||||
:weeklyResetMode="editWeeklyResetMode"
|
||||
@@ -1502,6 +1511,15 @@
|
||||
@update:totalLimit="editQuotaLimit = $event"
|
||||
@update:dailyLimit="editQuotaDailyLimit = $event"
|
||||
@update:weeklyLimit="editQuotaWeeklyLimit = $event"
|
||||
@update:quotaNotifyDailyEnabled="quotaNotifyDailyEnabled = $event"
|
||||
@update:quotaNotifyDailyThreshold="quotaNotifyDailyThreshold = $event"
|
||||
@update:quotaNotifyDailyThresholdType="quotaNotifyDailyThresholdType = $event"
|
||||
@update:quotaNotifyWeeklyEnabled="quotaNotifyWeeklyEnabled = $event"
|
||||
@update:quotaNotifyWeeklyThreshold="quotaNotifyWeeklyThreshold = $event"
|
||||
@update:quotaNotifyWeeklyThresholdType="quotaNotifyWeeklyThresholdType = $event"
|
||||
@update:quotaNotifyTotalEnabled="quotaNotifyTotalEnabled = $event"
|
||||
@update:quotaNotifyTotalThreshold="quotaNotifyTotalThreshold = $event"
|
||||
@update:quotaNotifyTotalThresholdType="quotaNotifyTotalThresholdType = $event"
|
||||
@update:dailyResetMode="editDailyResetMode = $event"
|
||||
@update:dailyResetHour="editDailyResetHour = $event"
|
||||
@update:weeklyResetMode="editWeeklyResetMode = $event"
|
||||
@@ -1527,6 +1545,15 @@
|
||||
:dailyLimit="editQuotaDailyLimit"
|
||||
:weeklyLimit="editQuotaWeeklyLimit"
|
||||
:quotaNotifyGlobalEnabled="quotaNotifyGlobalEnabled"
|
||||
:quotaNotifyDailyEnabled="quotaNotifyDailyEnabled"
|
||||
:quotaNotifyDailyThreshold="quotaNotifyDailyThreshold"
|
||||
:quotaNotifyDailyThresholdType="quotaNotifyDailyThresholdType"
|
||||
:quotaNotifyWeeklyEnabled="quotaNotifyWeeklyEnabled"
|
||||
:quotaNotifyWeeklyThreshold="quotaNotifyWeeklyThreshold"
|
||||
:quotaNotifyWeeklyThresholdType="quotaNotifyWeeklyThresholdType"
|
||||
:quotaNotifyTotalEnabled="quotaNotifyTotalEnabled"
|
||||
:quotaNotifyTotalThreshold="quotaNotifyTotalThreshold"
|
||||
:quotaNotifyTotalThresholdType="quotaNotifyTotalThresholdType"
|
||||
:dailyResetMode="editDailyResetMode"
|
||||
:dailyResetHour="editDailyResetHour"
|
||||
:weeklyResetMode="editWeeklyResetMode"
|
||||
@@ -1536,6 +1563,15 @@
|
||||
@update:totalLimit="editQuotaLimit = $event"
|
||||
@update:dailyLimit="editQuotaDailyLimit = $event"
|
||||
@update:weeklyLimit="editQuotaWeeklyLimit = $event"
|
||||
@update:quotaNotifyDailyEnabled="quotaNotifyDailyEnabled = $event"
|
||||
@update:quotaNotifyDailyThreshold="quotaNotifyDailyThreshold = $event"
|
||||
@update:quotaNotifyDailyThresholdType="quotaNotifyDailyThresholdType = $event"
|
||||
@update:quotaNotifyWeeklyEnabled="quotaNotifyWeeklyEnabled = $event"
|
||||
@update:quotaNotifyWeeklyThreshold="quotaNotifyWeeklyThreshold = $event"
|
||||
@update:quotaNotifyWeeklyThresholdType="quotaNotifyWeeklyThresholdType = $event"
|
||||
@update:quotaNotifyTotalEnabled="quotaNotifyTotalEnabled = $event"
|
||||
@update:quotaNotifyTotalThreshold="quotaNotifyTotalThreshold = $event"
|
||||
@update:quotaNotifyTotalThresholdType="quotaNotifyTotalThresholdType = $event"
|
||||
@update:dailyResetMode="editDailyResetMode = $event"
|
||||
@update:dailyResetHour="editDailyResetHour = $event"
|
||||
@update:weeklyResetMode="editWeeklyResetMode = $event"
|
||||
@@ -3041,6 +3077,15 @@ const anthropicPassthroughEnabled = ref(false)
|
||||
const webSearchEmulationMode = ref('default')
|
||||
const webSearchGlobalEnabled = ref(false)
|
||||
const quotaNotifyGlobalEnabled = ref(false)
|
||||
const quotaNotifyDailyEnabled = ref<boolean | null>(null)
|
||||
const quotaNotifyDailyThreshold = ref<number | null>(null)
|
||||
const quotaNotifyDailyThresholdType = ref<string | null>(null)
|
||||
const quotaNotifyWeeklyEnabled = ref<boolean | null>(null)
|
||||
const quotaNotifyWeeklyThreshold = ref<number | null>(null)
|
||||
const quotaNotifyWeeklyThresholdType = ref<string | null>(null)
|
||||
const quotaNotifyTotalEnabled = ref<boolean | null>(null)
|
||||
const quotaNotifyTotalThreshold = ref<number | null>(null)
|
||||
const quotaNotifyTotalThresholdType = ref<string | null>(null)
|
||||
|
||||
// Load global feature states once
|
||||
adminAPI.settings.getWebSearchEmulationConfig().then(cfg => {
|
||||
@@ -4153,6 +4198,22 @@ const createAccountAndFinish = async (
|
||||
if (editDailyResetMode.value === 'fixed' || editWeeklyResetMode.value === 'fixed') {
|
||||
quotaExtra.quota_reset_timezone = editResetTimezone.value || 'UTC'
|
||||
}
|
||||
// Quota notify config
|
||||
if (quotaNotifyDailyEnabled.value) {
|
||||
quotaExtra.quota_notify_daily_enabled = true
|
||||
if (quotaNotifyDailyThreshold.value != null) quotaExtra.quota_notify_daily_threshold = quotaNotifyDailyThreshold.value
|
||||
quotaExtra.quota_notify_daily_threshold_type = quotaNotifyDailyThresholdType.value || 'fixed'
|
||||
}
|
||||
if (quotaNotifyWeeklyEnabled.value) {
|
||||
quotaExtra.quota_notify_weekly_enabled = true
|
||||
if (quotaNotifyWeeklyThreshold.value != null) quotaExtra.quota_notify_weekly_threshold = quotaNotifyWeeklyThreshold.value
|
||||
quotaExtra.quota_notify_weekly_threshold_type = quotaNotifyWeeklyThresholdType.value || 'fixed'
|
||||
}
|
||||
if (quotaNotifyTotalEnabled.value) {
|
||||
quotaExtra.quota_notify_total_enabled = true
|
||||
if (quotaNotifyTotalThreshold.value != null) quotaExtra.quota_notify_total_threshold = quotaNotifyTotalThreshold.value
|
||||
quotaExtra.quota_notify_total_threshold_type = quotaNotifyTotalThresholdType.value || 'fixed'
|
||||
}
|
||||
if (Object.keys(quotaExtra).length > 0) {
|
||||
finalExtra = quotaExtra
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<BaseDialog
|
||||
:show="show"
|
||||
:title="t('admin.accounts.editAccount')"
|
||||
width="normal"
|
||||
width="wide"
|
||||
@close="handleClose"
|
||||
>
|
||||
<form
|
||||
|
||||
@@ -199,14 +199,15 @@ const onWeeklyModeChange = (e: Event) => {
|
||||
<div v-if="localEnabled && !collapsed" class="space-y-2 p-4 pt-3">
|
||||
<!-- 日配额 -->
|
||||
<div>
|
||||
<!-- 标题行 -->
|
||||
<div class="flex items-center gap-2 mb-1">
|
||||
<!-- 标题行(仅全局通知开启时显示) -->
|
||||
<div v-if="quotaNotifyGlobalEnabled" class="flex items-center gap-2 mb-1">
|
||||
<span class="text-xs font-medium text-gray-700 dark:text-gray-300 w-28 flex-shrink-0">{{ t('admin.accounts.quotaDailyLimit') }}</span>
|
||||
<span v-if="quotaNotifyGlobalEnabled && dailyLimit && dailyLimit > 0" class="text-xs font-medium text-gray-700 dark:text-gray-300">{{ t('admin.accounts.quotaNotify.alert') }}</span>
|
||||
<span v-if="dailyLimit && dailyLimit > 0" class="text-xs font-medium text-gray-700 dark:text-gray-300">{{ t('admin.accounts.quotaNotify.alert') }}</span>
|
||||
</div>
|
||||
<label v-else class="text-xs font-medium text-gray-700 dark:text-gray-300 mb-1 block">{{ t('admin.accounts.quotaDailyLimit') }}</label>
|
||||
<!-- 输入行 -->
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="relative w-28 flex-shrink-0">
|
||||
<div :class="['relative', quotaNotifyGlobalEnabled ? 'w-28 flex-shrink-0' : 'flex-1']">
|
||||
<span class="absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500 dark:text-gray-400 text-sm">$</span>
|
||||
<input :value="dailyLimit" @input="onDailyInput" type="number" min="0" step="0.01" class="input pl-6 py-1.5 text-sm" :placeholder="t('admin.accounts.quotaLimitPlaceholder')" />
|
||||
</div>
|
||||
@@ -238,12 +239,13 @@ const onWeeklyModeChange = (e: Event) => {
|
||||
|
||||
<!-- 周配额 -->
|
||||
<div>
|
||||
<div class="flex items-center gap-2 mb-1">
|
||||
<div v-if="quotaNotifyGlobalEnabled" class="flex items-center gap-2 mb-1">
|
||||
<span class="text-xs font-medium text-gray-700 dark:text-gray-300 w-28 flex-shrink-0">{{ t('admin.accounts.quotaWeeklyLimit') }}</span>
|
||||
<span v-if="quotaNotifyGlobalEnabled && weeklyLimit && weeklyLimit > 0" class="text-xs font-medium text-gray-700 dark:text-gray-300">{{ t('admin.accounts.quotaNotify.alert') }}</span>
|
||||
<span v-if="weeklyLimit && weeklyLimit > 0" class="text-xs font-medium text-gray-700 dark:text-gray-300">{{ t('admin.accounts.quotaNotify.alert') }}</span>
|
||||
</div>
|
||||
<label v-else class="text-xs font-medium text-gray-700 dark:text-gray-300 mb-1 block">{{ t('admin.accounts.quotaWeeklyLimit') }}</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="relative w-28 flex-shrink-0">
|
||||
<div :class="['relative', quotaNotifyGlobalEnabled ? 'w-28 flex-shrink-0' : 'flex-1']">
|
||||
<span class="absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500 dark:text-gray-400 text-sm">$</span>
|
||||
<input :value="weeklyLimit" @input="onWeeklyInput" type="number" min="0" step="0.01" class="input pl-6 py-1.5 text-sm" :placeholder="t('admin.accounts.quotaLimitPlaceholder')" />
|
||||
</div>
|
||||
@@ -287,12 +289,13 @@ const onWeeklyModeChange = (e: Event) => {
|
||||
|
||||
<!-- 总配额 -->
|
||||
<div>
|
||||
<div class="flex items-center gap-2 mb-1">
|
||||
<div v-if="quotaNotifyGlobalEnabled" class="flex items-center gap-2 mb-1">
|
||||
<span class="text-xs font-medium text-gray-700 dark:text-gray-300 w-28 flex-shrink-0">{{ t('admin.accounts.quotaTotalLimit') }}</span>
|
||||
<span v-if="quotaNotifyGlobalEnabled && totalLimit && totalLimit > 0" class="text-xs font-medium text-gray-700 dark:text-gray-300">{{ t('admin.accounts.quotaNotify.alert') }}</span>
|
||||
<span v-if="totalLimit && totalLimit > 0" class="text-xs font-medium text-gray-700 dark:text-gray-300">{{ t('admin.accounts.quotaNotify.alert') }}</span>
|
||||
</div>
|
||||
<label v-else class="text-xs font-medium text-gray-700 dark:text-gray-300 mb-1 block">{{ t('admin.accounts.quotaTotalLimit') }}</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="relative w-28 flex-shrink-0">
|
||||
<div :class="['relative', quotaNotifyGlobalEnabled ? 'w-28 flex-shrink-0' : 'flex-1']">
|
||||
<span class="absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500 dark:text-gray-400 text-sm">$</span>
|
||||
<input :value="totalLimit" @input="onTotalInput" type="number" min="0" step="0.01" class="input pl-6 py-1.5 text-sm" :placeholder="t('admin.accounts.quotaLimitPlaceholder')" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user