fix(账号管理): 调度批量结果明细与刷新优化

补充批量调度返回 success_ids/failed_ids 并增加合约/单测

前端加入降级处理与部分失败提示,表格行使用稳定 key

测试: make test-frontend

测试: go test ./internal/service -run BulkUpdateAccounts -tags=unit

测试: go test ./internal/server -run APIContracts -tags=unit
This commit is contained in:
yangjianbo
2026-01-11 20:22:17 +08:00
parent 48613558d4
commit 32953405b1
9 changed files with 497 additions and 24 deletions

View File

@@ -83,7 +83,7 @@
<tr
v-else
v-for="(row, index) in sortedData"
:key="index"
:key="resolveRowKey(row, index)"
class="hover:bg-gray-50 dark:hover:bg-dark-800"
>
<td
@@ -210,6 +210,7 @@ interface Props {
stickyActionsColumn?: boolean
expandableActions?: boolean
actionsCount?: number // 操作按钮总数,用于判断是否需要展开功能
rowKey?: string | ((row: any) => string | number)
}
const props = withDefaults(defineProps<Props>(), {
@@ -222,6 +223,18 @@ const props = withDefaults(defineProps<Props>(), {
const sortKey = ref<string>('')
const sortOrder = ref<'asc' | 'desc'>('asc')
const actionsExpanded = ref(false)
const resolveRowKey = (row: any, index: number) => {
if (typeof props.rowKey === 'function') {
const key = props.rowKey(row)
return key ?? index
}
if (typeof props.rowKey === 'string' && props.rowKey) {
const key = row?.[props.rowKey]
return key ?? index
}
const key = row?.id
return key ?? index
}
// 数据/列变化时重新检查滚动状态
// 注意:不能监听 actionsExpanded因为 checkActionsColumnWidth 会临时修改它,会导致无限循环