feat(需求): ①全站列表/卡片分页统一为共享 OldPagination(共N条+10/20/50/100条数可选+跳页) ②创建用户菜单权限改左右布局(后台|桌面端并排) ③修复角色筛选失效(normalizeUserPageParams 白名单丢 role 字段)

This commit is contained in:
2026-09-07 00:02:30 +08:00
parent d3f5a371e3
commit cd6beef388
18 changed files with 323 additions and 245 deletions
@@ -17,10 +17,10 @@ const loading = ref(false)
const rows = ref<InvalidAsinItem[]>([])
const total = ref(0)
const page = ref(1)
const pageSize = 15
const pageSize = ref(15)
const groups = ref<ShopGroupOption[]>([])
const jumpPage = ref('')
const totalPages = computed(() => Math.max(1, Math.ceil(total.value / pageSize)))
const totalPages = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
const filter = reactive({ dataValue: '', brand: '', groupId: null as number | null })
@@ -58,7 +58,7 @@ async function load() {
try {
const result = await fetchInvalidAsinPage({
page: page.value,
pageSize,
pageSize: pageSize.value,
dataValue: filter.dataValue.trim() || undefined,
brand: filter.brand.trim() || undefined,
groupId: filter.groupId,
@@ -84,6 +84,13 @@ function changePage(next: number) {
load()
}
function changeSize(size: number) {
pageSize.value = size
page.value = 1
load()
}
function goJump() {
const n = Number.parseInt(jumpPage.value, 10)
if (Number.isNaN(n)) {
@@ -225,19 +232,7 @@ onMounted(() => {
</tbody>
</table>
</div>
<div class="pagination">
<span class="page-total">共 {{ total }} 条</span>
<button type="button" :disabled="page <= 1" @click="changePage(page - 1)">上一页</button>
<span class="page-cur">第 {{ page }} / {{ totalPages }} 页</span>
<button type="button" :disabled="page >= totalPages" @click="changePage(page + 1)">下一页</button>
<span class="page-jump">
跳至
<input v-model="jumpPage" type="text" inputmode="numeric" @keyup.enter="goJump" />
页
<button type="button" @click="goJump">跳转</button>
</span>
</div>
<OldPagination :total="total" :page="page" :page-size="pageSize" @change="changePage" @size-change="changeSize" />
</section>
<el-dialog v-model="dialogVisible" :title="editingId == null ? '新增不符合ASIN' : '编辑不符合ASIN'" width="520px">
@@ -23,17 +23,18 @@ import {
import { importOutcomeText, importTaskFinished, isAllowedImportFile } from './dedupe-import-model.ts'
import type { DedupeImportProgress } from './dedupe-import-model.ts'
import { toExportUrl } from './dedupe-total-export.ts'
import OldPagination from '@/components/OldPagination.vue'
const loading = ref(false)
const rows = ref<DedupeTotalItem[]>([])
const total = ref(0)
const page = ref(1)
const pageSize = 15
const pageSize = ref(15)
const filter = reactive(createDedupeTotalFilterState())
const groups = ref<DedupeGroupOption[]>([])
const jumpPage = ref('')
const totalPages = computed(() => Math.max(1, Math.ceil(total.value / pageSize)))
const totalPages = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
const editVisible = ref(false)
const editSaving = ref(false)
@@ -74,7 +75,7 @@ function stopExportWait(): void {
async function load(): Promise<void> {
loading.value = true
try {
const result = await fetchDedupeTotalList(toDedupeListParams(filter, page.value, pageSize))
const result = await fetchDedupeTotalList(toDedupeListParams(filter, page.value, pageSize.value))
rows.value = result.items
total.value = result.total
if (result.page >= 1) page.value = result.page
@@ -102,7 +103,13 @@ function goJump(): void {
ElMessage.warning('请输入页码')
return
}
changePage(n)
changePage(Math.min(Math.max(n, 1), totalPages.value))
}
function changeSize(size: number) {
pageSize.value = size
page.value = 1
void load()
}
function openEdit(row: DedupeTotalItem): void {
@@ -371,18 +378,7 @@ onMounted(() => {
</table>
</div>
<div class="pagination">
<span class="page-total">共 {{ total }} 条</span>
<button type="button" :disabled="page <= 1" @click="changePage(page - 1)">上一页</button>
<span class="page-cur">第 {{ page }} / {{ totalPages }} 页</span>
<button type="button" :disabled="page >= totalPages" @click="changePage(page + 1)">下一页</button>
<span class="page-jump">
跳至
<input v-model="jumpPage" type="text" inputmode="numeric" @keyup.enter="goJump" />
页
<button type="button" @click="goJump">跳转</button>
</span>
</div>
<OldPagination :total="total" :page="page" :page-size="pageSize" @change="changePage" @size-change="changeSize" />
</section>
<div v-if="editVisible" class="modal-mask" @click.self="editVisible = false">
@@ -15,6 +15,7 @@ import {
} from './product-category-model.ts'
import { categoryDraftError, createProductCategoryDraft, toCategorySaveRequest, type ProductCategoryDraft } from './product-category-editor-model.ts'
import { buildProductCategoryExportUrl } from './product-category-export.ts'
import OldPagination from '@/components/OldPagination.vue'
const loading = ref(false)
const tree = ref<ProductCategoryNode[]>([])
@@ -23,6 +24,7 @@ const selected = ref<ProductCategoryNode | null>(null)
const searchLoading = ref(false)
const searchRows = ref<ProductCategoryNode[]>([])
const searchPageSize = ref(PRODUCT_CATEGORY_DEFAULT_PAGE_SIZE)
const searchTotal = ref(0)
const searchPage = ref(1)
const searchHasMore = ref(false)
@@ -54,7 +56,7 @@ function flatten(nodes: ProductCategoryNode[]): ProductCategoryNode[] {
const allNodes = computed(() => flatten(tree.value))
const searching = computed(() => (keyword.value || '').trim().length > 0)
const dialogTitle = computed(() => (editingId.value == null ? '新增商品类目' : '编辑商品类目'))
const searchTotalPages = computed(() => Math.max(1, Math.ceil(searchTotal.value / PRODUCT_CATEGORY_DEFAULT_PAGE_SIZE)))
const searchTotalPages = computed(() => Math.max(1, Math.ceil(searchTotal.value / searchPageSize.value)))
/** 拉取根级第一页(对齐 admin.js loadProductCategoryChildren(null) 懒加载根)。 */
async function loadTree(): Promise<void> {
@@ -168,10 +170,15 @@ function moreLoading(more: ProductCategoryNode): boolean {
return isCategoryLoadMoreNode(more) && (childrenState.get(stateKeyOf(more.parentId))?.loading ?? false)
}
function changeSearchSize(size: number) {
searchPageSize.value = size
void runSearch(1)
}
async function runSearch(page: number): Promise<void> {
searchLoading.value = true
try {
const result = await searchProductCategories(keyword.value, page, PRODUCT_CATEGORY_DEFAULT_PAGE_SIZE)
const result = await searchProductCategories(keyword.value, page, searchPageSize.value)
searchRows.value = result.items
searchTotal.value = result.total
searchPage.value = result.page
@@ -412,12 +419,7 @@ onMounted(loadTree)
</table>
</div>
<div v-if="searching" class="pagination">
<span class="page-total">共 {{ searchTotal }} 条 · 搜索结果</span>
<button type="button" :disabled="searchPage <= 1" @click="runSearch(searchPage - 1)">上一页</button>
<span class="page-cur">第 {{ searchPage }} / {{ searchTotalPages }} 页</span>
<button type="button" :disabled="searchPage >= searchTotalPages" @click="runSearch(searchPage + 1)">下一页</button>
</div>
<OldPagination v-if="searching" :total="searchTotal" :page="searchPage" :page-size="searchPageSize" @change="runSearch" @size-change="changeSearchSize" />
</section>
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="560px">
@@ -19,14 +19,14 @@ const loading = ref(false)
const rows = ref<QueryAsinItem[]>([])
const total = ref(0)
const page = ref(1)
const pageSize = 15
const pageSize = ref(15)
const groups = ref<ShopGroupOption[]>([])
const filter = reactive<QueryAsinFilterState>(createQueryAsinFilterState())
const jumpPage = ref('')
const totalPages = computed(() => Math.max(1, Math.ceil(total.value / pageSize)))
const totalPages = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
/** 纵向展示行:分组/店铺/操作 按 rowspan 合并,逐国一行(对齐 admin.js renderQueryAsinRows)。 */
const displayRows = computed(() => queryAsinDisplayRows(rows.value, (page.value - 1) * pageSize + 1))
const displayRows = computed(() => queryAsinDisplayRows(rows.value, (page.value - 1) * pageSize.value + 1))
function asinOf(row: QueryAsinItem, country: string): string {
const map: Record<string, string> = { DE: row.asinDe, UK: row.asinUk, FR: row.asinFr, IT: row.asinIt, ES: row.asinEs }
@@ -268,7 +268,7 @@ async function load() {
try {
const result = await fetchQueryAsinList({
page: page.value,
pageSize,
pageSize: pageSize.value,
groupId: filter.groupId,
shopName: filter.shopName.trim() || undefined,
asin: filter.asin.trim() || undefined,
@@ -295,6 +295,13 @@ function changePage(next: number) {
void load()
}
function changeSize(size: number) {
pageSize.value = size
page.value = 1
load()
}
function goJump() {
const n = Number.parseInt(jumpPage.value, 10)
if (Number.isNaN(n)) {
@@ -391,19 +398,7 @@ onMounted(() => {
</tbody>
</table>
</div>
<div class="pagination">
<span class="page-total">共 {{ total }} 条</span>
<button type="button" :disabled="page <= 1" @click="changePage(page - 1)">上一页</button>
<span class="page-cur">第 {{ page }} / {{ totalPages }} 页</span>
<button type="button" :disabled="page >= totalPages" @click="changePage(page + 1)">下一页</button>
<span class="page-jump">
跳至
<input v-model="jumpPage" type="text" inputmode="numeric" @keyup.enter="goJump" />
页
<button type="button" @click="goJump">跳转</button>
</span>
</div>
<OldPagination :total="total" :page="page" :page-size="pageSize" @change="changePage" @size-change="changeSize" />
</section>
<el-dialog v-model="createVisible" title="新增查询 ASIN" width="560px" :close-on-click-modal="false">
@@ -19,11 +19,11 @@ const loading = ref(false)
const rows = ref<SkipPriceItem[]>([])
const total = ref(0)
const page = ref(1)
const pageSize = 15
const pageSize = ref(15)
const groups = ref<ShopGroupOption[]>([])
const filter = reactive<SkipPriceFilterState>(createSkipPriceFilterState())
const jumpPage = ref('')
const totalPages = computed(() => Math.max(1, Math.ceil(total.value / pageSize)))
const totalPages = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
const COUNTRIES = ['DE', 'UK', 'FR', 'IT', 'ES'] as const
const ASIN_MAP: Record<string, keyof SkipPriceItem> = { DE: 'asinDe', UK: 'asinUk', FR: 'asinFr', IT: 'asinIt', ES: 'asinEs' }
@@ -39,7 +39,7 @@ function priceOf(row: SkipPriceItem, code: string): number | null {
}
/** 纵向展示行:分组/店铺/操作 按 rowspan 合并,逐国一行(对齐 admin.js renderSkipPriceAsinRows)。 */
const displayRows = computed(() => skipPriceDisplayRows(rows.value, (page.value - 1) * pageSize + 1))
const displayRows = computed(() => skipPriceDisplayRows(rows.value, (page.value - 1) * pageSize.value + 1))
// ---- 新增 ASIN 弹窗(对齐 admin.js btnOpenCreateSkipPriceAsin/btnCreateSkipPriceAsin) ----
const createVisible = ref(false)
@@ -310,7 +310,7 @@ async function loadGroups() {
async function load() {
loading.value = true
try {
const result = await fetchSkipPriceList(toSkipPriceParams(filter, page.value, pageSize))
const result = await fetchSkipPriceList(toSkipPriceParams(filter, page.value, pageSize.value))
rows.value = result.items
total.value = result.total
page.value = result.page
@@ -332,6 +332,13 @@ function changePage(next: number) {
void load()
}
function changeSize(size: number) {
pageSize.value = size
page.value = 1
load()
}
function goJump() {
const n = Number.parseInt(jumpPage.value, 10)
if (Number.isNaN(n)) {
@@ -438,19 +445,7 @@ onMounted(() => {
</tbody>
</table>
</div>
<div class="pagination">
<span class="page-total">共 {{ total }} 条</span>
<button type="button" :disabled="page <= 1" @click="changePage(page - 1)">上一页</button>
<span class="page-cur">第 {{ page }} / {{ totalPages }} 页</span>
<button type="button" :disabled="page >= totalPages" @click="changePage(page + 1)">下一页</button>
<span class="page-jump">
跳至
<input v-model="jumpPage" type="text" inputmode="numeric" @keyup.enter="goJump" />
页
<button type="button" @click="goJump">跳转</button>
</span>
</div>
<OldPagination :total="total" :page="page" :page-size="pageSize" @change="changePage" @size-change="changeSize" />
</section>
<el-dialog v-model="createVisible" title="新增 ASIN" width="560px" :close-on-click-modal="false">