feat(需求): ①全站分页pageSize统一默认10+10/20/50/100选项(9页默认值15/20→10+6个兜底常量统一+撞款台账升级OldPagination+商品类目树顶层标准分页) ②修复6页OldPagination缺import分页器不渲染(不符合ASIN/查询ASIN/最低价ASIN/生成记录/店铺密钥/店铺管理)+查询ASIN操作列按钮间距+最低价范围筛选number类型报错 ③e2e断言对齐现状(顶栏h1/移除收起按钮后规格同步)+国家显示中文断言固化

This commit is contained in:
2026-09-07 02:36:35 +08:00
parent fae9647397
commit d40811fac7
44 changed files with 590 additions and 175 deletions
@@ -31,12 +31,12 @@ const scope = ref<Scope>('global')
const selectedGroup = ref('')
const shopGroups = ref<ShopGroups>({ members: {}, shopGroupNames: {} })
const LEDGER_PAGE_SIZE = 20
/** 台账每页条数(全站统一:10/20/50/100 可选,默认 10)。 */
const ledgerPageSize = ref(10)
const ledgerItems = ref<LedgerRow[]>([])
const ledgerTotal = ref(0)
const ledgerPage = ref(1)
const ledgerLoading = ref(false)
const jumpInput = ref('')
const sortState = reactive<{ key: LedgerSortKey | ''; dir: 'asc' | 'desc' }>({ key: 'earliest', dir: 'asc' })
import OldPagination from '@/components/OldPagination.vue'
@@ -143,7 +143,7 @@ const matrixRows = computed(() =>
dupRows.value.slice((matrixPage.value - 1) * matrixPageSize.value, matrixPage.value * matrixPageSize.value),
)
const dupCardPage = ref(1)
const dupCardPageSize = ref(6)
const dupCardPageSize = ref(10)
const dupCardRows = computed(() =>
dupRows.value.slice((dupCardPage.value - 1) * dupCardPageSize.value, dupCardPage.value * dupCardPageSize.value),
)
@@ -152,10 +152,17 @@ const drawerPageSize = ref(10)
const drawerRows = computed(() =>
drawerAggRows.value.slice((drawerPage.value - 1) * drawerPageSize.value, drawerPage.value * drawerPageSize.value),
)
watch([dupRows, drawerOccurrences], () => {
/** 分组说明抽屉:分组统计表客户端分页(10/20/50/100 可选)。 */
const groupStatsPage = ref(1)
const groupStatsPageSize = ref(10)
const pagedGroupStats = computed(() =>
groupStats.value.slice((groupStatsPage.value - 1) * groupStatsPageSize.value, groupStatsPage.value * groupStatsPageSize.value),
)
watch([dupRows, drawerOccurrences, groupStats], () => {
matrixPage.value = Math.min(matrixPage.value, Math.max(1, Math.ceil(dupRows.value.length / matrixPageSize.value)))
dupCardPage.value = Math.min(dupCardPage.value, Math.max(1, Math.ceil(dupRows.value.length / dupCardPageSize.value)))
drawerPage.value = 1
groupStatsPage.value = Math.min(groupStatsPage.value, Math.max(1, Math.ceil(groupStats.value.length / groupStatsPageSize.value)))
})
const matrixHint = computed(() =>
@@ -220,7 +227,7 @@ async function loadLedger(page: number, resetSort = false) {
sortState.key = 'earliest'
sortState.dir = 'asc'
}
const result = await fetchDuplicateLedger({ view: '', ...activeFilterParams() }, page, LEDGER_PAGE_SIZE, sortState.key, sortState.dir)
const result = await fetchDuplicateLedger({ view: '', ...activeFilterParams() }, page, ledgerPageSize.value, sortState.key, sortState.dir)
ledgerItems.value = result.items
ledgerTotal.value = result.total
ledgerPage.value = result.page
@@ -349,17 +356,14 @@ function onSort(key: LedgerSortKey) {
loadLedger(1)
}
const totalPages = computed(() => Math.max(1, Math.ceil(ledgerTotal.value / LEDGER_PAGE_SIZE)))
const totalPages = computed(() => Math.max(1, Math.ceil(ledgerTotal.value / ledgerPageSize.value)))
function goPage(page: number) {
if (page < 1 || page > totalPages.value) return
loadLedger(page)
}
function jumpPage() {
const value = parseInt(jumpInput.value, 10)
if (!Number.isNaN(value) && value >= 1 && value <= totalPages.value) {
goPage(value)
jumpInput.value = ''
}
function changeLedgerSize(size: number) {
ledgerPageSize.value = size
loadLedger(1)
}
async function exportXlsx() {
@@ -594,6 +598,7 @@ onMounted(() => {
</div>
</div>
<div v-else class="dup-empty">当前范围下没有撞款ASIN</div>
<OldPagination v-if="dupRows.length > dupCardPageSize" :total="dupRows.length" :page="dupCardPage" :page-size="dupCardPageSize" @change="dupCardPage = $event" @size-change="(s: number) => { dupCardPageSize = s; dupCardPage = 1 }" />
<div class="dup-total">共 <b>{{ dupRows.length }}</b> 条{{ scope === 'group' && selectedGroup ? `分组「${selectedGroup}」组内撞款ASIN` : '全店撞款ASIN' }}</div>
</template>
@@ -631,12 +636,7 @@ onMounted(() => {
调整筛选条件或触发重新分析后再查看
</div>
</div>
<div v-if="ledgerTotal" class="pager">
<span class="total">共 <b>{{ ledgerTotal.toLocaleString() }}</b> 条 · 第 {{ ledgerPage }}/{{ totalPages }} 页</span>
<button class="pg-btn" type="button" :disabled="ledgerPage <= 1" @click="goPage(ledgerPage - 1)">上一页</button>
<button class="pg-btn" type="button" :disabled="ledgerPage >= totalPages" @click="goPage(ledgerPage + 1)">下一页</button>
<span class="jump">跳至 <input type="number" min="1" :max="totalPages" v-model="jumpInput" @keyup.enter="jumpPage" /> 页 <button class="btn btn-ghost btn-sm" type="button" @click="jumpPage">跳转</button></span>
</div>
<OldPagination v-if="ledgerTotal" :total="ledgerTotal" :page="ledgerPage" :page-size="ledgerPageSize" @change="goPage" @size-change="changeLedgerSize" />
</template>
</template>
@@ -679,6 +679,7 @@ onMounted(() => {
</tbody>
</table>
<div v-else class="dup-empty">暂无上架时间明细</div>
<OldPagination v-if="drawerAggRows.length > drawerPageSize" :total="drawerAggRows.length" :page="drawerPage" :page-size="drawerPageSize" @change="drawerPage = $event" @size-change="(s: number) => { drawerPageSize = s; drawerPage = 1 }" />
</div>
</aside>
@@ -696,7 +697,7 @@ onMounted(() => {
<table class="d-table">
<thead><tr><th>分组</th><th>店铺数</th><th>成员店铺</th><th>组内撞款</th></tr></thead>
<tbody>
<tr v-for="group in groupStats" :key="group.name">
<tr v-for="group in pagedGroupStats" :key="group.name">
<td class="cell-strong">{{ group.name }}</td>
<td class="num-cell">{{ group.shopCount }}</td>
<td><template v-for="shop in (shopGroups.members[group.name] || [])" :key="shop"><span class="badge store">{{ shop }}</span></template></td>
@@ -705,6 +706,7 @@ onMounted(() => {
<tr v-if="!groupStats.length"><td colspan="4" class="empty-cell">暂无分组</td></tr>
</tbody>
</table>
<OldPagination v-if="groupStats.length > groupStatsPageSize" :total="groupStats.length" :page="groupStatsPage" :page-size="groupStatsPageSize" @change="groupStatsPage = $event" @size-change="(s: number) => { groupStatsPageSize = s; groupStatsPage = 1 }" />
</div>
</aside>
@@ -929,20 +931,7 @@ onMounted(() => {
.dup-ref .dt-cell { font-size: 11.5px; color: var(--text2); }
.dup-ref .site-chip { border-radius: 5px; padding: 1px 7px; font-size: 11.5px; margin-right: 4px; margin-bottom: 2px; font-weight: 600; display: inline-block; white-space: nowrap; }
/* ---------- 分页 ---------- */
.dup-ref .pager {
display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 16px;
background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px;
box-shadow: var(--shadow);
}
.dup-ref .pager .total { color: var(--text2); font-size: 12.5px; margin-right: auto; }
.dup-ref .pager .total b { color: var(--text); font-size: 13px; }
.dup-ref .pager .pg-btn { height: 28px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 12px; color: var(--text2); background: #fff; }
.dup-ref .pager .pg-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.dup-ref .pager .pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.dup-ref .pager .jump { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); }
.dup-ref .pager .jump input { width: 52px; height: 28px; border: 1px solid var(--border-strong); border-radius: 6px; text-align: center; }
.dup-ref .pager .jump input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46, 91, 230, 0.12); }
/* ---------- 分页:台账/分布/矩阵/详情/抽屉统一共享 OldPagination(自带条数选择),无自绘 pager ---------- */
/* ---------- 空态 / 加载 ---------- */
.dup-ref .empty-state { padding: 48px 20px; text-align: center; color: var(--text3); font-size: 13px; }
@@ -18,13 +18,14 @@ import {
import { grantedUserIds, type TaskPermissionItem } from './task-permission.ts'
import { imageVideoDownloadFilename, videoKeysOf } from './image-video-view.ts'
import { useAdminSessionStore } from '@/stores/admin-session'
import OldPagination from '@/components/OldPagination.vue'
const session = useAdminSessionStore()
const loading = ref(false)
const tasks = ref<ImageVideoRow[]>([])
const totalTasks = ref(0)
const page = ref(1)
const pageSize = ref(20)
const pageSize = ref(10)
const jumpPage = ref('')
const totalPages = computed(() => Math.max(1, Math.ceil(totalTasks.value / pageSize.value)))
@@ -39,6 +40,12 @@ const permissionVisible = ref(false)
const permissionItems = ref<TaskPermissionItem[]>([])
const permissionInitial = ref<number[]>([])
const permissionSaving = ref(false)
/** 权限弹窗用户表客户端分页(全量用户在表格内翻页,10/20/50/100 可选)。 */
const permPage = ref(1)
const permPageSize = ref(10)
const pagedPermissionItems = computed(() =>
permissionItems.value.slice((permPage.value - 1) * permPageSize.value, permPage.value * permPageSize.value),
)
const downloading = ref(false)
const downloadingKey = ref('')
@@ -243,6 +250,7 @@ async function openPermission() {
try {
permissionItems.value = await fetchImageVideoPermissionUsers()
permissionInitial.value = grantedUserIds(permissionItems.value)
permPage.value = 1
permissionVisible.value = true
} catch (error) {
ElMessage.error(error instanceof Error ? error.message : '权限用户加载失败')
@@ -385,7 +393,7 @@ onMounted(load)
<el-dialog v-model="permissionVisible" title="视频任务记录权限配置" width="620px">
<p class="dim">勾选允许查看视频任务记录的用户(仅数据范围)。当前已授权 {{ permissionGrantedCount }} 人。</p>
<el-table :data="permissionItems" border size="small" max-height="420">
<el-table :data="pagedPermissionItems" border size="small" max-height="420">
<el-table-column prop="id" label="ID" min-width="80" />
<el-table-column prop="username" label="用户名" min-width="180" />
<el-table-column label="授权" min-width="90" align="center">
@@ -394,6 +402,7 @@ onMounted(load)
</template>
</el-table-column>
</el-table>
<OldPagination v-if="permissionItems.length > permPageSize" :total="permissionItems.length" :page="permPage" :page-size="permPageSize" @change="permPage = $event" @size-change="(s: number) => { permPageSize = s; permPage = 1 }" />
<template #footer>
<el-button @click="permissionVisible = false">取消</el-button>
<el-button type="primary" :loading="permissionSaving" @click="savePermission">保存</el-button>
@@ -32,10 +32,9 @@ const loading = ref(false)
const groups = ref<ShopDataTaskGroup[]>([])
const totalShops = ref(0)
const page = ref(1)
// 店铺级一次全载(>200 家店铺时后端按页截断,可上调或恢复底部店铺级分页)。
const pageSize = ref(200)
const pageJump = ref('')
const totalPages = computed(() => Math.max(1, Math.ceil(totalShops.value / pageSize.value)))
// 卡片宫格分页:一行 3 个、一页 9 张卡片(在店铺分页的结果文件内翻页)。
// 卡片宫格分页:一行 3 个、一页 10 张卡片(在店铺分页的结果文件内翻页)。
const cardPage = ref(1)
const cardPageSize = ref(10)
const cardJump = ref('')
@@ -47,6 +46,12 @@ const selection = ref<Set<string>>(new Set())
const permissionVisible = ref(false)
const permissionItems = ref<TaskPermissionItem[]>([])
const permissionSaving = ref(false)
/** 权限弹窗用户表客户端分页(全量用户在表格内翻页,10/20/50/100 可选)。 */
const permPage = ref(1)
const permPageSize = ref(10)
const pagedPermissionItems = computed(() =>
permissionItems.value.slice((permPage.value - 1) * permPageSize.value, permPage.value * permPageSize.value),
)
const busyKey = ref('')
const deletingKey = ref('')
@@ -115,30 +120,6 @@ function reset() {
void load()
}
function changePage(next: number) {
if (next < 1 || next > totalPages.value) return
page.value = next
cardPage.value = 1
selection.value = new Set()
void load()
}
function changeShopSize(size: number) {
pageSize.value = size
page.value = 1
cardPage.value = 1
void load()
}
function goPageJump() {
const n = Number.parseInt(pageJump.value, 10)
if (Number.isNaN(n)) {
ElMessage.warning('请输入页码')
return
}
changePage(Math.min(Math.max(n, 1), totalPages.value))
}
const allResultRows = computed(() => groups.value.flatMap((group) => group.results))
const pagedResultRows = computed(() =>
allResultRows.value.slice((cardPage.value - 1) * cardPageSize.value, cardPage.value * cardPageSize.value),
@@ -261,6 +242,7 @@ function saveBlob(blob: Blob, filename: string) {
async function openPermission() {
try {
permissionItems.value = await fetchShopDataTaskPermissionUsers()
permPage.value = 1
permissionVisible.value = true
} catch (error) {
ElMessage.error(error instanceof Error ? error.message : '权限用户加载失败')
@@ -404,7 +386,7 @@ onMounted(load)
<el-dialog v-model="permissionVisible" title="店铺数据记录数据范围授权" width="620px">
<p class="dim">勾选允许查看/操作店铺数据记录的用户(仅数据范围)。当前已授权 {{ grantedCount }} 人。</p>
<el-table :data="permissionItems" border size="small" max-height="420">
<el-table :data="pagedPermissionItems" border size="small" max-height="420">
<el-table-column prop="id" label="ID" min-width="80" />
<el-table-column prop="username" label="用户名" min-width="180" />
<el-table-column label="授权" min-width="90" align="center">
@@ -413,6 +395,7 @@ onMounted(load)
</template>
</el-table-column>
</el-table>
<OldPagination v-if="permissionItems.length > permPageSize" :total="permissionItems.length" :page="permPage" :page-size="permPageSize" @change="permPage = $event" @size-change="(s: number) => { permPageSize = s; permPage = 1 }" />
<template #footer>
<el-button @click="permissionVisible = false">取消</el-button>
<el-button type="primary" :loading="permissionSaving" @click="savePermission">保存</el-button>
@@ -1,6 +1,6 @@
/** 重复检查明细筛选与分页(任务 117):与 /duplicate-check-items 的 snake 参数契约对齐;纯逻辑。 */
export const DUPLICATE_DEFAULT_PAGE_SIZE = 20
export const DUPLICATE_DEFAULT_PAGE_SIZE = 10
export const DUPLICATE_MIN_PAGE_SIZE = 10
export const DUPLICATE_MAX_PAGE_SIZE = 100
export const DUPLICATE_PAGE_MIN = 1
@@ -1,7 +1,7 @@
/** 视频任务筛选与分页(任务 102):图生视频任务列表筛选/分页归一,与 Java AdminImageVideoTaskController
* snake_case 查询契约对齐;纯逻辑。 */
export const IMAGE_VIDEO_DEFAULT_PAGE_SIZE = 20
export const IMAGE_VIDEO_DEFAULT_PAGE_SIZE = 10
export const IMAGE_VIDEO_MIN_PAGE_SIZE = 10
export const IMAGE_VIDEO_MAX_PAGE_SIZE = 100
export const IMAGE_VIDEO_PAGE_MIN = 1
@@ -1,6 +1,6 @@
/** 店铺数据任务筛选与分页(任务 109):与 Java AdminShopDataCrawlTasksController snake 契约对齐;纯逻辑。 */
export const SHOP_DATA_DEFAULT_PAGE_SIZE = 20
export const SHOP_DATA_DEFAULT_PAGE_SIZE = 10
export const SHOP_DATA_MIN_PAGE_SIZE = 10
export const SHOP_DATA_MAX_PAGE_SIZE = 100
export const SHOP_DATA_PAGE_MIN = 1