feat(experiments): 重设计多组比例与返回值配置
- 方案使用动态分组表,支持添加删除、互补比例、平均分配与合计校验 - 移除默认方案,用户管理与结束实验按实际分组展示 - 固定弹窗标题和操作区并同步多组说明
This commit is contained in:
@@ -35,13 +35,12 @@ const availablePlans = computed(() =>
|
||||
);
|
||||
const form = ref({
|
||||
account: "",
|
||||
variant: "B" as "A" | "B",
|
||||
variant: "",
|
||||
reason: "",
|
||||
bypassAudience: false,
|
||||
expiresAt: new Date(Date.now() + 86400000).toISOString()
|
||||
});
|
||||
const reasons: Record<string, string> = {
|
||||
baseline: "默认组",
|
||||
default: "无运行方案",
|
||||
finished: "最终方案",
|
||||
override: "人工指定",
|
||||
@@ -49,8 +48,8 @@ const reasons: Record<string, string> = {
|
||||
sticky: "已保存的稳定分组",
|
||||
outside_traffic: "未进入实验流量",
|
||||
allocated: "按规则预计分组(未写入)",
|
||||
paused: "方案暂停,使用默认组",
|
||||
draft: "草稿,使用默认组"
|
||||
paused: "方案暂停,使用类型默认值",
|
||||
draft: "草稿,使用类型默认值"
|
||||
};
|
||||
const states: Record<string, string> = {
|
||||
draft: "草稿",
|
||||
@@ -102,7 +101,8 @@ function open(row: ExperimentUser) {
|
||||
detail.value = row;
|
||||
form.value = {
|
||||
account: row.account,
|
||||
variant: row.override?.variant ?? "B",
|
||||
variant:
|
||||
row.override?.variant ?? selected.value.config.groups[0]?.key ?? "",
|
||||
reason: "",
|
||||
bypassAudience: !!row.override?.bypassAudience,
|
||||
expiresAt: new Date(Date.now() + 86400000).toISOString()
|
||||
@@ -202,7 +202,7 @@ onMounted(async () => {
|
||||
>
|
||||
</div>
|
||||
<el-alert
|
||||
title="分组预览只读,不会给用户入组或记录曝光。先选择测试方案,再查人、指定 A/B 或恢复自动;草稿和暂停时使用方案默认组。"
|
||||
title="分组预览只读,不会给用户入组或记录曝光。先选择测试方案,再查人、指定任意配置组或恢复自动;草稿和暂停时使用类型默认返回值。"
|
||||
:closable="false"
|
||||
type="info"
|
||||
/>
|
||||
@@ -236,8 +236,12 @@ onMounted(async () => {
|
||||
{{ typeName(selected.scope) }} / {{ selected.name }}
|
||||
<el-tag>{{ states[selected.state] }}</el-tag
|
||||
><span>
|
||||
流量 {{ selected.config.traffic / 100 }}% · B 组
|
||||
{{ selected.config.weightB / 100 }}%</span
|
||||
实验流量 {{ selected.config.traffic / 100 }}% ·
|
||||
{{
|
||||
selected.config.groups
|
||||
.map(g => `${g.key} ${g.weight / 100}%`)
|
||||
.join(" / ")
|
||||
}}</span
|
||||
>
|
||||
</p>
|
||||
<el-table v-loading="loading" :data="items"
|
||||
@@ -258,7 +262,11 @@ onMounted(async () => {
|
||||
><el-table-column label="分组预览 / 返回值" min-width="200"
|
||||
><template #default="{ row }"
|
||||
><template v-if="row.decision"
|
||||
><strong>{{ row.decision.variant }} 组</strong>
|
||||
><strong>{{
|
||||
row.decision.variant
|
||||
? row.decision.variant + " 组"
|
||||
: "未入组 · 类型默认值"
|
||||
}}</strong>
|
||||
<p class="secondary">
|
||||
{{ reasons[row.decision.reason] ?? row.decision.reason }}
|
||||
</p>
|
||||
@@ -339,8 +347,12 @@ onMounted(async () => {
|
||||
></el-form-item
|
||||
><el-form-item label="指定分组"
|
||||
><el-radio-group v-model="form.variant"
|
||||
><el-radio value="A">A 组</el-radio
|
||||
><el-radio value="B">B 组</el-radio></el-radio-group
|
||||
><el-radio
|
||||
v-for="group in selected?.config.groups ?? []"
|
||||
:key="group.key"
|
||||
:value="group.key"
|
||||
>{{ group.key }} 组({{ group.weight / 100 }}%)</el-radio
|
||||
></el-radio-group
|
||||
></el-form-item
|
||||
><el-form-item label="有效期(最多 30 天)"
|
||||
><el-date-picker
|
||||
@@ -360,7 +372,7 @@ onMounted(async () => {
|
||||
><el-checkbox v-model="form.bypassAudience"
|
||||
>明确允许此账号越过人群限制</el-checkbox
|
||||
><el-alert
|
||||
title="人工指定优先于流量和稳定分组。方案未运行时仍使用默认组;恢复自动后保留原稳定分组,所有操作记录审计。"
|
||||
title="人工指定优先于流量和稳定分组。方案未运行时使用类型默认返回值;恢复自动后保留原稳定分组,所有操作记录审计。"
|
||||
:closable="false"
|
||||
class="content" /></el-form
|
||||
><template #footer
|
||||
@@ -381,8 +393,12 @@ onMounted(async () => {
|
||||
new Date(detail.createdAt).toLocaleString()
|
||||
}}</el-descriptions-item
|
||||
><el-descriptions-item label="当前预览"
|
||||
>{{ detail.decision?.variant }} 组 ·
|
||||
{{ reasons[detail.decision?.reason ?? ""] }}</el-descriptions-item
|
||||
>{{
|
||||
detail.decision?.variant
|
||||
? detail.decision.variant + " 组"
|
||||
: "未入组 · 类型默认值"
|
||||
}}
|
||||
· {{ reasons[detail.decision?.reason ?? ""] }}</el-descriptions-item
|
||||
><el-descriptions-item label="返回值">
|
||||
<pre>{{
|
||||
JSON.stringify(detail.decision?.value, null, 2)
|
||||
|
||||
Reference in New Issue
Block a user