feat(admin): 为支持单删的管理列表补齐批量删除
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<script setup lang="ts">
|
||||
defineProps<{
|
||||
batch: {
|
||||
verb: string
|
||||
count: number
|
||||
disabled: boolean
|
||||
progress: string
|
||||
result: { failures: ReadonlyArray<{ id: number | string; label: string; reason: string }> } | null
|
||||
submit: () => Promise<void>
|
||||
clearSelection: () => void
|
||||
}
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="batch-delete-actions">
|
||||
<button class="btn btn-danger" type="button" :disabled="batch.disabled || !batch.count" @click="batch.submit">
|
||||
{{ batch.progress ? `正在${batch.verb} ${batch.progress}` : `批量${batch.verb}(${batch.count})` }}
|
||||
</button>
|
||||
<button v-if="batch.count" class="btn btn-sm" type="button" :disabled="batch.disabled" @click="batch.clearSelection">清除勾选</button>
|
||||
<details v-if="batch.result?.failures.length" class="batch-delete-failures">
|
||||
<summary>查看失败原因({{ batch.result.failures.length }} 条)</summary>
|
||||
<ul>
|
||||
<li v-for="failure in batch.result.failures" :key="failure.id">{{ failure.label }}:{{ failure.reason }}</li>
|
||||
</ul>
|
||||
</details>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.batch-delete-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
||||
.batch-delete-actions .btn-danger { color: #fff; background: #b35f6a; border-color: #b35f6a; }
|
||||
.batch-delete-actions button:disabled { cursor: not-allowed; opacity: 0.55; }
|
||||
.batch-delete-failures { max-width: 520px; color: #9f3845; overflow-wrap: anywhere; }
|
||||
.batch-delete-failures ul { max-height: 180px; overflow: auto; margin: 4px 0; padding-left: 20px; }
|
||||
</style>
|
||||
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
defineProps<{
|
||||
label: string
|
||||
checked: boolean
|
||||
disabled: boolean
|
||||
partial?: boolean
|
||||
}>()
|
||||
|
||||
defineEmits<{ change: [] }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<input class="batch-delete-checkbox" type="checkbox" :aria-label="label" :title="label"
|
||||
:checked="checked" :disabled="disabled" :indeterminate="partial ?? false" @change.stop="$emit('change')" @click.stop />
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.batch-delete-checkbox { width: 15px; height: 15px; vertical-align: middle; cursor: pointer; accent-color: #b33a2e; }
|
||||
.batch-delete-checkbox:disabled { cursor: not-allowed; }
|
||||
</style>
|
||||
@@ -1,4 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
import { createLatestRequestGate } from '@/utils/latest-request'
|
||||
import { formatDateTime } from '@/utils/datetime'
|
||||
/** 分组管理页 · 像素复刻旧版 admin.html panel-group-manage(自绘:顶部数据权限分组摘要 chips + 分组列表表格 + 新建分组;全量无分页同旧版)。
|
||||
* script 逻辑沿用现有 Vue 实现;编辑器保留现有组件。 */
|
||||
@@ -51,16 +55,22 @@ function canEditOf(group: ShopGroupItem): boolean {
|
||||
return currentUserId.value != null && group.leaderUserId != null && currentUserId.value === group.leaderUserId
|
||||
}
|
||||
|
||||
const batchListGate = createLatestRequestGate()
|
||||
|
||||
async function loadGroups() {
|
||||
const token = batchListGate.begin()
|
||||
loading.value = true
|
||||
loadFailure.value = ''
|
||||
try {
|
||||
rows.value = await fetchShopGroups(companyTab.requestCompanyId, platformTab.active)
|
||||
const items = await fetchShopGroups(companyTab.requestCompanyId, platformTab.active)
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
rows.value = items
|
||||
} catch (error) {
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
loadFailure.value = error instanceof Error ? error.message : '数据权限分组加载失败'
|
||||
showAdminFeedback(loadFailure.value, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (batchListGate.isCurrent(token)) loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,11 +94,24 @@ function openEdit(group: ShopGroupItem) {
|
||||
editorVisible.value = true
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => pagedGroups.value,
|
||||
rowId: (row) => row.id,
|
||||
rowLabel: (row) => row.name,
|
||||
deleteOne: (id) => deleteShopGroup(id),
|
||||
refresh: loadGroups,
|
||||
blocked: () => loading.value || !!loadFailure.value,
|
||||
scope: () => [companyTab.activeId, platformTab.active, currentUserId.value],
|
||||
precheck: (row) => canEditOf(row) ? undefined : '无权删除此分组',
|
||||
})
|
||||
|
||||
async function removeGroup(group: ShopGroupItem) {
|
||||
if (batch.busy) return
|
||||
const ok = await openAdminConfirm({ message: `确定删除分组“${group.name}”吗?`, danger: true })
|
||||
if (!ok) return
|
||||
try {
|
||||
await deleteShopGroup(group.id)
|
||||
batch.removeFromSelection(group.id)
|
||||
ElMessage.success('删除成功')
|
||||
await loadGroups()
|
||||
} catch (error) {
|
||||
@@ -119,10 +142,15 @@ onMounted(loadGroups)
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="loadGroups" />
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th style="width: 58px">序号</th>
|
||||
<th style="width: 16%">分组名称</th>
|
||||
<th style="width: 12%">组长</th>
|
||||
@@ -135,7 +163,11 @@ onMounted(loadGroups)
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-if="filteredRows.length">
|
||||
<tr v-for="(group, index) in pagedGroups" :key="group.id">
|
||||
<tr v-for="(group, index) in pagedGroups" :key="group.id" :class="{ 'batch-selected': batch.isSelected(group) }">
|
||||
<td class="batch-delete-cell">
|
||||
<BatchDeleteCheckbox :label="batch.reason(group) || `选择 ${batch.label(group)}`" :checked="batch.isSelected(group)"
|
||||
:disabled="batch.disabled || !!batch.reason(group)" @change="batch.toggle(group)" />
|
||||
</td>
|
||||
<td>{{ index + 1 }}</td>
|
||||
<td>{{ group.name }}</td>
|
||||
<td>{{ group.leaderUsername || '-' }}</td>
|
||||
@@ -151,17 +183,17 @@ onMounted(loadGroups)
|
||||
<td class="ops-cell">
|
||||
<template v-if="canEditOf(group)">
|
||||
<button class="btn btn-sm" type="button" @click="openEdit(group)">编辑</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" @click="removeGroup(group)">删除</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" :disabled="batch.busy" @click="removeGroup(group)">删除</button>
|
||||
</template>
|
||||
<span v-else class="member-none">-</span>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td colspan="8" class="empty-tip">加载中...</td>
|
||||
<td colspan="9" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td colspan="8" class="empty-tip">{{ filterKeyword || filterLeader ? '暂无匹配分组' : '暂无分组' }}</td>
|
||||
<td colspan="9" class="empty-tip">{{ filterKeyword || filterLeader ? '暂无匹配分组' : '暂无分组' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
import { createLatestRequestGate } from '@/utils/latest-request'
|
||||
import { formatDateTime } from '@/utils/datetime'
|
||||
/** 菜单权限配置页 · 像素复刻旧版 admin.html panel-columns(自绘:面板头+新增菜单、拖拽手柄 ⠿、树形缩进+└、旧式表格、全量无分页同旧版)。
|
||||
* script 逻辑沿用现有 Vue 实现(拖拽分组/落点/重排保存、弹窗表单)。 */
|
||||
@@ -100,16 +104,22 @@ function parentNameOf(node: MenuManageNode): string {
|
||||
return nameById.value.get(node.parentId) ?? `#${node.parentId}`
|
||||
}
|
||||
|
||||
const batchListGate = createLatestRequestGate()
|
||||
|
||||
async function loadMenus() {
|
||||
const token = batchListGate.begin()
|
||||
loading.value = true
|
||||
loadFailure.value = ''
|
||||
try {
|
||||
rows.value = await loadMenuManageTree(companyTab.requestCompanyId)
|
||||
const items = await loadMenuManageTree(companyTab.requestCompanyId)
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
rows.value = items
|
||||
} catch (error) {
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
loadFailure.value = error instanceof Error ? error.message : '菜单列表加载失败'
|
||||
showAdminFeedback(loadFailure.value, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (batchListGate.isCurrent(token)) loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +218,19 @@ async function saveMenu() {
|
||||
}
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => pagedMenuRows.value,
|
||||
rowId: (row) => row.id,
|
||||
rowLabel: (row) => row.name,
|
||||
deleteOne: (id) => deleteMenu(id),
|
||||
refresh: loadMenus,
|
||||
blocked: () => loading.value || !!loadFailure.value || saving.value,
|
||||
scope: () => [companyTab.activeId, platformTab.active],
|
||||
precheck: (row) => menuDeleteReason(row),
|
||||
})
|
||||
|
||||
async function removeMenu(node: MenuManageNode) {
|
||||
if (batch.busy) return
|
||||
const reason = menuDeleteReason(node)
|
||||
if (reason) {
|
||||
ElMessage.warning(reason)
|
||||
@@ -218,6 +240,7 @@ async function removeMenu(node: MenuManageNode) {
|
||||
if (!(await openAdminConfirm({ message: `确定删除菜单“${node.name}”吗?`, danger: true }))) return
|
||||
try {
|
||||
await deleteMenu(node.id)
|
||||
batch.removeFromSelection(node.id)
|
||||
ElMessage.success('删除成功')
|
||||
await loadMenus()
|
||||
} catch (error) {
|
||||
@@ -263,10 +286,15 @@ onMounted(loadMenus)
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="loadMenus" />
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="table-scroll columns-table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th class="column-drag-cell"><span class="visually-hidden">排序</span></th>
|
||||
<th style="width: 60px">ID</th>
|
||||
<th style="width: 200px">菜单名称</th>
|
||||
@@ -282,10 +310,14 @@ onMounted(loadMenus)
|
||||
<tr
|
||||
v-for="row in pagedMenuRows"
|
||||
:key="row.id"
|
||||
:class="{ 'is-column-dragging': dragState?.id === row.id }"
|
||||
:class="{ 'batch-selected': batch.isSelected(row), 'is-column-dragging': dragState?.id === row.id }"
|
||||
@dragover="onDragOver($event, row)"
|
||||
@drop="onDrop($event, row)"
|
||||
>
|
||||
<td class="batch-delete-cell">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row) || `选择 ${batch.label(row)}`" :checked="batch.isSelected(row)"
|
||||
:disabled="batch.disabled || !!batch.reason(row)" @change="batch.toggle(row)" />
|
||||
</td>
|
||||
<td class="column-drag-cell">
|
||||
<span
|
||||
class="column-drag-handle"
|
||||
@@ -310,7 +342,7 @@ onMounted(loadMenus)
|
||||
<button
|
||||
class="btn btn-sm btn-danger"
|
||||
type="button"
|
||||
:disabled="menuDeleteReason(row) !== undefined"
|
||||
:disabled="batch.busy || menuDeleteReason(row) !== undefined"
|
||||
:title="menuDeleteReason(row) || undefined"
|
||||
@click="removeMenu(row)"
|
||||
>
|
||||
@@ -320,10 +352,10 @@ onMounted(loadMenus)
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td colspan="8" class="empty-tip">加载中...</td>
|
||||
<td colspan="9" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td colspan="8" class="empty-tip">{{ filterName || filterType ? '暂无匹配菜单' : '暂无菜单,请先在上方新增' }}</td>
|
||||
<td colspan="9" class="empty-tip">{{ filterName || filterType ? '暂无匹配菜单' : '暂无菜单,请先在上方新增' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -0,0 +1,274 @@
|
||||
/* 像素复刻旧版 admin.html 面板风格(与店铺密钥页同一视觉语言)。 */
|
||||
.user-secrets-view {
|
||||
font-family: inherit;
|
||||
color: #24384d;
|
||||
}
|
||||
.panel-box {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 20px 22px 24px;
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: #24384d;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.secrets-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.secrets-filter-row {
|
||||
margin: 0 0 16px;
|
||||
}
|
||||
.form-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
gap: 14px 18px;
|
||||
}
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-group label {
|
||||
color: #5b6f83;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.form-group input {
|
||||
min-width: 0;
|
||||
min-height: 42px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13.5px;
|
||||
font-family: inherit;
|
||||
color-scheme: light;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.form-group input:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.form-group input:focus {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
.filter-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||||
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
|
||||
}
|
||||
.btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||||
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
|
||||
}
|
||||
.btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.55;
|
||||
}
|
||||
.btn-danger {
|
||||
background: linear-gradient(135deg, #c06d77, #b35f6a);
|
||||
border-color: #b35f6a;
|
||||
}
|
||||
.btn-danger:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #cb7c84, #b96570);
|
||||
}
|
||||
.btn-ghost {
|
||||
background: #ffffff;
|
||||
border-color: #c7d7e5;
|
||||
color: #4f78a5;
|
||||
box-shadow: none;
|
||||
}
|
||||
.btn-ghost:hover:not(:disabled) {
|
||||
background: #edf5fb;
|
||||
border-color: #95b1cb;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.btn-sm {
|
||||
min-height: 36px;
|
||||
padding: 7px 12px;
|
||||
}
|
||||
.secrets-table-scroll {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
overflow-x: auto;
|
||||
border: 1px solid #dbe5ee;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
.secrets-table-scroll table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
min-width: 1440px;
|
||||
}
|
||||
.secrets-table-scroll th,
|
||||
.secrets-table-scroll td {
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.5;
|
||||
border-bottom: 1px solid #e0e8ef;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.secrets-table-scroll th {
|
||||
background: #edf4fa;
|
||||
color: #4e6479;
|
||||
border-bottom-color: #d5e1eb;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
.secrets-table-scroll tbody tr:hover td {
|
||||
background: #f1f7fb;
|
||||
}
|
||||
.secrets-table-scroll tbody tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.user-name {
|
||||
color: #24384d;
|
||||
font-weight: 600;
|
||||
/* 用户名(含中文)可完整换行展示,不截断 */
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.creator-name {
|
||||
color: #5b6f83;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
.module-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
/* 代理列:脱敏地址独占一行,状态药丸另起一行(列宽按最长药丸文案留的,不按整条链接) */
|
||||
.module-cell--stack {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
}
|
||||
.module-cell .mono-mask {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
/* 代理列只显示后端脱敏后的 scheme://host(短串,单行足够)。
|
||||
这里**不许**再出现"允许折行展示完整明文 + user-select:all"那套样式:
|
||||
它等于给整条带 key/pwd 的链接做了一键全选复制的旁路(2026-11-02 脱敏收口时一并拆掉)。 */
|
||||
.mono-mask {
|
||||
font-family: Consolas, "Cascadia Mono", monospace;
|
||||
font-size: 12.5px;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
.empty-value {
|
||||
color: #a7b4c1;
|
||||
}
|
||||
/* 余额列:数字按等宽数位对齐(两行叠着看差值才不用竖着对),超长进 title。 */
|
||||
.balance-line {
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-size: 12.5px;
|
||||
color: #2f4256;
|
||||
}
|
||||
.ops-cell {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.empty-tip {
|
||||
color: #8293a5;
|
||||
text-align: center;
|
||||
}
|
||||
.wh-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 10px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid;
|
||||
font-size: 12px;
|
||||
line-height: 1.7;
|
||||
cursor: help;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.wh-pill.is-source {
|
||||
background: #eef2fb;
|
||||
border-color: #ccd8f2;
|
||||
color: #3d5a99;
|
||||
font-weight: 600;
|
||||
}
|
||||
.wh-pill.is-allowed {
|
||||
background: #e8f6ee;
|
||||
border-color: #b9e0c9;
|
||||
color: #2f7d52;
|
||||
}
|
||||
.wh-pill.is-blocked {
|
||||
background: #fdecef;
|
||||
border-color: #f2c4cd;
|
||||
color: #b04a5a;
|
||||
}
|
||||
.wh-pill.is-warn {
|
||||
background: #fdf6e3;
|
||||
border-color: #f0dfae;
|
||||
color: #8f6d1e;
|
||||
}
|
||||
/* 「等一会再点」这一族(无可用通道/限流/超时/网络/上游):既不红(密钥没坏)
|
||||
也不黄(不是欠费)更不是灰(不是查不出),独立一档青色——三种处置一眼分开。 */
|
||||
.wh-pill.is-retry {
|
||||
background: #e6f2f7;
|
||||
border-color: #b6d8e6;
|
||||
color: #2b6b86;
|
||||
}
|
||||
.wh-pill.is-unknown {
|
||||
background: #f0f3f6;
|
||||
border-color: #d6dee6;
|
||||
color: #6b7d8f;
|
||||
}
|
||||
.wh-pill.is-locked {
|
||||
background: #f0ecfb;
|
||||
border-color: #d5caf0;
|
||||
color: #5b4a96;
|
||||
}
|
||||
.module-cell-pills {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
import { createLatestRequestGate } from '@/utils/latest-request'
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { formatDateTime } from '@/utils/datetime'
|
||||
@@ -128,7 +132,10 @@ function rowStatusTooltip(row: AdminUserSecretRow) {
|
||||
return parts.join(';') || '暂无检测记录'
|
||||
}
|
||||
|
||||
const batchListGate = createLatestRequestGate()
|
||||
|
||||
async function load() {
|
||||
const token = batchListGate.begin()
|
||||
loading.value = true
|
||||
loadFailure.value = ''
|
||||
try {
|
||||
@@ -140,15 +147,17 @@ async function load() {
|
||||
page: page.value,
|
||||
pageSize: pageSize.value,
|
||||
})
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
rows.value = result?.items || []
|
||||
total.value = Number(result?.total || 0)
|
||||
groupOptions.value = result?.groupOptions || []
|
||||
void loadBalances()
|
||||
} catch (error) {
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
loadFailure.value = error instanceof Error ? error.message : '加载失败'
|
||||
showAdminFeedback(loadFailure.value, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (batchListGate.isCurrent(token)) loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,11 +256,25 @@ async function check(row: AdminUserSecretRow) {
|
||||
}
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => rows.value,
|
||||
rowId: (row) => row.userId,
|
||||
rowLabel: (row) => row.username || `UID ${row.userId}`,
|
||||
deleteOne: (id) => deleteUserSecret(id),
|
||||
refresh: load,
|
||||
blocked: () => loading.value || !!loadFailure.value,
|
||||
scope: () => companyTab.activeId,
|
||||
consequence: '将清空这些用户的全部密钥与代理配置;后台锁定的代理也会一并清除并解锁,用户需要重新配置。',
|
||||
verb: '清空',
|
||||
})
|
||||
|
||||
async function remove(row: AdminUserSecretRow) {
|
||||
if (batch.busy) return
|
||||
const who = row.username || `UID ${row.userId}`
|
||||
if (!(await openAdminConfirm({ message: `确定清空「${who}」的全部密钥与代理配置吗?后台锁定的代理会一并清除并解锁,该用户需要重新配置。`, danger: true }))) return
|
||||
try {
|
||||
await deleteUserSecret(row.userId)
|
||||
batch.removeFromSelection(row.userId)
|
||||
ElMessage.success('已清空')
|
||||
load()
|
||||
} catch (error) {
|
||||
@@ -361,10 +384,15 @@ onMounted(load)
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="load" />
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="secrets-table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th style="width: 58px">序号</th>
|
||||
<th style="width: 260px">用户</th>
|
||||
<th v-if="isSuperAdmin" style="width: 130px">分组</th>
|
||||
@@ -381,7 +409,11 @@ onMounted(load)
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-if="rows.length">
|
||||
<tr v-for="(row, index) in rows" :key="row.userId">
|
||||
<tr v-for="(row, index) in rows" :key="row.userId" :class="{ 'batch-selected': batch.isSelected(row) }">
|
||||
<td class="batch-delete-cell">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row) || `选择 ${batch.label(row)}`" :checked="batch.isSelected(row)"
|
||||
:disabled="batch.disabled || !!batch.reason(row)" @change="batch.toggle(row)" />
|
||||
</td>
|
||||
<td>{{ (page - 1) * pageSize + index + 1 }}</td>
|
||||
<td>
|
||||
<span class="user-name">{{ row.username || '—' }}</span>
|
||||
@@ -483,15 +515,15 @@ onMounted(load)
|
||||
>
|
||||
解锁
|
||||
</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" @click="remove(row)">清空</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" :disabled="batch.busy" @click="remove(row)">清空</button>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td :colspan="isSuperAdmin ? 12 : 11" class="empty-tip">加载中...</td>
|
||||
<td :colspan="isSuperAdmin ? 13 : 12" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td :colspan="isSuperAdmin ? 12 : 11" class="empty-tip">{{ keyword || statusFilter || groupFilter ? '暂无匹配记录' : '暂无用户密钥记录' }}</td>
|
||||
<td :colspan="isSuperAdmin ? 13 : 12" class="empty-tip">{{ keyword || statusFilter || groupFilter ? '暂无匹配记录' : '暂无用户密钥记录' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -511,279 +543,4 @@ onMounted(load)
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 像素复刻旧版 admin.html 面板风格(与店铺密钥页同一视觉语言)。 */
|
||||
.user-secrets-view {
|
||||
font-family: inherit;
|
||||
color: #24384d;
|
||||
}
|
||||
.panel-box {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 20px 22px 24px;
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: #24384d;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.secrets-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.secrets-filter-row {
|
||||
margin: 0 0 16px;
|
||||
}
|
||||
.form-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
gap: 14px 18px;
|
||||
}
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-group label {
|
||||
color: #5b6f83;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.form-group input {
|
||||
min-width: 0;
|
||||
min-height: 42px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13.5px;
|
||||
font-family: inherit;
|
||||
color-scheme: light;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.form-group input:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.form-group input:focus {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
.filter-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||||
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
|
||||
}
|
||||
.btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||||
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
|
||||
}
|
||||
.btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.55;
|
||||
}
|
||||
.btn-danger {
|
||||
background: linear-gradient(135deg, #c06d77, #b35f6a);
|
||||
border-color: #b35f6a;
|
||||
}
|
||||
.btn-danger:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #cb7c84, #b96570);
|
||||
}
|
||||
.btn-ghost {
|
||||
background: #ffffff;
|
||||
border-color: #c7d7e5;
|
||||
color: #4f78a5;
|
||||
box-shadow: none;
|
||||
}
|
||||
.btn-ghost:hover:not(:disabled) {
|
||||
background: #edf5fb;
|
||||
border-color: #95b1cb;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.btn-sm {
|
||||
min-height: 36px;
|
||||
padding: 7px 12px;
|
||||
}
|
||||
.secrets-table-scroll {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
overflow-x: auto;
|
||||
border: 1px solid #dbe5ee;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
.secrets-table-scroll table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
min-width: 1440px;
|
||||
}
|
||||
.secrets-table-scroll th,
|
||||
.secrets-table-scroll td {
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.5;
|
||||
border-bottom: 1px solid #e0e8ef;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.secrets-table-scroll th {
|
||||
background: #edf4fa;
|
||||
color: #4e6479;
|
||||
border-bottom-color: #d5e1eb;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
.secrets-table-scroll tbody tr:hover td {
|
||||
background: #f1f7fb;
|
||||
}
|
||||
.secrets-table-scroll tbody tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.user-name {
|
||||
color: #24384d;
|
||||
font-weight: 600;
|
||||
/* 用户名(含中文)可完整换行展示,不截断 */
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.creator-name {
|
||||
color: #5b6f83;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
.module-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
/* 代理列:脱敏地址独占一行,状态药丸另起一行(列宽按最长药丸文案留的,不按整条链接) */
|
||||
.module-cell--stack {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
}
|
||||
.module-cell .mono-mask {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
/* 代理列只显示后端脱敏后的 scheme://host(短串,单行足够)。
|
||||
这里**不许**再出现"允许折行展示完整明文 + user-select:all"那套样式:
|
||||
它等于给整条带 key/pwd 的链接做了一键全选复制的旁路(2026-11-02 脱敏收口时一并拆掉)。 */
|
||||
.mono-mask {
|
||||
font-family: Consolas, "Cascadia Mono", monospace;
|
||||
font-size: 12.5px;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
.empty-value {
|
||||
color: #a7b4c1;
|
||||
}
|
||||
/* 余额列:数字按等宽数位对齐(两行叠着看差值才不用竖着对),超长进 title。 */
|
||||
.balance-line {
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-size: 12.5px;
|
||||
color: #2f4256;
|
||||
}
|
||||
.ops-cell {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.empty-tip {
|
||||
color: #8293a5;
|
||||
text-align: center;
|
||||
}
|
||||
.wh-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 10px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid;
|
||||
font-size: 12px;
|
||||
line-height: 1.7;
|
||||
cursor: help;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.wh-pill.is-source {
|
||||
background: #eef2fb;
|
||||
border-color: #ccd8f2;
|
||||
color: #3d5a99;
|
||||
font-weight: 600;
|
||||
}
|
||||
.wh-pill.is-allowed {
|
||||
background: #e8f6ee;
|
||||
border-color: #b9e0c9;
|
||||
color: #2f7d52;
|
||||
}
|
||||
.wh-pill.is-blocked {
|
||||
background: #fdecef;
|
||||
border-color: #f2c4cd;
|
||||
color: #b04a5a;
|
||||
}
|
||||
.wh-pill.is-warn {
|
||||
background: #fdf6e3;
|
||||
border-color: #f0dfae;
|
||||
color: #8f6d1e;
|
||||
}
|
||||
/* 「等一会再点」这一族(无可用通道/限流/超时/网络/上游):既不红(密钥没坏)
|
||||
也不黄(不是欠费)更不是灰(不是查不出),独立一档青色——三种处置一眼分开。 */
|
||||
.wh-pill.is-retry {
|
||||
background: #e6f2f7;
|
||||
border-color: #b6d8e6;
|
||||
color: #2b6b86;
|
||||
}
|
||||
.wh-pill.is-unknown {
|
||||
background: #f0f3f6;
|
||||
border-color: #d6dee6;
|
||||
color: #6b7d8f;
|
||||
}
|
||||
.wh-pill.is-locked {
|
||||
background: #f0ecfb;
|
||||
border-color: #d5caf0;
|
||||
color: #5b4a96;
|
||||
}
|
||||
.module-cell-pills {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
</style>
|
||||
<style scoped src="./UserSecretsPage.css"></style>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
import { formatDateTime } from '@/utils/datetime'
|
||||
/** 用户管理页 · 像素复刻旧版 admin.html panel-users(自绘:panel-box + 页头按钮 + 筛选 form-row + 旧式表格/分页 + 原生 confirm 删除)。
|
||||
* script 逻辑沿用现有 Vue 实现;创建/编辑弹窗保留现有组件(含用户菜单权限树)。 */
|
||||
@@ -122,7 +125,19 @@ function search() {
|
||||
void loadUsers()
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => rows.value,
|
||||
rowId: (row) => row.id,
|
||||
rowLabel: (row) => row.username,
|
||||
deleteOne: (id) => deleteUser(id),
|
||||
refresh: loadUsers,
|
||||
blocked: () => loading.value || !!loadError.value,
|
||||
scope: () => [companyTab.activeId, platformTab.active, currentUserId.value],
|
||||
precheck: (row) => deleteBlockReason(row, currentUserId.value),
|
||||
})
|
||||
|
||||
async function removeUser(row: AdminUser) {
|
||||
if (batch.busy) return
|
||||
const reason = deleteBlockReason(row, currentUserId.value)
|
||||
if (reason) {
|
||||
ElMessage.warning(reason)
|
||||
@@ -132,6 +147,7 @@ async function removeUser(row: AdminUser) {
|
||||
if (!(await openAdminConfirm({ message: deleteConfirmMessage(row), danger: true }))) return
|
||||
try {
|
||||
await deleteUser(row.id)
|
||||
batch.removeFromSelection(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
await loadUsers()
|
||||
} catch (error) {
|
||||
@@ -248,10 +264,15 @@ onMounted(() => {
|
||||
<button class="btn btn-sm btn-secondary" type="button" @click="retry">重试</button>
|
||||
</div>
|
||||
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="table-scroll user-table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th style="width: 70px">ID</th>
|
||||
<th style="width: 180px">用户名</th>
|
||||
<th style="width: 140px">角色</th>
|
||||
@@ -266,7 +287,11 @@ onMounted(() => {
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-if="rows.length">
|
||||
<tr v-for="row in rows" :key="row.id">
|
||||
<tr v-for="row in rows" :key="row.id" :class="{ 'batch-selected': batch.isSelected(row) }">
|
||||
<td class="batch-delete-cell">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row) || `选择 ${batch.label(row)}`" :checked="batch.isSelected(row)"
|
||||
:disabled="batch.disabled || !!batch.reason(row)" @change="batch.toggle(row)" />
|
||||
</td>
|
||||
<td>{{ row.id }}</td>
|
||||
<td>{{ row.username }}</td>
|
||||
<td>{{ roleLabel(row.role) }}</td>
|
||||
@@ -302,7 +327,7 @@ onMounted(() => {
|
||||
<button
|
||||
class="btn btn-sm btn-danger"
|
||||
type="button"
|
||||
:disabled="deleteBlockReason(row, currentUserId) !== undefined"
|
||||
:disabled="batch.busy || deleteBlockReason(row, currentUserId) !== undefined"
|
||||
:title="deleteBlockReason(row, currentUserId) || undefined"
|
||||
@click="removeUser(row)"
|
||||
>
|
||||
@@ -312,10 +337,10 @@ onMounted(() => {
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td :colspan="isJdSide ? 10 : 9" class="empty-tip">加载中...</td>
|
||||
<td :colspan="isJdSide ? 11 : 10" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td :colspan="isJdSide ? 10 : 9" class="empty-tip">{{ userListEmptyHint() }}</td>
|
||||
<td :colspan="isJdSide ? 11 : 10" class="empty-tip">{{ userListEmptyHint() }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
import { formatDateTime } from '@/utils/datetime'
|
||||
/** 品牌数据库(不符合ASIN)页 · 像素复刻旧版 admin.html panel-invalid-asin-data(自绘:面板头+新增、筛选、旧式表格/分页、原生 confirm 删除)。
|
||||
* 全平台一份黑名单:分组是行上的归类标签,对任何角色都不构成可见性边界(2026-10-07 定档)。
|
||||
@@ -130,11 +133,22 @@ async function submit() {
|
||||
}
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => rows.value,
|
||||
rowId: (row) => row.id,
|
||||
rowLabel: (row) => row.dataValue,
|
||||
deleteOne: (id) => deleteInvalidAsin(id),
|
||||
refresh: load,
|
||||
blocked: () => loading.value || !!loadFailure.value,
|
||||
})
|
||||
|
||||
async function remove(row: InvalidAsinItem) {
|
||||
if (batch.busy) return
|
||||
// 对齐旧版:原生 confirm。
|
||||
if (!(await openAdminConfirm({ message: invalidAsinDeleteText(row), danger: true }))) return
|
||||
try {
|
||||
await deleteInvalidAsin(row.id)
|
||||
batch.removeFromSelection(row.id)
|
||||
ElMessage.success('已删除')
|
||||
load()
|
||||
} catch (error) {
|
||||
@@ -175,10 +189,15 @@ onMounted(() => {
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="load" />
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="table-scroll invalid-asin-table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th style="width: 70px">ID</th>
|
||||
<th style="width: 170px">ASIN</th>
|
||||
<th style="width: 150px">品牌</th>
|
||||
@@ -191,7 +210,11 @@ onMounted(() => {
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-if="rows.length">
|
||||
<tr v-for="row in rows" :key="row.id">
|
||||
<tr v-for="row in rows" :key="row.id" :class="{ 'batch-selected': batch.isSelected(row) }">
|
||||
<td class="batch-delete-cell">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row) || `选择 ${batch.label(row)}`" :checked="batch.isSelected(row)"
|
||||
:disabled="batch.disabled || !!batch.reason(row)" @change="batch.toggle(row)" />
|
||||
</td>
|
||||
<td>{{ row.id }}</td>
|
||||
<td class="mono-cell">{{ row.dataValue }}</td>
|
||||
<td>{{ row.brand || '—' }}</td>
|
||||
@@ -205,15 +228,15 @@ onMounted(() => {
|
||||
<td>{{ formatDateTime(row.updatedAt) }}</td>
|
||||
<td class="ops-cell">
|
||||
<button class="btn btn-sm" type="button" @click="openEdit(row)">编辑</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" @click="remove(row)">删除</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" :disabled="batch.busy" @click="remove(row)">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td colspan="8" class="empty-tip">加载中...</td>
|
||||
<td colspan="9" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td colspan="8" class="empty-tip">暂无数据</td>
|
||||
<td colspan="9" class="empty-tip">暂无数据</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -0,0 +1,348 @@
|
||||
/* 像素复刻旧版 admin.html panel-dedupe-total-data(蓝白末层样式)。 */
|
||||
.dedupe-view {
|
||||
font-family: inherit;
|
||||
color: var(--c-text, #24384d);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
}
|
||||
.form-box,
|
||||
.panel-box {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 20px 22px 24px;
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
}
|
||||
h3 {
|
||||
margin: 0 0 16px;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: #24384d;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.dedupe-panel-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.dedupe-panel-head h3 {
|
||||
margin: 0;
|
||||
}
|
||||
.dedupe-head-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
.dedupe-filter-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
|
||||
gap: 12px;
|
||||
align-items: end;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.dedupe-filter-row .form-group {
|
||||
min-width: 0;
|
||||
}
|
||||
.dedupe-filter-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.dedupe-filter-date-row {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: flex-end;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.dedupe-filter-date-row .form-group {
|
||||
flex: 0 0 200px;
|
||||
min-width: 0;
|
||||
}
|
||||
.dedupe-filter-date-row .dedupe-filter-actions {
|
||||
margin-left: auto;
|
||||
}
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-group label {
|
||||
color: #5b6f83;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
/* 下拉壳由全局 .el-select.admin-filter(main.css:42px/9px 圆角/#f8fbfd 浅底/focus ring)出,
|
||||
与亚马逊面同一套;这里只留 input 的原生壳规则(2026-11-17 原生 select 全换 el-select)。 */
|
||||
.form-group input {
|
||||
min-width: 0;
|
||||
min-height: 42px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13.5px;
|
||||
font-family: inherit;
|
||||
color-scheme: light;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.form-group input:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.form-group input:focus {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
.form-group input[type="file"] {
|
||||
background: #ffffff;
|
||||
padding: 6px 10px;
|
||||
}
|
||||
.form-group input[type="date"] {
|
||||
color-scheme: light;
|
||||
}
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||||
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
|
||||
}
|
||||
.btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||||
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
|
||||
}
|
||||
.btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
border-color: #c7d7e5;
|
||||
}
|
||||
.btn-secondary:hover:not(:disabled) {
|
||||
color: #2f5d8b;
|
||||
border-color: #95b1cb;
|
||||
background: #edf5fb;
|
||||
}
|
||||
.btn-danger {
|
||||
background: linear-gradient(135deg, #c06d77, #b35f6a);
|
||||
border-color: #b35f6a;
|
||||
}
|
||||
.btn-danger:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #cb7c84, #b96570);
|
||||
}
|
||||
.btn-sm {
|
||||
min-height: 36px;
|
||||
padding: 7px 12px;
|
||||
}
|
||||
.table-scroll {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
overflow-x: auto;
|
||||
border: 1px solid #dbe5ee;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
.table-scroll table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.dedupe-table-scroll > table {
|
||||
min-width: 900px;
|
||||
}
|
||||
.table-scroll th,
|
||||
.table-scroll td {
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.5;
|
||||
border-bottom: 1px solid #e0e8ef;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.table-scroll th {
|
||||
background: #edf4fa;
|
||||
color: #4e6479;
|
||||
border-bottom-color: #d5e1eb;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
.table-scroll tbody tr:hover td {
|
||||
background: #f1f7fb;
|
||||
}
|
||||
.table-scroll tbody tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.mono-cell {
|
||||
font-family: "Cascadia Mono", "SF Mono", Consolas, "Courier New", monospace;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
.ops-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
white-space: nowrap;
|
||||
text-align: right;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
padding: 44px 24px;
|
||||
text-align: center;
|
||||
color: #8293a5;
|
||||
font-size: 13.5px;
|
||||
}
|
||||
.pagination {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 18px;
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
}
|
||||
.pagination button {
|
||||
min-height: 30px;
|
||||
padding: 4px 12px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pagination button:hover:not(:disabled) {
|
||||
background: #edf5fb;
|
||||
border-color: #95b1cb;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.pagination button:disabled {
|
||||
background: #eef3f7;
|
||||
color: #9baaba;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.page-total {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.page-jump {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.page-jump input {
|
||||
width: 56px;
|
||||
min-height: 30px;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 8px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.modal-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 3000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40px 20px;
|
||||
background: rgba(45, 66, 86, 0.36);
|
||||
backdrop-filter: blur(6px);
|
||||
}
|
||||
.modal {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: min(560px, 100%);
|
||||
max-height: 84vh;
|
||||
padding: 22px 24px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 14px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 22px 60px rgba(39, 67, 94, 0.2);
|
||||
overflow-y: auto;
|
||||
}
|
||||
.modal .form-group {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.modal-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.progress-wrap {
|
||||
margin-top: 12px;
|
||||
}
|
||||
.progress-text {
|
||||
font-size: 12.5px;
|
||||
color: #5b6f83;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.dedupe-export-wait-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 3100;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(45, 66, 86, 0.36);
|
||||
backdrop-filter: blur(6px);
|
||||
}
|
||||
.dedupe-export-wait {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 22px 28px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 14px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 22px 60px rgba(39, 67, 94, 0.2);
|
||||
}
|
||||
.request-spinner {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
flex: none;
|
||||
border: 3px solid #d5e3ef;
|
||||
border-top-color: #5f85ad;
|
||||
border-radius: 50%;
|
||||
animation: dedupe-spin 0.9s linear infinite;
|
||||
}
|
||||
@keyframes dedupe-spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
.dedupe-export-wait-title {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #24384d;
|
||||
}
|
||||
.dedupe-export-wait-detail {
|
||||
margin-top: 4px;
|
||||
font-size: 12.5px;
|
||||
color: #5b6f83;
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
import { createLatestRequestGate } from '@/utils/latest-request'
|
||||
import { formatDateTime, orderedPair } from '@/utils/datetime'
|
||||
/** 数据去重总数据(registry) · 像素复刻旧版 admin.html panel-dedupe-total-data(自绘:分组摘要 + 双行筛选 + 旧式表格/分页 + 编辑/导入弹窗 + 导出等待遮罩)。
|
||||
* script 逻辑沿用现有 Vue 实现(查询/编辑/删除/导入轮询/导出秒表)。 */
|
||||
@@ -107,13 +111,17 @@ function stopExportWait(): void {
|
||||
exportWaitVisible.value = false
|
||||
}
|
||||
|
||||
const batchListGate = createLatestRequestGate()
|
||||
|
||||
async function load(): Promise<void> {
|
||||
const token = batchListGate.begin()
|
||||
loading.value = true
|
||||
loadFailure.value = ''
|
||||
try {
|
||||
const result = await fetchDedupeTotalList(
|
||||
toDedupeListParams(filter, page.value, pageSize.value, pendingCursor, companyTab.requestCompanyId),
|
||||
)
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
rows.value = result.items
|
||||
total.value = result.total
|
||||
if (result.page >= 1) page.value = result.page
|
||||
@@ -121,10 +129,11 @@ async function load(): Promise<void> {
|
||||
pageCursor.value = result.nextLastId ?? null
|
||||
pendingCursor = null
|
||||
} catch (error) {
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
loadFailure.value = loadFailureMessage(error, '去重数据加载失败')
|
||||
showAdminFeedback(loadFailure.value, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (batchListGate.isCurrent(token)) loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,11 +201,23 @@ async function saveEdit(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => rows.value,
|
||||
rowId: (row) => row.id,
|
||||
rowLabel: (row) => row.dataValue,
|
||||
deleteOne: (id) => deleteDedupeTotal(id),
|
||||
refresh: load,
|
||||
blocked: () => loading.value || !!loadFailure.value,
|
||||
scope: () => companyTab.activeId,
|
||||
})
|
||||
|
||||
async function removeRow(row: DedupeTotalItem): Promise<void> {
|
||||
if (batch.busy) return
|
||||
// 对齐旧版:浏览器原生 confirm 确认后删除。
|
||||
if (!(await openAdminConfirm({ message: `确定删除总数据“${row.dataValue}”吗?`, danger: true }))) return
|
||||
try {
|
||||
await deleteDedupeTotal(row.id)
|
||||
batch.removeFromSelection(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
await load()
|
||||
} catch (error) {
|
||||
@@ -408,10 +429,15 @@ onUnmounted(() => {
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="load" />
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="table-scroll dedupe-table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th>ID</th>
|
||||
<th>ASIN</th>
|
||||
<th>国家</th>
|
||||
@@ -424,7 +450,11 @@ onUnmounted(() => {
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-if="rows.length">
|
||||
<tr v-for="row in rows" :key="row.id">
|
||||
<tr v-for="row in rows" :key="row.id" :class="{ 'batch-selected': batch.isSelected(row) }">
|
||||
<td class="batch-delete-cell">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row) || `选择 ${batch.label(row)}`" :checked="batch.isSelected(row)"
|
||||
:disabled="batch.disabled || !!batch.reason(row)" @change="batch.toggle(row)" />
|
||||
</td>
|
||||
<td>{{ row.id }}</td>
|
||||
<td class="mono-cell">{{ row.dataValue }}</td>
|
||||
<td>{{ asinCountryLabel(row.country || '') }}</td>
|
||||
@@ -434,15 +464,15 @@ onUnmounted(() => {
|
||||
<td>{{ formatDateTime(row.updatedAt) }}</td>
|
||||
<td class="ops-cell">
|
||||
<button class="btn btn-sm" type="button" @click="openEdit(row)">编辑</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" @click="removeRow(row)">删除</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" :disabled="batch.busy" @click="removeRow(row)">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td :colspan="isSuperAdmin ? 8 : 7" class="empty-tip">加载中...</td>
|
||||
<td :colspan="isSuperAdmin ? 9 : 8" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td :colspan="isSuperAdmin ? 8 : 7" class="empty-tip">暂无总数据</td>
|
||||
<td :colspan="isSuperAdmin ? 9 : 8" class="empty-tip">暂无总数据</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -541,353 +571,4 @@ onUnmounted(() => {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 像素复刻旧版 admin.html panel-dedupe-total-data(蓝白末层样式)。 */
|
||||
.dedupe-view {
|
||||
font-family: inherit;
|
||||
color: var(--c-text, #24384d);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
}
|
||||
.form-box,
|
||||
.panel-box {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 20px 22px 24px;
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
}
|
||||
h3 {
|
||||
margin: 0 0 16px;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: #24384d;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.dedupe-panel-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.dedupe-panel-head h3 {
|
||||
margin: 0;
|
||||
}
|
||||
.dedupe-head-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
.dedupe-filter-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
|
||||
gap: 12px;
|
||||
align-items: end;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.dedupe-filter-row .form-group {
|
||||
min-width: 0;
|
||||
}
|
||||
.dedupe-filter-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.dedupe-filter-date-row {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: flex-end;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.dedupe-filter-date-row .form-group {
|
||||
flex: 0 0 200px;
|
||||
min-width: 0;
|
||||
}
|
||||
.dedupe-filter-date-row .dedupe-filter-actions {
|
||||
margin-left: auto;
|
||||
}
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-group label {
|
||||
color: #5b6f83;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
/* 下拉壳由全局 .el-select.admin-filter(main.css:42px/9px 圆角/#f8fbfd 浅底/focus ring)出,
|
||||
与亚马逊面同一套;这里只留 input 的原生壳规则(2026-11-17 原生 select 全换 el-select)。 */
|
||||
.form-group input {
|
||||
min-width: 0;
|
||||
min-height: 42px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13.5px;
|
||||
font-family: inherit;
|
||||
color-scheme: light;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.form-group input:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.form-group input:focus {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
.form-group input[type="file"] {
|
||||
background: #ffffff;
|
||||
padding: 6px 10px;
|
||||
}
|
||||
.form-group input[type="date"] {
|
||||
color-scheme: light;
|
||||
}
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||||
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
|
||||
}
|
||||
.btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||||
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
|
||||
}
|
||||
.btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
border-color: #c7d7e5;
|
||||
}
|
||||
.btn-secondary:hover:not(:disabled) {
|
||||
color: #2f5d8b;
|
||||
border-color: #95b1cb;
|
||||
background: #edf5fb;
|
||||
}
|
||||
.btn-danger {
|
||||
background: linear-gradient(135deg, #c06d77, #b35f6a);
|
||||
border-color: #b35f6a;
|
||||
}
|
||||
.btn-danger:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #cb7c84, #b96570);
|
||||
}
|
||||
.btn-sm {
|
||||
min-height: 36px;
|
||||
padding: 7px 12px;
|
||||
}
|
||||
.table-scroll {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
overflow-x: auto;
|
||||
border: 1px solid #dbe5ee;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
.table-scroll table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.dedupe-table-scroll > table {
|
||||
min-width: 900px;
|
||||
}
|
||||
.table-scroll th,
|
||||
.table-scroll td {
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.5;
|
||||
border-bottom: 1px solid #e0e8ef;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.table-scroll th {
|
||||
background: #edf4fa;
|
||||
color: #4e6479;
|
||||
border-bottom-color: #d5e1eb;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
.table-scroll tbody tr:hover td {
|
||||
background: #f1f7fb;
|
||||
}
|
||||
.table-scroll tbody tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.mono-cell {
|
||||
font-family: "Cascadia Mono", "SF Mono", Consolas, "Courier New", monospace;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
.ops-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
white-space: nowrap;
|
||||
text-align: right;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
padding: 44px 24px;
|
||||
text-align: center;
|
||||
color: #8293a5;
|
||||
font-size: 13.5px;
|
||||
}
|
||||
.pagination {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 18px;
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
}
|
||||
.pagination button {
|
||||
min-height: 30px;
|
||||
padding: 4px 12px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pagination button:hover:not(:disabled) {
|
||||
background: #edf5fb;
|
||||
border-color: #95b1cb;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.pagination button:disabled {
|
||||
background: #eef3f7;
|
||||
color: #9baaba;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.page-total {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.page-jump {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.page-jump input {
|
||||
width: 56px;
|
||||
min-height: 30px;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 8px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.modal-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 3000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40px 20px;
|
||||
background: rgba(45, 66, 86, 0.36);
|
||||
backdrop-filter: blur(6px);
|
||||
}
|
||||
.modal {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: min(560px, 100%);
|
||||
max-height: 84vh;
|
||||
padding: 22px 24px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 14px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 22px 60px rgba(39, 67, 94, 0.2);
|
||||
overflow-y: auto;
|
||||
}
|
||||
.modal .form-group {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.modal-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.progress-wrap {
|
||||
margin-top: 12px;
|
||||
}
|
||||
.progress-text {
|
||||
font-size: 12.5px;
|
||||
color: #5b6f83;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.dedupe-export-wait-mask {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 3100;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(45, 66, 86, 0.36);
|
||||
backdrop-filter: blur(6px);
|
||||
}
|
||||
.dedupe-export-wait {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 22px 28px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 14px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 22px 60px rgba(39, 67, 94, 0.2);
|
||||
}
|
||||
.request-spinner {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
flex: none;
|
||||
border: 3px solid #d5e3ef;
|
||||
border-top-color: #5f85ad;
|
||||
border-radius: 50%;
|
||||
animation: dedupe-spin 0.9s linear infinite;
|
||||
}
|
||||
@keyframes dedupe-spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
.dedupe-export-wait-title {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #24384d;
|
||||
}
|
||||
.dedupe-export-wait-detail {
|
||||
margin-top: 4px;
|
||||
font-size: 12.5px;
|
||||
color: #5b6f83;
|
||||
}
|
||||
</style>
|
||||
<style scoped src="./DedupeRegistryPage.css"></style>
|
||||
|
||||
@@ -0,0 +1,287 @@
|
||||
/* 像素复刻旧版 admin.html panel-product-categories(蓝白末层)。 */
|
||||
.category-view {
|
||||
font-family: inherit;
|
||||
color: #24384d;
|
||||
}
|
||||
.panel-box {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 20px 22px 24px;
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: #24384d;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.category-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.category-head-tools {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.category-keyword {
|
||||
width: 240px;
|
||||
min-height: 36px;
|
||||
padding: 6px 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13.5px;
|
||||
font-family: inherit;
|
||||
color-scheme: light;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.category-keyword:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.category-keyword:focus {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||||
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
|
||||
}
|
||||
.btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||||
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
|
||||
}
|
||||
.btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.55;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
border-color: #c7d7e5;
|
||||
}
|
||||
.btn-secondary:hover:not(:disabled) {
|
||||
color: #2f5d8b;
|
||||
border-color: #95b1cb;
|
||||
background: #edf5fb;
|
||||
}
|
||||
.btn-danger {
|
||||
background: linear-gradient(135deg, #c06d77, #b35f6a);
|
||||
border-color: #b35f6a;
|
||||
}
|
||||
.btn-danger:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #cb7c84, #b96570);
|
||||
}
|
||||
.btn-sm {
|
||||
min-height: 36px;
|
||||
padding: 7px 12px;
|
||||
}
|
||||
.table-scroll {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
overflow-x: auto;
|
||||
border: 1px solid #dbe5ee;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
.table-scroll table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.category-table-scroll > table {
|
||||
/* table-layout:fixed 下,没写宽度的列在容器变窄时第一个被压到 0(10-06 截图:层级路径只剩一个字、
|
||||
备注只剩破折号)。承重的是 thead 里 8 列全部显式 px 定宽;这个下限与它们成对维护,
|
||||
数值由 tests/align-product-category.test.ts 从 markup 现算比对,改列宽要同时改这里。 */
|
||||
min-width: 1262px;
|
||||
}
|
||||
.table-scroll th,
|
||||
.table-scroll td {
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.5;
|
||||
border-bottom: 1px solid #e0e8ef;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.table-scroll th {
|
||||
background: #edf4fa;
|
||||
color: #4e6479;
|
||||
border-bottom-color: #d5e1eb;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
.table-scroll tbody tr:hover td {
|
||||
background: #f1f7fb;
|
||||
}
|
||||
.table-scroll tbody tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.tree-name-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-height: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tree-indent {
|
||||
flex: 0 0 auto;
|
||||
display: inline-block;
|
||||
}
|
||||
.tree-node-mark {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 0;
|
||||
border-radius: 5px;
|
||||
background: var(--admin-primary-soft, #e7f0f8);
|
||||
color: var(--admin-primary-strong, #2f5d8b);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
line-height: 1;
|
||||
flex: none;
|
||||
transition: background 0.12s ease, color 0.12s ease;
|
||||
}
|
||||
.tree-node-mark:not(.is-leaf):hover {
|
||||
background: var(--admin-primary-strong, #2f5d8b);
|
||||
color: #ffffff;
|
||||
}
|
||||
.tree-node-mark.is-leaf {
|
||||
background: transparent;
|
||||
cursor: default;
|
||||
}
|
||||
.node-name {
|
||||
font-weight: 600;
|
||||
color: #24384d;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.selected-flag {
|
||||
padding: 1px 8px;
|
||||
border-radius: 999px;
|
||||
background: #e7f0f8;
|
||||
color: #2f5d8b;
|
||||
font-size: 11px;
|
||||
}
|
||||
.category-tag {
|
||||
padding: 2px 8px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #c2d5e6;
|
||||
background: #e7f0f8;
|
||||
color: #2f5d8b;
|
||||
font-size: 12px;
|
||||
}
|
||||
.category-tag.is-custom {
|
||||
border-color: #bcd9c6;
|
||||
background: #eef7f0;
|
||||
color: #3d7158;
|
||||
}
|
||||
.category-path-value {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.node-desc {
|
||||
color: #5b6f83;
|
||||
font-size: 12px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 320px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.dim {
|
||||
color: #8293a5;
|
||||
}
|
||||
.ops-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
white-space: nowrap;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.load-more-row td {
|
||||
background: #fbfdfe;
|
||||
}
|
||||
.load-more-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.loaded-count {
|
||||
color: #8293a5;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
.empty-tip {
|
||||
padding: 44px 24px;
|
||||
text-align: center;
|
||||
color: #8293a5;
|
||||
font-size: 13.5px;
|
||||
}
|
||||
.pagination {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 18px;
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
}
|
||||
.pagination button {
|
||||
min-height: 30px;
|
||||
padding: 4px 12px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pagination button:hover:not(:disabled) {
|
||||
background: #edf5fb;
|
||||
border-color: #95b1cb;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.pagination button:disabled {
|
||||
background: #eef3f7;
|
||||
color: #9baaba;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.page-total {
|
||||
margin-right: 4px;
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
/** 商品类目 · 像素复刻旧版 admin.html panel-product-categories(自绘:面板头搜索框组+新增类目 同行、原生树表格[+/−]折叠+懒加载「加载更多 已加载 x/y」、搜索态旧式分页)。
|
||||
* script 逻辑沿用现有 Vue 实现(懒加载树/编辑删除/导出/弹窗)。 */
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
@@ -257,7 +260,21 @@ function canDelete(node: ProductCategoryNode | null): boolean {
|
||||
return !(node.childCount > 0 || (Array.isArray(node.children) && node.children.some((child) => !isCategoryLoadMoreNode(child))))
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => searching.value ? searchRows.value : treeRows.value.map(({ node }) => node),
|
||||
rowId: (row) => row.id,
|
||||
rowLabel: (row) => row.path || row.name,
|
||||
deleteOne: async (id) => {
|
||||
await deleteProductCategory(id)
|
||||
if (selected.value?.id === id) selected.value = null
|
||||
},
|
||||
refresh: () => searching.value ? runSearch(1) : loadTree(),
|
||||
blocked: () => loading.value || searchLoading.value || saving.value,
|
||||
precheck: (row) => canDelete(row) ? undefined : '存在子类目,不能删除',
|
||||
})
|
||||
|
||||
async function removeCategory(node: ProductCategoryNode): Promise<void> {
|
||||
if (batch.busy) return
|
||||
if (!canDelete(node)) {
|
||||
ElMessage.warning('存在子类目,不能删除')
|
||||
return
|
||||
@@ -266,6 +283,7 @@ async function removeCategory(node: ProductCategoryNode): Promise<void> {
|
||||
if (!(await openAdminConfirm({ message: `确定删除“${node.name}”?`, danger: true }))) return
|
||||
try {
|
||||
await deleteProductCategory(node.id)
|
||||
batch.removeFromSelection(node.id)
|
||||
ElMessage.success('已删除')
|
||||
if (selected.value?.id === node.id) selected.value = null
|
||||
if (searching.value) void runSearch(1)
|
||||
@@ -329,10 +347,15 @@ onMounted(loadTree)
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="loadTree" />
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="table-scroll category-table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col" style="width: 38px">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th style="width: 220px">类目</th>
|
||||
<th style="width: 230px">层级路径</th>
|
||||
<th style="width: 66px">排序</th>
|
||||
@@ -347,7 +370,7 @@ onMounted(loadTree)
|
||||
<template v-if="treeRows.length">
|
||||
<template v-for="row in treeRows" :key="String(row.node.id)">
|
||||
<tr v-if="isCategoryLoadMoreNode(row.node)" class="load-more-row">
|
||||
<td colspan="8">
|
||||
<td colspan="9">
|
||||
<div class="load-more-cell">
|
||||
<span class="tree-indent" :style="{ width: `${(row.depth + 1) * 24}px` }"></span>
|
||||
<button class="btn btn-sm btn-secondary" type="button" :disabled="moreLoading(row.node)" @click="loadMoreChildren(row.node)">
|
||||
@@ -357,7 +380,11 @@ onMounted(loadTree)
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<tr v-else :class="{ 'batch-selected': batch.isSelected(row.node) }">
|
||||
<td class="batch-delete-cell">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row.node) || `选择 ${batch.label(row.node)}`" :checked="batch.isSelected(row.node)"
|
||||
:disabled="batch.disabled || !!batch.reason(row.node)" @change="batch.toggle(row.node)" />
|
||||
</td>
|
||||
<td>
|
||||
<div class="tree-name-cell" @click="onNodeClick(row.node)">
|
||||
<span class="tree-indent" :style="{ width: `${row.depth * 24}px` }"></span>
|
||||
@@ -393,7 +420,7 @@ onMounted(loadTree)
|
||||
<button
|
||||
class="btn btn-sm btn-danger"
|
||||
type="button"
|
||||
:disabled="!canDelete(row.node)"
|
||||
:disabled="batch.busy || !canDelete(row.node)"
|
||||
:title="!canDelete(row.node) ? '存在子类目,不能删除' : undefined"
|
||||
@click="removeCategory(row.node)"
|
||||
>
|
||||
@@ -404,15 +431,19 @@ onMounted(loadTree)
|
||||
</template>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td colspan="8" class="empty-tip">加载中...</td>
|
||||
<td colspan="9" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td colspan="8" class="empty-tip">暂无商品类目</td>
|
||||
<td colspan="9" class="empty-tip">暂无商品类目</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody v-else>
|
||||
<template v-if="searchRows.length">
|
||||
<tr v-for="row in searchRows" :key="row.id">
|
||||
<tr v-for="row in searchRows" :key="row.id" :class="{ 'batch-selected': batch.isSelected(row) }">
|
||||
<td class="batch-delete-cell">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row) || `选择 ${batch.label(row)}`" :checked="batch.isSelected(row)"
|
||||
:disabled="batch.disabled || !!batch.reason(row)" @change="batch.toggle(row)" />
|
||||
</td>
|
||||
<td><strong class="node-name">{{ row.name }}</strong></td>
|
||||
<td><span class="category-path-value" :title="row.path || row.name">{{ row.path || row.name }}</span></td>
|
||||
<td>{{ row.sortOrder ?? '—' }}</td>
|
||||
@@ -430,7 +461,7 @@ onMounted(loadTree)
|
||||
<button
|
||||
class="btn btn-sm btn-danger"
|
||||
type="button"
|
||||
:disabled="!canDelete(row)"
|
||||
:disabled="batch.busy || !canDelete(row)"
|
||||
:title="!canDelete(row) ? '存在子类目,不能删除' : undefined"
|
||||
@click="removeCategory(row)"
|
||||
>
|
||||
@@ -440,10 +471,10 @@ onMounted(loadTree)
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="searchLoading">
|
||||
<td colspan="8" class="empty-tip">搜索中...</td>
|
||||
<td colspan="9" class="empty-tip">搜索中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td colspan="8" class="empty-tip">暂无搜索结果</td>
|
||||
<td colspan="9" class="empty-tip">暂无搜索结果</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -483,292 +514,4 @@ onMounted(loadTree)
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 像素复刻旧版 admin.html panel-product-categories(蓝白末层)。 */
|
||||
.category-view {
|
||||
font-family: inherit;
|
||||
color: #24384d;
|
||||
}
|
||||
.panel-box {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 20px 22px 24px;
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: #24384d;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.category-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.category-head-tools {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.category-keyword {
|
||||
width: 240px;
|
||||
min-height: 36px;
|
||||
padding: 6px 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13.5px;
|
||||
font-family: inherit;
|
||||
color-scheme: light;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.category-keyword:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.category-keyword:focus {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||||
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
|
||||
}
|
||||
.btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||||
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
|
||||
}
|
||||
.btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.55;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
border-color: #c7d7e5;
|
||||
}
|
||||
.btn-secondary:hover:not(:disabled) {
|
||||
color: #2f5d8b;
|
||||
border-color: #95b1cb;
|
||||
background: #edf5fb;
|
||||
}
|
||||
.btn-danger {
|
||||
background: linear-gradient(135deg, #c06d77, #b35f6a);
|
||||
border-color: #b35f6a;
|
||||
}
|
||||
.btn-danger:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #cb7c84, #b96570);
|
||||
}
|
||||
.btn-sm {
|
||||
min-height: 36px;
|
||||
padding: 7px 12px;
|
||||
}
|
||||
.table-scroll {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
overflow-x: auto;
|
||||
border: 1px solid #dbe5ee;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
.table-scroll table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.category-table-scroll > table {
|
||||
/* table-layout:fixed 下,没写宽度的列在容器变窄时第一个被压到 0(10-06 截图:层级路径只剩一个字、
|
||||
备注只剩破折号)。承重的是 thead 里 8 列全部显式 px 定宽;这个下限与它们成对维护,
|
||||
数值由 tests/align-product-category.test.ts 从 markup 现算比对,改列宽要同时改这里。 */
|
||||
min-width: 1224px;
|
||||
}
|
||||
.table-scroll th,
|
||||
.table-scroll td {
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.5;
|
||||
border-bottom: 1px solid #e0e8ef;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.table-scroll th {
|
||||
background: #edf4fa;
|
||||
color: #4e6479;
|
||||
border-bottom-color: #d5e1eb;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
.table-scroll tbody tr:hover td {
|
||||
background: #f1f7fb;
|
||||
}
|
||||
.table-scroll tbody tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.tree-name-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-height: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tree-indent {
|
||||
flex: 0 0 auto;
|
||||
display: inline-block;
|
||||
}
|
||||
.tree-node-mark {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 0;
|
||||
border-radius: 5px;
|
||||
background: var(--admin-primary-soft, #e7f0f8);
|
||||
color: var(--admin-primary-strong, #2f5d8b);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
line-height: 1;
|
||||
flex: none;
|
||||
transition: background 0.12s ease, color 0.12s ease;
|
||||
}
|
||||
.tree-node-mark:not(.is-leaf):hover {
|
||||
background: var(--admin-primary-strong, #2f5d8b);
|
||||
color: #ffffff;
|
||||
}
|
||||
.tree-node-mark.is-leaf {
|
||||
background: transparent;
|
||||
cursor: default;
|
||||
}
|
||||
.node-name {
|
||||
font-weight: 600;
|
||||
color: #24384d;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.selected-flag {
|
||||
padding: 1px 8px;
|
||||
border-radius: 999px;
|
||||
background: #e7f0f8;
|
||||
color: #2f5d8b;
|
||||
font-size: 11px;
|
||||
}
|
||||
.category-tag {
|
||||
padding: 2px 8px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #c2d5e6;
|
||||
background: #e7f0f8;
|
||||
color: #2f5d8b;
|
||||
font-size: 12px;
|
||||
}
|
||||
.category-tag.is-custom {
|
||||
border-color: #bcd9c6;
|
||||
background: #eef7f0;
|
||||
color: #3d7158;
|
||||
}
|
||||
.category-path-value {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.node-desc {
|
||||
color: #5b6f83;
|
||||
font-size: 12px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 320px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.dim {
|
||||
color: #8293a5;
|
||||
}
|
||||
.ops-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
white-space: nowrap;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.load-more-row td {
|
||||
background: #fbfdfe;
|
||||
}
|
||||
.load-more-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.loaded-count {
|
||||
color: #8293a5;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
.empty-tip {
|
||||
padding: 44px 24px;
|
||||
text-align: center;
|
||||
color: #8293a5;
|
||||
font-size: 13.5px;
|
||||
}
|
||||
.pagination {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 18px;
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
}
|
||||
.pagination button {
|
||||
min-height: 30px;
|
||||
padding: 4px 12px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pagination button:hover:not(:disabled) {
|
||||
background: #edf5fb;
|
||||
border-color: #95b1cb;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.pagination button:disabled {
|
||||
background: #eef3f7;
|
||||
color: #9baaba;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.page-total {
|
||||
margin-right: 4px;
|
||||
}
|
||||
</style>
|
||||
<style scoped src="./ProductCategoryPage.css"></style>
|
||||
|
||||
@@ -0,0 +1,272 @@
|
||||
/* 像素复刻旧版 admin.html panel-query-asin(蓝白末层)。 */
|
||||
.query-view {
|
||||
font-family: inherit;
|
||||
color: #24384d;
|
||||
}
|
||||
.panel-box {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 20px 22px 24px;
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: #24384d;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.query-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.query-head-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
.form-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
gap: 14px 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.query-filter-row > .form-group {
|
||||
flex: 1 1 140px;
|
||||
min-width: 0;
|
||||
}
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-group label {
|
||||
color: #5b6f83;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
/* 下拉壳由全局 .el-select.admin-filter(main.css:42px/9px 圆角/#f8fbfd 浅底/focus ring)出,
|
||||
与亚马逊面同一套;这里只留 input 的原生壳规则(2026-11-17 原生 select 全换 el-select)。 */
|
||||
.form-group input {
|
||||
min-width: 0;
|
||||
min-height: 42px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13.5px;
|
||||
font-family: inherit;
|
||||
color-scheme: light;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.form-group input:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.form-group input:focus {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||||
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
|
||||
}
|
||||
.btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||||
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
|
||||
}
|
||||
.btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.55;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
border-color: #c7d7e5;
|
||||
}
|
||||
.btn-secondary:hover:not(:disabled) {
|
||||
color: #2f5d8b;
|
||||
border-color: #95b1cb;
|
||||
background: #edf5fb;
|
||||
}
|
||||
.btn-danger {
|
||||
background: linear-gradient(135deg, #c06d77, #b35f6a);
|
||||
border-color: #b35f6a;
|
||||
}
|
||||
.btn-danger:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #cb7c84, #b96570);
|
||||
}
|
||||
.btn-sm {
|
||||
min-height: 36px;
|
||||
padding: 7px 12px;
|
||||
}
|
||||
.table-scroll {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
overflow-x: auto;
|
||||
border: 1px solid #dbe5ee;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
.table-scroll table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.query-asin-table-scroll > table {
|
||||
min-width: 860px;
|
||||
}
|
||||
.table-scroll th,
|
||||
.table-scroll td {
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.5;
|
||||
border-bottom: 1px solid #e0e8ef;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.table-scroll th {
|
||||
background: #edf4fa;
|
||||
color: #4e6479;
|
||||
border-bottom-color: #d5e1eb;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
.table-scroll tbody tr:hover td {
|
||||
background: #f1f7fb;
|
||||
}
|
||||
.table-scroll tbody tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.table-scroll td {
|
||||
vertical-align: top;
|
||||
}
|
||||
.asin-cell {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
margin: -3px 0 -3px -7px;
|
||||
padding: 3px 7px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 9px;
|
||||
background: none;
|
||||
color: inherit;
|
||||
font-size: 13.5px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
line-height: 1.5;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
cursor: pointer;
|
||||
}
|
||||
.asin-cell:hover {
|
||||
border-color: #c7d7e5;
|
||||
background: #eef4fa;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.asin-empty {
|
||||
color: #8b9aaa;
|
||||
}
|
||||
.asin-col-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
white-space: nowrap;
|
||||
/* 与最低价 ASIN 同形:列宽已从 9% 改成 140px 下限,再补 wrap 兜住文案变长的情况,
|
||||
让"超宽"从"按钮静默消失"退化成"多占一行"。 */
|
||||
flex-wrap: wrap;
|
||||
background: #ffffff;
|
||||
box-shadow: -9px 0 12px -10px rgba(31, 48, 66, 0.45);
|
||||
}
|
||||
.empty-tip {
|
||||
padding: 44px 24px;
|
||||
text-align: center;
|
||||
color: #8293a5;
|
||||
font-size: 13.5px;
|
||||
}
|
||||
.pagination {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 18px;
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
}
|
||||
.pagination button {
|
||||
min-height: 30px;
|
||||
padding: 4px 12px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pagination button:hover:not(:disabled) {
|
||||
background: #edf5fb;
|
||||
border-color: #95b1cb;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.pagination button:disabled {
|
||||
background: #eef3f7;
|
||||
color: #9baaba;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.page-total {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.page-jump {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.page-jump input {
|
||||
width: 56px;
|
||||
min-height: 30px;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 8px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.drawer-tip {
|
||||
color: #5b6f83;
|
||||
font-size: 12px;
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
.import-tip {
|
||||
margin: 6px 0 0;
|
||||
color: #5b6f83;
|
||||
font-size: 12px;
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
import { createLatestRequestGate } from '@/utils/latest-request'
|
||||
/** 查询 ASIN · 像素复刻旧版 admin.html panel-query-asin(自绘:面板头操作组、筛选+导出 XLSX、原生 rowspan 表格+可复制 ASIN、旧式分页)。
|
||||
* script 逻辑沿用现有 Vue 实现(新增级联/配置抽屉/导入轮询/导出)。 */
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
@@ -71,13 +75,37 @@ function normalizeAsinInput(country: string): void {
|
||||
}
|
||||
|
||||
|
||||
// 同一家店铺部分站点删除成功后,重试只发未完成的站点。
|
||||
const pendingCountries = new WeakMap<QueryAsinItem, Set<(typeof QUERY_ASIN_COUNTRIES)[number]>>()
|
||||
|
||||
async function deleteShopCountries(item: QueryAsinItem, isCurrent: () => boolean = () => true) {
|
||||
const pending = pendingCountries.get(item) ?? new Set(QUERY_ASIN_COUNTRIES.filter((country) => asinOf(item, country)))
|
||||
pendingCountries.set(item, pending)
|
||||
for (const country of pending) {
|
||||
if (!isCurrent()) throw new Error('列表范围已切换,店铺剩余站点未删除')
|
||||
await deleteQueryAsinCountryAsin(item.id, country)
|
||||
pending.delete(country)
|
||||
}
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => rows.value,
|
||||
rowId: (row) => row.id,
|
||||
rowLabel: (row) => row.groupName ? `${row.shopName}(${row.groupName})` : row.shopName,
|
||||
deleteOne: (_id, row, isCurrent) => deleteShopCountries(row, isCurrent),
|
||||
refresh: load,
|
||||
blocked: () => loading.value || !!loadFailure.value,
|
||||
scope: () => companyTab.activeId,
|
||||
consequence: '将删除所选店铺全部站点的 ASIN 配置,此操作不可恢复。',
|
||||
})
|
||||
|
||||
async function removeShopAsin(item: QueryAsinItem) {
|
||||
if (batch.busy) return
|
||||
// 删除该店铺全部站点的 ASIN 配置(逐国调用现有端点)。
|
||||
if (!(await openAdminConfirm({ message: `确定删除店铺“${item.shopName}”的全部站点 ASIN 配置吗?`, danger: true }))) return
|
||||
try {
|
||||
for (const country of QUERY_ASIN_COUNTRIES) {
|
||||
if (asinOf(item, country)) await deleteQueryAsinCountryAsin(item.id, country)
|
||||
}
|
||||
await deleteShopCountries(item)
|
||||
batch.removeFromSelection(item.id)
|
||||
ElMessage.success('已删除')
|
||||
await load()
|
||||
} catch (error) {
|
||||
@@ -300,7 +328,10 @@ async function loadGroups() {
|
||||
}
|
||||
}
|
||||
|
||||
const batchListGate = createLatestRequestGate()
|
||||
|
||||
async function load() {
|
||||
const token = batchListGate.begin()
|
||||
loading.value = true
|
||||
loadFailure.value = ''
|
||||
try {
|
||||
@@ -313,14 +344,16 @@ async function load() {
|
||||
country: filter.country || undefined,
|
||||
companyId: companyTab.requestCompanyId,
|
||||
})
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
rows.value = result.items
|
||||
total.value = result.total
|
||||
page.value = result.page
|
||||
} catch (error) {
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
loadFailure.value = error instanceof Error ? error.message : '数据加载失败'
|
||||
showAdminFeedback(loadFailure.value, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (batchListGate.isCurrent(token)) loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,10 +438,15 @@ onMounted(() => {
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="load" />
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="table-scroll query-asin-table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th style="width: 6%">序号</th>
|
||||
<th v-if="isSuperAdmin" style="width: 13%">分组</th>
|
||||
<th style="width: 15%">店铺名</th>
|
||||
@@ -421,8 +459,12 @@ onMounted(() => {
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-if="displayRows.length">
|
||||
<tr v-for="row in displayRows" :key="`${row.item.id}-${row.country}`">
|
||||
<tr v-for="row in displayRows" :key="`${row.item.id}-${row.country}`" :class="{ 'batch-selected': batch.isSelected(row.item) }">
|
||||
<template v-if="row.isFirst">
|
||||
<td class="batch-delete-cell" :rowspan="row.rowspan">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row.item) || `选择 ${batch.label(row.item)}`" :checked="batch.isSelected(row.item)"
|
||||
:disabled="batch.disabled || !!batch.reason(row.item)" @change="batch.toggle(row.item)" />
|
||||
</td>
|
||||
<td :rowspan="row.rowspan">{{ row.rowNo }}</td>
|
||||
<td v-if="isSuperAdmin" :rowspan="row.rowspan">{{ row.item.groupName || '—' }}</td>
|
||||
<td :rowspan="row.rowspan">{{ row.item.shopName }}</td>
|
||||
@@ -439,16 +481,16 @@ onMounted(() => {
|
||||
<td :rowspan="row.rowspan">{{ formatDateTime(row.item.updatedAt) }}</td>
|
||||
<td :rowspan="row.rowspan" class="asin-col-actions">
|
||||
<button class="btn btn-sm" type="button" @click="openConfig(row.item as QueryAsinItem)">配置</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" @click="removeShopAsin(row.item as QueryAsinItem)">删除</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" :disabled="batch.busy" @click="removeShopAsin(row.item as QueryAsinItem)">删除</button>
|
||||
</td>
|
||||
</template>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td :colspan="isSuperAdmin ? 8 : 7" class="empty-tip">加载中...</td>
|
||||
<td :colspan="isSuperAdmin ? 9 : 8" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td :colspan="isSuperAdmin ? 8 : 7" class="empty-tip">暂无数据</td>
|
||||
<td :colspan="isSuperAdmin ? 9 : 8" class="empty-tip">暂无数据</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -531,277 +573,4 @@ onMounted(() => {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 像素复刻旧版 admin.html panel-query-asin(蓝白末层)。 */
|
||||
.query-view {
|
||||
font-family: inherit;
|
||||
color: #24384d;
|
||||
}
|
||||
.panel-box {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 20px 22px 24px;
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: #24384d;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.query-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.query-head-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
.form-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
gap: 14px 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.query-filter-row > .form-group {
|
||||
flex: 1 1 140px;
|
||||
min-width: 0;
|
||||
}
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-group label {
|
||||
color: #5b6f83;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
/* 下拉壳由全局 .el-select.admin-filter(main.css:42px/9px 圆角/#f8fbfd 浅底/focus ring)出,
|
||||
与亚马逊面同一套;这里只留 input 的原生壳规则(2026-11-17 原生 select 全换 el-select)。 */
|
||||
.form-group input {
|
||||
min-width: 0;
|
||||
min-height: 42px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13.5px;
|
||||
font-family: inherit;
|
||||
color-scheme: light;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.form-group input:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.form-group input:focus {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||||
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
|
||||
}
|
||||
.btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||||
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
|
||||
}
|
||||
.btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.55;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
border-color: #c7d7e5;
|
||||
}
|
||||
.btn-secondary:hover:not(:disabled) {
|
||||
color: #2f5d8b;
|
||||
border-color: #95b1cb;
|
||||
background: #edf5fb;
|
||||
}
|
||||
.btn-danger {
|
||||
background: linear-gradient(135deg, #c06d77, #b35f6a);
|
||||
border-color: #b35f6a;
|
||||
}
|
||||
.btn-danger:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #cb7c84, #b96570);
|
||||
}
|
||||
.btn-sm {
|
||||
min-height: 36px;
|
||||
padding: 7px 12px;
|
||||
}
|
||||
.table-scroll {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
overflow-x: auto;
|
||||
border: 1px solid #dbe5ee;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
.table-scroll table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.query-asin-table-scroll > table {
|
||||
min-width: 860px;
|
||||
}
|
||||
.table-scroll th,
|
||||
.table-scroll td {
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.5;
|
||||
border-bottom: 1px solid #e0e8ef;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.table-scroll th {
|
||||
background: #edf4fa;
|
||||
color: #4e6479;
|
||||
border-bottom-color: #d5e1eb;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
.table-scroll tbody tr:hover td {
|
||||
background: #f1f7fb;
|
||||
}
|
||||
.table-scroll tbody tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.table-scroll td {
|
||||
vertical-align: top;
|
||||
}
|
||||
.asin-cell {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
margin: -3px 0 -3px -7px;
|
||||
padding: 3px 7px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 9px;
|
||||
background: none;
|
||||
color: inherit;
|
||||
font-size: 13.5px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
line-height: 1.5;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
cursor: pointer;
|
||||
}
|
||||
.asin-cell:hover {
|
||||
border-color: #c7d7e5;
|
||||
background: #eef4fa;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.asin-empty {
|
||||
color: #8b9aaa;
|
||||
}
|
||||
.asin-col-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
white-space: nowrap;
|
||||
/* 与最低价 ASIN 同形:列宽已从 9% 改成 140px 下限,再补 wrap 兜住文案变长的情况,
|
||||
让"超宽"从"按钮静默消失"退化成"多占一行"。 */
|
||||
flex-wrap: wrap;
|
||||
background: #ffffff;
|
||||
box-shadow: -9px 0 12px -10px rgba(31, 48, 66, 0.45);
|
||||
}
|
||||
.empty-tip {
|
||||
padding: 44px 24px;
|
||||
text-align: center;
|
||||
color: #8293a5;
|
||||
font-size: 13.5px;
|
||||
}
|
||||
.pagination {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 18px;
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
}
|
||||
.pagination button {
|
||||
min-height: 30px;
|
||||
padding: 4px 12px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pagination button:hover:not(:disabled) {
|
||||
background: #edf5fb;
|
||||
border-color: #95b1cb;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.pagination button:disabled {
|
||||
background: #eef3f7;
|
||||
color: #9baaba;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.page-total {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.page-jump {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.page-jump input {
|
||||
width: 56px;
|
||||
min-height: 30px;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 8px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.drawer-tip {
|
||||
color: #5b6f83;
|
||||
font-size: 12px;
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
.import-tip {
|
||||
margin: 6px 0 0;
|
||||
color: #5b6f83;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
<style scoped src="./QueryAsinPage.css"></style>
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
/* 像素复刻旧版 admin.html panel-skip-price-asin(蓝白末层)。 */
|
||||
.skip-view {
|
||||
font-family: inherit;
|
||||
color: #24384d;
|
||||
}
|
||||
.panel-box {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 20px 22px 24px;
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: #24384d;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.skip-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.skip-head-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
.form-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
gap: 14px 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.skip-filter-row > .form-group {
|
||||
flex: 1 1 130px;
|
||||
min-width: 0;
|
||||
}
|
||||
.skip-filter-row .form-group.price-range {
|
||||
flex: 1 1 220px;
|
||||
}
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-group label {
|
||||
color: #5b6f83;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
/* 下拉壳由全局 .el-select.admin-filter(main.css:42px/9px 圆角/#f8fbfd 浅底/focus ring)出,
|
||||
与亚马逊面同一套;这里只留 input 的原生壳规则(2026-11-17 原生 select 全换 el-select)。 */
|
||||
.form-group input {
|
||||
min-width: 0;
|
||||
min-height: 42px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13.5px;
|
||||
font-family: inherit;
|
||||
color-scheme: light;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.form-group input:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.form-group input:focus {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
.price-range-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
.price-range-row input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.price-range-row .range-sep {
|
||||
color: #8293a5;
|
||||
flex: none;
|
||||
}
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||||
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
|
||||
}
|
||||
.btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||||
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
|
||||
}
|
||||
.btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.55;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
border-color: #c7d7e5;
|
||||
}
|
||||
.btn-secondary:hover:not(:disabled) {
|
||||
color: #2f5d8b;
|
||||
border-color: #95b1cb;
|
||||
background: #edf5fb;
|
||||
}
|
||||
.btn-danger {
|
||||
background: linear-gradient(135deg, #c06d77, #b35f6a);
|
||||
border-color: #b35f6a;
|
||||
}
|
||||
.btn-danger:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #cb7c84, #b96570);
|
||||
}
|
||||
.btn-sm {
|
||||
min-height: 36px;
|
||||
padding: 7px 12px;
|
||||
}
|
||||
.table-scroll {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
overflow-x: auto;
|
||||
border: 1px solid #dbe5ee;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
.table-scroll table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.skip-price-asin-table-scroll > table {
|
||||
min-width: 900px;
|
||||
}
|
||||
.table-scroll th,
|
||||
.table-scroll td {
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.5;
|
||||
border-bottom: 1px solid #e0e8ef;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.table-scroll th {
|
||||
background: #edf4fa;
|
||||
color: #4e6479;
|
||||
border-bottom-color: #d5e1eb;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
.table-scroll tbody tr:hover td {
|
||||
background: #f1f7fb;
|
||||
}
|
||||
.table-scroll tbody tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.table-scroll td {
|
||||
vertical-align: top;
|
||||
}
|
||||
.asin-cell {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
margin: -3px 0 -3px -7px;
|
||||
padding: 3px 7px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 9px;
|
||||
background: none;
|
||||
color: inherit;
|
||||
font-size: 13.5px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
line-height: 1.5;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
cursor: pointer;
|
||||
}
|
||||
.asin-cell:hover {
|
||||
border-color: #c7d7e5;
|
||||
background: #eef4fa;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.asin-empty {
|
||||
color: #8b9aaa;
|
||||
}
|
||||
.price-cell {
|
||||
text-align: right;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.asin-col-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
white-space: nowrap;
|
||||
/* 列宽已从 9% 改成 140px 下限(两字按钮 53×2 + gap 8 + td 左右 padding 24 = 138)。
|
||||
百分比会跟着容器一起缩,配上 justify-content:flex-end 后溢出翻到左侧,
|
||||
"配置"整颗被吃掉而"删除"看着完好——2026-10-08 那单截图就是这个形状。 */
|
||||
flex-wrap: wrap;
|
||||
background: #ffffff;
|
||||
box-shadow: -9px 0 12px -10px rgba(31, 48, 66, 0.45);
|
||||
}
|
||||
.empty-tip {
|
||||
padding: 44px 24px;
|
||||
text-align: center;
|
||||
color: #8293a5;
|
||||
font-size: 13.5px;
|
||||
}
|
||||
.pagination {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 18px;
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
}
|
||||
.pagination button {
|
||||
min-height: 30px;
|
||||
padding: 4px 12px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pagination button:hover:not(:disabled) {
|
||||
background: #edf5fb;
|
||||
border-color: #95b1cb;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.pagination button:disabled {
|
||||
background: #eef3f7;
|
||||
color: #9baaba;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.page-total {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.page-jump {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.page-jump input {
|
||||
width: 56px;
|
||||
min-height: 30px;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 8px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.drawer-tip {
|
||||
color: #5b6f83;
|
||||
font-size: 12px;
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
.country-cell {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
.import-tip {
|
||||
margin: 6px 0 0;
|
||||
color: #5b6f83;
|
||||
font-size: 12px;
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
import { createLatestRequestGate } from '@/utils/latest-request'
|
||||
/** 最低价 ASIN(跳过跟价)· 像素复刻旧版 admin.html panel-skip-price-asin(自绘:面板头操作组、筛选(分组/店铺/国家/ASIN/最低价≥≤)+导出 XLSX、原生 rowspan 表格、旧式分页)。
|
||||
* script 逻辑沿用现有 Vue 实现(新增级联+最低价、配置抽屉双列、导入轮询、导出)。 */
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
@@ -225,7 +229,19 @@ async function saveConfig(): Promise<void> {
|
||||
}
|
||||
|
||||
// ---- 整条删除 ----
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => rows.value,
|
||||
rowId: (row) => row.id,
|
||||
rowLabel: (row) => row.groupName ? `${row.shopName}(${row.groupName})` : row.shopName,
|
||||
deleteOne: (id) => deleteSkipPriceAsin(id),
|
||||
refresh: load,
|
||||
blocked: () => loading.value || !!loadFailure.value,
|
||||
scope: () => companyTab.activeId,
|
||||
consequence: '将删除所选店铺全部站点的最低价 ASIN 配置,此操作不可恢复。',
|
||||
})
|
||||
|
||||
async function removeRow(item: SkipPriceItem): Promise<void> {
|
||||
if (batch.busy) return
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定删除「${item.shopName}」${item.groupName ? `(${item.groupName})` : ''}全部站点的最低价 ASIN 配置吗?`,
|
||||
@@ -237,6 +253,7 @@ async function removeRow(item: SkipPriceItem): Promise<void> {
|
||||
}
|
||||
try {
|
||||
await deleteSkipPriceAsin(item.id)
|
||||
batch.removeFromSelection(item.id)
|
||||
ElMessage.success('删除成功')
|
||||
// 删除后当前页若已空且非首页,回退一页避免展示空页。
|
||||
if (rows.value.length === 1 && page.value > 1) {
|
||||
@@ -353,19 +370,24 @@ async function loadGroups() {
|
||||
}
|
||||
}
|
||||
|
||||
const batchListGate = createLatestRequestGate()
|
||||
|
||||
async function load() {
|
||||
const token = batchListGate.begin()
|
||||
loading.value = true
|
||||
loadFailure.value = ''
|
||||
try {
|
||||
const result = await fetchSkipPriceList(toSkipPriceParams(filter, page.value, pageSize.value, companyTab.requestCompanyId))
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
rows.value = result.items
|
||||
total.value = result.total
|
||||
page.value = result.page
|
||||
} catch (error) {
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
loadFailure.value = error instanceof Error ? error.message : '数据加载失败'
|
||||
showAdminFeedback(loadFailure.value, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (batchListGate.isCurrent(token)) loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,10 +480,15 @@ onMounted(() => {
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="load" />
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="table-scroll skip-price-asin-table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th style="width: 6%">序号</th>
|
||||
<th v-if="isSuperAdmin" style="width: 13%">分组</th>
|
||||
<th style="width: 15%">店铺名</th>
|
||||
@@ -475,8 +502,12 @@ onMounted(() => {
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-if="displayRows.length">
|
||||
<tr v-for="row in displayRows" :key="`${row.item.id}-${row.country}`">
|
||||
<tr v-for="row in displayRows" :key="`${row.item.id}-${row.country}`" :class="{ 'batch-selected': batch.isSelected(row.item) }">
|
||||
<template v-if="row.isFirst">
|
||||
<td class="batch-delete-cell" :rowspan="row.rowspan">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row.item) || `选择 ${batch.label(row.item)}`" :checked="batch.isSelected(row.item)"
|
||||
:disabled="batch.disabled || !!batch.reason(row.item)" @change="batch.toggle(row.item)" />
|
||||
</td>
|
||||
<td :rowspan="row.rowspan">{{ row.rowNo }}</td>
|
||||
<td v-if="isSuperAdmin" :rowspan="row.rowspan">{{ row.item.groupName || '—' }}</td>
|
||||
<td :rowspan="row.rowspan">{{ row.item.shopName }}</td>
|
||||
@@ -494,16 +525,16 @@ onMounted(() => {
|
||||
<td :rowspan="row.rowspan">{{ formatDateTime(row.item.updatedAt) }}</td>
|
||||
<td :rowspan="row.rowspan" class="asin-col-actions">
|
||||
<button class="btn btn-sm" type="button" @click="openConfig(row.item as SkipPriceItem)">配置</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" @click="removeRow(row.item as SkipPriceItem)">删除</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" :disabled="batch.busy" @click="removeRow(row.item as SkipPriceItem)">删除</button>
|
||||
</td>
|
||||
</template>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td :colspan="isSuperAdmin ? 9 : 8" class="empty-tip">加载中...</td>
|
||||
<td :colspan="isSuperAdmin ? 10 : 9" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td :colspan="isSuperAdmin ? 9 : 8" class="empty-tip">暂无数据</td>
|
||||
<td :colspan="isSuperAdmin ? 10 : 9" class="empty-tip">暂无数据</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -592,305 +623,4 @@ onMounted(() => {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 像素复刻旧版 admin.html panel-skip-price-asin(蓝白末层)。 */
|
||||
.skip-view {
|
||||
font-family: inherit;
|
||||
color: #24384d;
|
||||
}
|
||||
.panel-box {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 20px 22px 24px;
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
}
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: #24384d;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.skip-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.skip-head-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
.form-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
gap: 14px 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.skip-filter-row > .form-group {
|
||||
flex: 1 1 130px;
|
||||
min-width: 0;
|
||||
}
|
||||
.skip-filter-row .form-group.price-range {
|
||||
flex: 1 1 220px;
|
||||
}
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-group label {
|
||||
color: #5b6f83;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
/* 下拉壳由全局 .el-select.admin-filter(main.css:42px/9px 圆角/#f8fbfd 浅底/focus ring)出,
|
||||
与亚马逊面同一套;这里只留 input 的原生壳规则(2026-11-17 原生 select 全换 el-select)。 */
|
||||
.form-group input {
|
||||
min-width: 0;
|
||||
min-height: 42px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13.5px;
|
||||
font-family: inherit;
|
||||
color-scheme: light;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.form-group input:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.form-group input:focus {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
.price-range-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
.price-range-row input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.price-range-row .range-sep {
|
||||
color: #8293a5;
|
||||
flex: none;
|
||||
}
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||||
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
|
||||
}
|
||||
.btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||||
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
|
||||
}
|
||||
.btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.55;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
border-color: #c7d7e5;
|
||||
}
|
||||
.btn-secondary:hover:not(:disabled) {
|
||||
color: #2f5d8b;
|
||||
border-color: #95b1cb;
|
||||
background: #edf5fb;
|
||||
}
|
||||
.btn-danger {
|
||||
background: linear-gradient(135deg, #c06d77, #b35f6a);
|
||||
border-color: #b35f6a;
|
||||
}
|
||||
.btn-danger:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #cb7c84, #b96570);
|
||||
}
|
||||
.btn-sm {
|
||||
min-height: 36px;
|
||||
padding: 7px 12px;
|
||||
}
|
||||
.table-scroll {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
overflow-x: auto;
|
||||
border: 1px solid #dbe5ee;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
.table-scroll table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.skip-price-asin-table-scroll > table {
|
||||
min-width: 900px;
|
||||
}
|
||||
.table-scroll th,
|
||||
.table-scroll td {
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.5;
|
||||
border-bottom: 1px solid #e0e8ef;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.table-scroll th {
|
||||
background: #edf4fa;
|
||||
color: #4e6479;
|
||||
border-bottom-color: #d5e1eb;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
.table-scroll tbody tr:hover td {
|
||||
background: #f1f7fb;
|
||||
}
|
||||
.table-scroll tbody tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.table-scroll td {
|
||||
vertical-align: top;
|
||||
}
|
||||
.asin-cell {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
margin: -3px 0 -3px -7px;
|
||||
padding: 3px 7px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 9px;
|
||||
background: none;
|
||||
color: inherit;
|
||||
font-size: 13.5px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
line-height: 1.5;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
cursor: pointer;
|
||||
}
|
||||
.asin-cell:hover {
|
||||
border-color: #c7d7e5;
|
||||
background: #eef4fa;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.asin-empty {
|
||||
color: #8b9aaa;
|
||||
}
|
||||
.price-cell {
|
||||
text-align: right;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.asin-col-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
white-space: nowrap;
|
||||
/* 列宽已从 9% 改成 140px 下限(两字按钮 53×2 + gap 8 + td 左右 padding 24 = 138)。
|
||||
百分比会跟着容器一起缩,配上 justify-content:flex-end 后溢出翻到左侧,
|
||||
"配置"整颗被吃掉而"删除"看着完好——2026-10-08 那单截图就是这个形状。 */
|
||||
flex-wrap: wrap;
|
||||
background: #ffffff;
|
||||
box-shadow: -9px 0 12px -10px rgba(31, 48, 66, 0.45);
|
||||
}
|
||||
.empty-tip {
|
||||
padding: 44px 24px;
|
||||
text-align: center;
|
||||
color: #8293a5;
|
||||
font-size: 13.5px;
|
||||
}
|
||||
.pagination {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 18px;
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
}
|
||||
.pagination button {
|
||||
min-height: 30px;
|
||||
padding: 4px 12px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pagination button:hover:not(:disabled) {
|
||||
background: #edf5fb;
|
||||
border-color: #95b1cb;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.pagination button:disabled {
|
||||
background: #eef3f7;
|
||||
color: #9baaba;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.page-total {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.page-jump {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.page-jump input {
|
||||
width: 56px;
|
||||
min-height: 30px;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 8px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.drawer-tip {
|
||||
color: #5b6f83;
|
||||
font-size: 12px;
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
.country-cell {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
.import-tip {
|
||||
margin: 6px 0 0;
|
||||
color: #5b6f83;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
<style scoped src="./SkipPricePage.css"></style>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
/** 分类管理对话框(2026-11-17 用户口径「京东分类管理并到京东数据库分类编辑里,
|
||||
* 做一个搜索和添加 删除 编辑 分类名称即可」):原 V204 独立子菜单页(JdCategoryManagerPage)
|
||||
* 整体并入本对话框,从京东数据库页工具栏「分类管理」打开。
|
||||
@@ -196,13 +199,29 @@ async function submitRename(group: JdProductGroup): Promise<void> {
|
||||
}
|
||||
|
||||
/** 删除分类不删商品:只解挂本组归属行(商品回到未分类),后端 JdProductGroupService.delete。 */
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => pagedGroups.value,
|
||||
rowId: (row) => row.id,
|
||||
rowLabel: (row) => row.name,
|
||||
deleteOne: (id) => deleteJdProductGroup(id),
|
||||
refresh: async (outcome) => {
|
||||
if (outcome.deleted.length) emit('changed')
|
||||
await loadGroups()
|
||||
},
|
||||
blocked: () => !props.visible || !props.editable || loading.value || saving.value || creating.value || !!editingId.value || !!loadFailure.value,
|
||||
scope: () => [props.visible, props.ownerGroupId, props.editable],
|
||||
consequence: '分类下的商品将回到未分类,商品本身不会被删除。',
|
||||
})
|
||||
|
||||
async function removeGroup(group: JdProductGroup): Promise<void> {
|
||||
if (batch.busy) return
|
||||
const ok = await openAdminConfirm({ title: '删除分类', message: `确定删除分类「${group.name}」吗?删除后该分类下 ${group.productCount} 个商品回到未分类。`, confirmText: '确认删除', danger: true })
|
||||
if (!ok || saving.value) return
|
||||
saving.value = true
|
||||
errorText.value = ''
|
||||
try {
|
||||
await deleteJdProductGroup(group.id)
|
||||
batch.removeFromSelection(group.id)
|
||||
showAdminFeedback(`已删除分类「${group.name}」`, 'success')
|
||||
emit('changed')
|
||||
await loadGroups()
|
||||
@@ -262,16 +281,20 @@ watch(totalPages, (pages) => {
|
||||
<input v-model="keyword" class="search-input" type="text" placeholder="搜索分类名称" aria-label="搜索分类名称" />
|
||||
<div v-if="editable" class="group-create">
|
||||
<input v-model="createName" type="text" placeholder="输入新分类名称" aria-label="新分类名称" @keyup.enter="submitCreate" />
|
||||
<button class="btn" type="button" :disabled="!canCreate" @click="submitCreate">新建</button>
|
||||
<button class="btn" type="button" :disabled="batch.busy || !canCreate" @click="submitCreate">新建</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="loadGroups" />
|
||||
<p v-if="errorText" class="group-error">{{ errorText }}</p>
|
||||
|
||||
<BatchDeleteActions v-if="editable" :batch="batch" />
|
||||
|
||||
<!-- 表头(2026-11-18 用户红框口径):列表有数据时在搜索行下列出三列名,与行同构对齐;
|
||||
只读口径下行没有改名/删除按钮,操作列表头随之不渲染。 -->
|
||||
<div v-if="filteredGroups.length" class="option-head">
|
||||
<BatchDeleteCheckbox v-if="editable" label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
<span class="head-name">分类名称</span>
|
||||
<span class="head-count">商品数</span>
|
||||
<span v-if="editable" class="head-actions">操作</span>
|
||||
@@ -279,7 +302,9 @@ watch(totalPages, (pages) => {
|
||||
|
||||
<ul class="option-list">
|
||||
<template v-if="filteredGroups.length">
|
||||
<li v-for="group in pagedGroups" :key="group.id" class="option-row">
|
||||
<li v-for="group in pagedGroups" :key="group.id" class="option-row" :class="{ 'batch-selected': batch.isSelected(group) }">
|
||||
<BatchDeleteCheckbox v-if="editable" :label="batch.reason(group) || `选择 ${batch.label(group)}`" :checked="batch.isSelected(group)"
|
||||
:disabled="batch.disabled || !!batch.reason(group)" @change="batch.toggle(group)" />
|
||||
<template v-if="editingId === group.id">
|
||||
<input v-model="editingName" class="rename-input" type="text" aria-label="分类新名称" @keyup.enter="submitRename(group)" />
|
||||
<span class="row-actions">
|
||||
@@ -291,8 +316,8 @@ watch(totalPages, (pages) => {
|
||||
<span class="option-name" :title="group.name">{{ group.name }}</span>
|
||||
<span class="option-meta" title="该分类下的商品数">{{ group.productCount }}</span>
|
||||
<span v-if="editable" class="row-actions">
|
||||
<button class="btn btn-sm btn-secondary" type="button" :disabled="saving" @click="startRename(group)">改名</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" :disabled="saving" @click="removeGroup(group)">删除</button>
|
||||
<button class="btn btn-sm btn-secondary" type="button" :disabled="saving || batch.busy" @click="startRename(group)">改名</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" :disabled="saving || batch.busy" @click="removeGroup(group)">删除</button>
|
||||
</span>
|
||||
</template>
|
||||
</li>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
/** 日志管理页:桌面客户端 / 麦象采集机上报的日志浏览(仅超管)。
|
||||
* 支持来源/用户/日期筛选,尾部内容查看(自动滚到底、可向前加载更早内容)、
|
||||
* 完整下载、删除;「采集配置」可调全量/精选模式(全局默认 + 终端覆盖)。 */
|
||||
@@ -191,10 +194,23 @@ function loadMore() {
|
||||
loadContent(false)
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => rows.value,
|
||||
rowId: (row) => row.id,
|
||||
rowLabel: (row) => row.fileName,
|
||||
deleteOne: (id) => deleteDeviceLogFile(id),
|
||||
refresh: load,
|
||||
blocked: () => loading.value || !!loadFailure.value,
|
||||
scope: () => companyTab.activeId,
|
||||
consequence: '将删除所选云端日志,此操作不可恢复。',
|
||||
})
|
||||
|
||||
async function remove(row: DeviceLogFileRow) {
|
||||
if (batch.busy) return
|
||||
if (!(await openAdminConfirm({ message: `确认删除「${row.fileName}」(${row.deviceName || row.deviceId})的云端日志?删除后不可恢复。`, danger: true }))) return
|
||||
try {
|
||||
await deleteDeviceLogFile(row.id)
|
||||
batch.removeFromSelection(row.id)
|
||||
ElMessage.success('已删除')
|
||||
load()
|
||||
} catch (error) {
|
||||
@@ -339,10 +355,15 @@ onMounted(() => {
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="load" />
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="logs-table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th style="width: 110px">来源</th>
|
||||
<th style="width: 200px">用户</th>
|
||||
<th style="width: 230px">文件名</th>
|
||||
@@ -355,7 +376,11 @@ onMounted(() => {
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-if="rows.length">
|
||||
<tr v-for="row in rows" :key="row.id">
|
||||
<tr v-for="row in rows" :key="row.id" :class="{ 'batch-selected': batch.isSelected(row) }">
|
||||
<td class="batch-delete-cell">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row) || `选择 ${batch.label(row)}`" :checked="batch.isSelected(row)"
|
||||
:disabled="batch.disabled || !!batch.reason(row)" @change="batch.toggle(row)" />
|
||||
</td>
|
||||
<td>
|
||||
<span class="source-pill" :class="row.source === 'maixiang' ? 'is-maixiang' : 'is-client'">
|
||||
{{ sourceLabel(row.source) }}
|
||||
@@ -376,15 +401,15 @@ onMounted(() => {
|
||||
<td class="ops-cell">
|
||||
<button class="btn btn-sm" type="button" @click="openViewer(row)">查看</button>
|
||||
<a class="btn btn-sm btn-ghost dl-link" :href="deviceLogDownloadUrl(row.id)" download>下载</a>
|
||||
<button class="btn btn-sm btn-danger" type="button" @click="remove(row)">删除</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" :disabled="batch.busy" @click="remove(row)">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td colspan="8" class="empty-tip">加载中...</td>
|
||||
<td colspan="9" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td colspan="8" class="empty-tip">
|
||||
<td colspan="9" class="empty-tip">
|
||||
{{ sourceFilter || uidFilter ? '暂无匹配日志' : '暂无日志上报(客户端/采集机上报后自动出现在这里)' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
/** 数字人版本管理页 · 像素复刻旧版 admin.html panel-digital-human-version(自绘:面板头+上传、三态状态色、最新★、操作矩阵、数字页码分页)。
|
||||
* script 逻辑沿用现有 Vue 实现(确认文案/上传进度/下载取链接);确认走原生 confirm 对齐旧版。 */
|
||||
import { formatDateTime } from '@/utils/datetime'
|
||||
@@ -182,13 +185,25 @@ async function download(row: DigitalHumanVersion) {
|
||||
}
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => pagedItems.value,
|
||||
rowId: (row) => row.version,
|
||||
rowLabel: (row) => row.version,
|
||||
deleteOne: (id) => deleteDigitalHumanVersion(id),
|
||||
refresh: load,
|
||||
blocked: () => loading.value || confirming.value != null || !!loadFailure.value,
|
||||
precheck: (row) => canDelete(row) ? undefined : '不能删除当前最新版本',
|
||||
})
|
||||
|
||||
async function remove(row: DigitalHumanVersion) {
|
||||
if (batch.busy) return
|
||||
const text = digitalHumanDeleteConfirmText(row.version)
|
||||
if (!text) return
|
||||
if (!(await openAdminConfirm({ message: text, danger: true }))) return
|
||||
confirming.value = row.version
|
||||
try {
|
||||
await deleteDigitalHumanVersion(row.version)
|
||||
batch.removeFromSelection(row.version)
|
||||
ElMessage.success('删除成功')
|
||||
load()
|
||||
} catch (error) {
|
||||
@@ -221,10 +236,15 @@ onMounted(load)
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="load" />
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="table-scroll digital-human-version-table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th style="width: 80px">版本号</th>
|
||||
<th style="width: 60px">状态</th>
|
||||
<th style="width: 60px">最新</th>
|
||||
@@ -237,7 +257,11 @@ onMounted(load)
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-if="pagedItems.length">
|
||||
<tr v-for="row in pagedItems" :key="row.version + row.id">
|
||||
<tr v-for="row in pagedItems" :key="row.version + row.id" :class="{ 'batch-selected': batch.isSelected(row) }">
|
||||
<td class="batch-delete-cell">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row) || `选择 ${batch.label(row)}`" :checked="batch.isSelected(row)"
|
||||
:disabled="batch.disabled || !!batch.reason(row)" @change="batch.toggle(row)" />
|
||||
</td>
|
||||
<td><span class="mono-cell">{{ row.version }}</span></td>
|
||||
<td>
|
||||
<span class="st-pill" :class="`is-${statusOf(row).tag}`">{{ statusOf(row).text }}</span>
|
||||
@@ -261,15 +285,15 @@ onMounted(load)
|
||||
设为最新
|
||||
</button>
|
||||
<button v-if="canSetLatestDigitalHumanVersion(row.status)" class="btn btn-sm btn-secondary" type="button" :disabled="downloadingVersion === row.version" @click="download(row)">下载</button>
|
||||
<button v-if="canDelete(row)" class="btn btn-sm btn-danger" type="button" :disabled="confirming === row.version" @click="remove(row)">删除</button>
|
||||
<button v-if="canDelete(row)" class="btn btn-sm btn-danger" type="button" :disabled="batch.busy || confirming === row.version" @click="remove(row)">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td colspan="8" class="empty-tip">加载中...</td>
|
||||
<td colspan="9" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td colspan="8" class="empty-tip">{{ versionKeyword ? '暂无匹配版本' : '暂无版本记录' }}</td>
|
||||
<td colspan="9" class="empty-tip">{{ versionKeyword ? '暂无匹配版本' : '暂无版本记录' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
import { createLatestRequestGate } from '@/utils/latest-request'
|
||||
import { formatDateTime } from '@/utils/datetime'
|
||||
/** 店铺密钥管理页 · 像素复刻旧版 admin.html panel-shop-keys(自绘:面板头+新增店铺密钥、序号列、令牌掩码、白名单状态药丸+悬停详情、旧式分页)。
|
||||
* script 逻辑沿用现有 Vue 实现(编辑留空令牌=沿用);弹窗保留现有组件。 */
|
||||
@@ -57,7 +61,10 @@ function whitelistTooltip(row: ShopKeyItem): string {
|
||||
return parts.join('\n')
|
||||
}
|
||||
|
||||
const batchListGate = createLatestRequestGate()
|
||||
|
||||
async function load() {
|
||||
const token = batchListGate.begin()
|
||||
loading.value = true
|
||||
loadFailure.value = ''
|
||||
try {
|
||||
@@ -69,14 +76,16 @@ async function load() {
|
||||
whitelistStatus: filter.whitelistStatus || undefined,
|
||||
companyId: companyTab.requestCompanyId,
|
||||
})
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
rows.value = result.items
|
||||
total.value = result.total
|
||||
page.value = result.page
|
||||
} catch (error) {
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
loadFailure.value = error instanceof Error ? error.message : '密钥列表加载失败'
|
||||
showAdminFeedback(loadFailure.value, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (batchListGate.isCurrent(token)) loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,11 +160,23 @@ async function submit() {
|
||||
}
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => rows.value,
|
||||
rowId: (row) => row.id,
|
||||
rowLabel: (row) => row.ziniaoAccountName,
|
||||
deleteOne: (id) => deleteShopKey(id),
|
||||
refresh: load,
|
||||
blocked: () => loading.value || !!loadFailure.value,
|
||||
scope: () => companyTab.activeId,
|
||||
})
|
||||
|
||||
async function remove(row: ShopKeyItem) {
|
||||
if (batch.busy) return
|
||||
// 对齐旧版:原生 confirm。
|
||||
if (!(await openAdminConfirm({ message: `确定删除店铺密钥“${row.ziniaoAccountName}”吗?`, danger: true }))) return
|
||||
try {
|
||||
await deleteShopKey(row.id)
|
||||
batch.removeFromSelection(row.id)
|
||||
ElMessage.success('已删除')
|
||||
load()
|
||||
} catch (error) {
|
||||
@@ -226,12 +247,17 @@ onMounted(load)
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="load" />
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="shop-key-table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<!-- 刚性列(序号/两个时间/操作)给准 px,文本列收到"能 ellipsis 但不白占"的宽度:
|
||||
原来 1538px 在 ~1280 的内容区里放不下,"操作"整列要横向滚动才看得见。 -->
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th style="width: 52px">序号</th>
|
||||
<th style="width: 110px">备注名</th>
|
||||
<th style="width: 140px">紫鸟账号名称</th>
|
||||
@@ -245,7 +271,11 @@ onMounted(load)
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-if="rows.length">
|
||||
<tr v-for="(row, index) in rows" :key="row.id">
|
||||
<tr v-for="(row, index) in rows" :key="row.id" :class="{ 'batch-selected': batch.isSelected(row) }">
|
||||
<td class="batch-delete-cell">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row) || `选择 ${batch.label(row)}`" :checked="batch.isSelected(row)"
|
||||
:disabled="batch.disabled || !!batch.reason(row)" @change="batch.toggle(row)" />
|
||||
</td>
|
||||
<td>{{ (page - 1) * pageSize + index + 1 }}</td>
|
||||
<td>{{ row.remarkName || '—' }}</td>
|
||||
<td>{{ row.ziniaoAccountName }}</td>
|
||||
@@ -280,15 +310,15 @@ onMounted(load)
|
||||
>
|
||||
{{ checkingId === row.id ? '检测中…' : '检测白名单' }}
|
||||
</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" @click="remove(row)">删除</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" :disabled="batch.busy" @click="remove(row)">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td colspan="9" class="empty-tip">加载中...</td>
|
||||
<td colspan="10" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td colspan="9" class="empty-tip">{{ anyFilterActive ? '暂无匹配密钥' : '暂无店铺密钥' }}</td>
|
||||
<td colspan="10" class="empty-tip">{{ anyFilterActive ? '暂无匹配密钥' : '暂无店铺密钥' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
import { createLatestRequestGate } from '@/utils/latest-request'
|
||||
import { formatDateTime } from '@/utils/datetime'
|
||||
/** 店铺管理页 · 像素复刻旧版 admin.html panel-shop-manage(自绘:面板头+新增店铺、筛选、密码列 ******+眼睛实时读明文、旧式表格/分页、原生 confirm 删除)。
|
||||
* script 逻辑沿用现有 Vue 实现(凭证明文 dialog/编辑弹窗/分组筛选)。 */
|
||||
@@ -87,7 +91,10 @@ async function loadGroups() {
|
||||
}
|
||||
}
|
||||
|
||||
const batchListGate = createLatestRequestGate()
|
||||
|
||||
async function load() {
|
||||
const token = batchListGate.begin()
|
||||
loading.value = true
|
||||
loadFailure.value = ''
|
||||
try {
|
||||
@@ -98,14 +105,16 @@ async function load() {
|
||||
shopName: filter.shopName.trim() || undefined,
|
||||
companyId: companyTab.requestCompanyId,
|
||||
})
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
rows.value = result.items
|
||||
total.value = result.total
|
||||
page.value = result.page
|
||||
} catch (error) {
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
loadFailure.value = error instanceof Error ? error.message : '店铺列表加载失败'
|
||||
showAdminFeedback(loadFailure.value, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (batchListGate.isCurrent(token)) loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,11 +208,23 @@ async function showCredential(row: ShopSummary) {
|
||||
}
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => rows.value,
|
||||
rowId: (row) => row.id,
|
||||
rowLabel: (row) => row.shopName,
|
||||
deleteOne: (id) => deleteShopManage(id),
|
||||
refresh: load,
|
||||
blocked: () => loading.value || !!loadFailure.value,
|
||||
scope: () => companyTab.activeId,
|
||||
})
|
||||
|
||||
async function remove(row: ShopSummary) {
|
||||
if (batch.busy) return
|
||||
// 对齐旧版:原生 confirm。
|
||||
if (!(await openAdminConfirm({ message: `确定删除店铺“${row.shopName}”吗?`, danger: true }))) return
|
||||
try {
|
||||
await deleteShopManage(row.id)
|
||||
batch.removeFromSelection(row.id)
|
||||
ElMessage.success('已删除')
|
||||
load()
|
||||
} catch (error) {
|
||||
@@ -249,10 +270,15 @@ onMounted(() => {
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="load" />
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="table-scroll shop-manage-table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th style="width: 58px">序号</th>
|
||||
<th v-if="isSuperAdmin" style="width: 120px">分组</th>
|
||||
<th style="width: 150px">店铺名</th>
|
||||
@@ -267,7 +293,11 @@ onMounted(() => {
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-if="rows.length">
|
||||
<tr v-for="(row, index) in rows" :key="row.id">
|
||||
<tr v-for="(row, index) in rows" :key="row.id" :class="{ 'batch-selected': batch.isSelected(row) }">
|
||||
<td class="batch-delete-cell">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row) || `选择 ${batch.label(row)}`" :checked="batch.isSelected(row)"
|
||||
:disabled="batch.disabled || !!batch.reason(row)" @change="batch.toggle(row)" />
|
||||
</td>
|
||||
<td>{{ (page - 1) * pageSize + index + 1 }}</td>
|
||||
<td v-if="isSuperAdmin" data-text :title="row.groupName || '—'">{{ row.groupName || '—' }}</td>
|
||||
<td :title="row.shopName">{{ row.shopName }}</td>
|
||||
@@ -290,15 +320,15 @@ onMounted(() => {
|
||||
<td class="ops-cell">
|
||||
<button class="btn btn-sm" type="button" @click="openEdit(row)">编辑</button>
|
||||
<button class="btn btn-sm btn-secondary" type="button" @click="showCredential(row)">凭证</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" @click="remove(row)">删除</button>
|
||||
<button class="btn btn-sm btn-danger" type="button" :disabled="batch.busy" @click="remove(row)">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td :colspan="isSuperAdmin ? 10 : 9" class="empty-tip">加载中...</td>
|
||||
<td :colspan="isSuperAdmin ? 11 : 10" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td :colspan="isSuperAdmin ? 10 : 9" class="empty-tip">暂无店铺</td>
|
||||
<td :colspan="isSuperAdmin ? 11 : 10" class="empty-tip">暂无店铺</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
/**
|
||||
* 品牌Gating库管理页(独立菜单 admin_brand_gating,V174 恢复)。
|
||||
* 数据源 /api/admin/brand-gating(biz_brand_gating,全平台共享,不随公司 Tab 收窄)。
|
||||
@@ -191,7 +194,18 @@ async function toggleStatus(row: BrandGatingRow): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => rows.value,
|
||||
rowId: (row) => row.id,
|
||||
rowLabel: (row) => row.brand || `ID ${row.id}`,
|
||||
deleteOne: (id) => deleteBrandGating(id),
|
||||
refresh: () => Promise.all([loadPage(), loadStats()]),
|
||||
blocked: () => pageLoading.value || busyRowId.value !== 0 || !!loadError.value,
|
||||
consequence: '删除后可能影响已有数据,此操作不可恢复。',
|
||||
})
|
||||
|
||||
async function removeRow(row: BrandGatingRow): Promise<void> {
|
||||
if (batch.busy) return
|
||||
const confirmed = await openAdminConfirm({ danger: true,
|
||||
targetName: row.brand,
|
||||
message: `确认删除 ID=${row.id} 的「${row.brand}」Gating记录?此操作可能影响已有数据。`,
|
||||
@@ -200,6 +214,7 @@ async function removeRow(row: BrandGatingRow): Promise<void> {
|
||||
busyRowId.value = row.id
|
||||
try {
|
||||
await deleteBrandGating(row.id)
|
||||
batch.removeFromSelection(row.id)
|
||||
feedback('已删除', 'success')
|
||||
const nextPage = rows.value.length === 1 && page.value > 1 ? page.value - 1 : page.value
|
||||
await Promise.all([loadPage(nextPage), loadStats()])
|
||||
@@ -328,10 +343,15 @@ onMounted(() => {
|
||||
|
||||
<LoadFailureBar v-if="loadError" :message="loadError" @retry="loadPage()" />
|
||||
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
<div class="g-table-wrap" v-loading="pageLoading">
|
||||
<table v-if="rows.length" class="g-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="batch-delete-cell" scope="col">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
</th>
|
||||
<th style="width: 64px">ID</th>
|
||||
<th>品牌</th>
|
||||
<th>ASIN</th>
|
||||
@@ -346,7 +366,11 @@ onMounted(() => {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="row in rows" :key="row.id">
|
||||
<tr v-for="row in rows" :key="row.id" :class="{ 'batch-selected': batch.isSelected(row) }">
|
||||
<td class="batch-delete-cell">
|
||||
<BatchDeleteCheckbox :label="batch.reason(row) || `选择 ${batch.label(row)}`" :checked="batch.isSelected(row)"
|
||||
:disabled="batch.disabled || !!batch.reason(row)" @change="batch.toggle(row)" />
|
||||
</td>
|
||||
<td class="g-dim">{{ row.id }}</td>
|
||||
<td class="g-strong">{{ row.brand }}</td>
|
||||
<td class="g-mono">{{ row.asin || '—' }}</td>
|
||||
@@ -375,7 +399,7 @@ onMounted(() => {
|
||||
<button
|
||||
class="g-btn g-btn-sm g-btn-danger"
|
||||
type="button"
|
||||
:disabled="busyRowId === row.id"
|
||||
:disabled="batch.busy || busyRowId === row.id"
|
||||
@click="removeRow(row)"
|
||||
>
|
||||
删除
|
||||
|
||||
@@ -0,0 +1,349 @@
|
||||
/* 像素复刻旧版 admin.html panel-shop-data-crawl-tasks(蓝白末层)。 */
|
||||
.sd-view {
|
||||
font-family: inherit;
|
||||
color: #24384d;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
}
|
||||
.form-box,
|
||||
.panel-box {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 20px 22px 24px;
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
}
|
||||
h3 {
|
||||
margin: 0 0 14px;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: #24384d;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.sd-filter-title {
|
||||
margin: 0 0 14px;
|
||||
font-size: 13.5px;
|
||||
font-weight: 600;
|
||||
color: #40586e;
|
||||
}
|
||||
.form-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
gap: 14px 18px;
|
||||
}
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-group label {
|
||||
color: #5b6f83;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.form-group input {
|
||||
min-width: 0;
|
||||
min-height: 42px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13.5px;
|
||||
font-family: inherit;
|
||||
color-scheme: light;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.form-group input:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.form-group input:focus {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||||
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
|
||||
}
|
||||
.btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||||
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
|
||||
}
|
||||
.btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.55;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
border-color: #c7d7e5;
|
||||
}
|
||||
.btn-secondary:hover:not(:disabled) {
|
||||
color: #2f5d8b;
|
||||
border-color: #95b1cb;
|
||||
background: #edf5fb;
|
||||
}
|
||||
.btn-danger {
|
||||
background: linear-gradient(135deg, #c06d77, #b35f6a);
|
||||
border-color: #b35f6a;
|
||||
}
|
||||
.btn-danger:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #cb7c84, #b96570);
|
||||
}
|
||||
.btn-sm {
|
||||
min-height: 36px;
|
||||
padding: 7px 12px;
|
||||
}
|
||||
.sd-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.sd-toolbar-main {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.sd-toolbar-side {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.sd-select-all {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
font-size: 13px;
|
||||
color: #5b6f83;
|
||||
cursor: pointer;
|
||||
}
|
||||
.sd-summary {
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sd-shop-pager {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
color: #5b6f83;
|
||||
}
|
||||
.sd-shop-pager button,
|
||||
.pagination button,
|
||||
.jump-btn {
|
||||
min-height: 30px;
|
||||
padding: 4px 12px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.sd-shop-pager button:hover:not(:disabled),
|
||||
.pagination button:hover:not(:disabled) {
|
||||
background: #edf5fb;
|
||||
border-color: #95b1cb;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.sd-shop-pager button:disabled,
|
||||
.pagination button:disabled {
|
||||
background: #eef3f7;
|
||||
color: #9baaba;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.sd-shop-pager input,
|
||||
.page-jump input {
|
||||
width: 52px;
|
||||
min-height: 30px;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 8px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.shop-card-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 14px;
|
||||
}
|
||||
.sd-card {
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 12px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
overflow: hidden;
|
||||
}
|
||||
.sd-card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid #e6edf4;
|
||||
}
|
||||
.sd-shop-name {
|
||||
font-weight: 600;
|
||||
color: #24384d;
|
||||
}
|
||||
.sd-card-select-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px 16px 0;
|
||||
}
|
||||
.shop-card-task-no {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
font-weight: 600;
|
||||
font-size: 12px;
|
||||
color: #24384d;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sd-card-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
padding: 6px 16px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.sd-card-label {
|
||||
flex: none;
|
||||
width: 52px;
|
||||
color: #8293a5;
|
||||
}
|
||||
.sd-card-value {
|
||||
color: #40586e;
|
||||
min-width: 0;
|
||||
}
|
||||
.sd-card-file {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.sd-card-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
padding: 6px 16px 14px;
|
||||
}
|
||||
.st-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
line-height: 1.7;
|
||||
border: 1px solid transparent;
|
||||
white-space: nowrap;
|
||||
flex: none;
|
||||
}
|
||||
.st-pill.is-success {
|
||||
color: #3d7158;
|
||||
background: #e8f2eb;
|
||||
border-color: #bdd7c5;
|
||||
}
|
||||
.st-pill.is-failed {
|
||||
color: #91474f;
|
||||
background: #f8ebeb;
|
||||
border-color: #e4c2c5;
|
||||
}
|
||||
.st-pill.is-cancelled {
|
||||
color: #5b6f83;
|
||||
background: #f1f6fa;
|
||||
border-color: #d6e2ec;
|
||||
}
|
||||
.st-pill.is-pending,
|
||||
.st-pill.is-running {
|
||||
color: #8a6d3b;
|
||||
background: #fbf4ea;
|
||||
border-color: #e7d3ae;
|
||||
}
|
||||
.country-chip {
|
||||
padding: 1px 8px;
|
||||
margin-right: 4px;
|
||||
border-radius: 999px;
|
||||
background: #eef4fa;
|
||||
color: #40586e;
|
||||
font-size: 12px;
|
||||
}
|
||||
.dim {
|
||||
color: #8293a5;
|
||||
font-size: 12px;
|
||||
}
|
||||
.sd-progress-hint {
|
||||
margin: 10px 0 0;
|
||||
text-align: center;
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
}
|
||||
.empty-tip {
|
||||
grid-column: 1 / -1;
|
||||
padding: 44px 24px;
|
||||
text-align: center;
|
||||
color: #8293a5;
|
||||
font-size: 13.5px;
|
||||
}
|
||||
.pagination {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 18px;
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
}
|
||||
.page-total {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.page-jump {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
@media (max-width: 1400px) {
|
||||
.shop-card-grid {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
}
|
||||
@media (max-width: 1100px) {
|
||||
.shop-card-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
@media (max-width: 760px) {
|
||||
.shop-card-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import BatchDeleteActions from '@/components/BatchDeleteActions.vue'
|
||||
import BatchDeleteCheckbox from '@/components/BatchDeleteCheckbox.vue'
|
||||
import { useRowSelection } from '@/utils/use-row-selection'
|
||||
import { createLatestRequestGate } from '@/utils/latest-request'
|
||||
import { formatDateTime, orderedPair } from '@/utils/datetime'
|
||||
/** 店铺数据记录页 · 像素复刻旧版 admin.html panel-shop-data-crawl-tasks(自绘:form-box 筛选[h4 筛选条件] + panel-box toolbar[全选/批量下载/权限配置/汇总] + 每店卡片网格 + 旧式分页(店铺级+卡片级 9/页))。
|
||||
* script 逻辑沿用现有 Vue 实现(批量打包/删除结果文件[保留]/权限授权)。 */
|
||||
@@ -129,19 +133,24 @@ function toFilter(): ShopDataFilter {
|
||||
}
|
||||
}
|
||||
|
||||
const batchListGate = createLatestRequestGate()
|
||||
|
||||
async function load() {
|
||||
const token = batchListGate.begin()
|
||||
loading.value = true
|
||||
loadFailure.value = ''
|
||||
try {
|
||||
const result = await fetchShopDataTaskList(toFilter(), page.value, pageSize.value, companyTab.requestCompanyId)
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
groups.value = result.items
|
||||
totalShops.value = result.total
|
||||
page.value = result.page
|
||||
} catch (error) {
|
||||
if (!batchListGate.isCurrent(token)) return
|
||||
loadFailure.value = error instanceof Error ? error.message : '店铺数据记录加载失败'
|
||||
showAdminFeedback(loadFailure.value, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
if (batchListGate.isCurrent(token)) loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,12 +265,26 @@ async function downloadBatch() {
|
||||
}
|
||||
}
|
||||
|
||||
const batch = useRowSelection({
|
||||
pageRows: () => pagedResultRows.value,
|
||||
rowId: (row) => row.resultId,
|
||||
rowLabel: (row) => `${row.shopName || '店铺'}(${row.filename || row.taskNo || row.resultId})`,
|
||||
deleteOne: (id) => deleteShopDataResultHistory(id),
|
||||
refresh: load,
|
||||
blocked: () => loading.value || !!loadFailure.value || !!deletingKey.value,
|
||||
scope: () => companyTab.activeId,
|
||||
precheck: (row) => isTerminalStatus(row.status) && row.resultId ? undefined : '仅终态数据记录可删除',
|
||||
consequence: '店铺数据文件及对应记录将一起删除,此操作不可恢复。',
|
||||
})
|
||||
|
||||
async function removeRowByRow(row: ShopDataResultRow) {
|
||||
if (batch.busy) return
|
||||
// 管理端真删:删除该店这条店铺数据记录(累计档 + 文件 + 明细),前台任务记录仍保留但文件不可再下载
|
||||
if (!(await openAdminConfirm({ message: `确认删除店铺“${row.shopName}”这条店铺数据记录及其数据文件?此操作不可恢复。`, danger: true }))) return
|
||||
deletingKey.value = row.resultId
|
||||
try {
|
||||
await deleteShopDataResultHistory(row.resultId)
|
||||
batch.removeFromSelection(row.resultId)
|
||||
ElMessage.success('删除成功')
|
||||
await load()
|
||||
} catch (error) {
|
||||
@@ -371,14 +394,25 @@ onMounted(load)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sd-toolbar">
|
||||
<label class="sd-select-all">
|
||||
<BatchDeleteCheckbox label="全选当前页可删除记录" :checked="batch.pageAll" :partial="batch.pageSome"
|
||||
:disabled="batch.disabled || batch.pageEmpty" @change="batch.togglePage" />
|
||||
全选本页可删除记录
|
||||
</label>
|
||||
<BatchDeleteActions :batch="batch" />
|
||||
</div>
|
||||
<div v-loading="loading" class="shop-card-grid">
|
||||
<template v-if="allResultRows.length">
|
||||
<article
|
||||
v-for="row in pagedResultRows"
|
||||
:key="row.resultId || `${row.taskNo}-${row.filename}`"
|
||||
class="sd-card"
|
||||
:class="{ 'batch-selected': batch.isSelected(row) }"
|
||||
>
|
||||
<header class="sd-card-head">
|
||||
<BatchDeleteCheckbox v-if="!batch.reason(row)" :label="batch.reason(row) || `选择 ${batch.label(row)}`" :checked="batch.isSelected(row)"
|
||||
:disabled="batch.disabled || !!batch.reason(row)" @change="batch.toggle(row)" />
|
||||
<span class="sd-shop-name" :title="row.shopName || '-'">{{ row.shopName || '-' }}</span>
|
||||
</header>
|
||||
<div class="sd-card-select-row">
|
||||
@@ -418,7 +452,7 @@ onMounted(load)
|
||||
v-if="isTerminalStatus(row.status) && !!row.resultId"
|
||||
class="btn btn-sm btn-danger"
|
||||
type="button"
|
||||
:disabled="deletingKey === row.resultId"
|
||||
:disabled="batch.busy || deletingKey === row.resultId"
|
||||
@click="removeRowByRow(row)"
|
||||
>
|
||||
{{ deletingKey === row.resultId ? '删除中...' : '删除' }}
|
||||
@@ -462,354 +496,4 @@ onMounted(load)
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 像素复刻旧版 admin.html panel-shop-data-crawl-tasks(蓝白末层)。 */
|
||||
.sd-view {
|
||||
font-family: inherit;
|
||||
color: #24384d;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
}
|
||||
.form-box,
|
||||
.panel-box {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 20px 22px 24px;
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
}
|
||||
h3 {
|
||||
margin: 0 0 14px;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: #24384d;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.sd-filter-title {
|
||||
margin: 0 0 14px;
|
||||
font-size: 13.5px;
|
||||
font-weight: 600;
|
||||
color: #40586e;
|
||||
}
|
||||
.form-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
gap: 14px 18px;
|
||||
}
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-group label {
|
||||
color: #5b6f83;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.form-group input {
|
||||
min-width: 0;
|
||||
min-height: 42px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13.5px;
|
||||
font-family: inherit;
|
||||
color-scheme: light;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.form-group input:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.form-group input:focus {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||||
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
|
||||
}
|
||||
.btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||||
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
|
||||
}
|
||||
.btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.55;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
border-color: #c7d7e5;
|
||||
}
|
||||
.btn-secondary:hover:not(:disabled) {
|
||||
color: #2f5d8b;
|
||||
border-color: #95b1cb;
|
||||
background: #edf5fb;
|
||||
}
|
||||
.btn-danger {
|
||||
background: linear-gradient(135deg, #c06d77, #b35f6a);
|
||||
border-color: #b35f6a;
|
||||
}
|
||||
.btn-danger:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #cb7c84, #b96570);
|
||||
}
|
||||
.btn-sm {
|
||||
min-height: 36px;
|
||||
padding: 7px 12px;
|
||||
}
|
||||
.sd-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.sd-toolbar-main {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.sd-toolbar-side {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.sd-select-all {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
font-size: 13px;
|
||||
color: #5b6f83;
|
||||
cursor: pointer;
|
||||
}
|
||||
.sd-summary {
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sd-shop-pager {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
color: #5b6f83;
|
||||
}
|
||||
.sd-shop-pager button,
|
||||
.pagination button,
|
||||
.jump-btn {
|
||||
min-height: 30px;
|
||||
padding: 4px 12px;
|
||||
border: 1px solid #c7d7e5;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: #5b6f83;
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.sd-shop-pager button:hover:not(:disabled),
|
||||
.pagination button:hover:not(:disabled) {
|
||||
background: #edf5fb;
|
||||
border-color: #95b1cb;
|
||||
color: #2f5d8b;
|
||||
}
|
||||
.sd-shop-pager button:disabled,
|
||||
.pagination button:disabled {
|
||||
background: #eef3f7;
|
||||
color: #9baaba;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.sd-shop-pager input,
|
||||
.page-jump input {
|
||||
width: 52px;
|
||||
min-height: 30px;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 8px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13px;
|
||||
font-family: inherit;
|
||||
}
|
||||
.shop-card-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 14px;
|
||||
}
|
||||
.sd-card {
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 12px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
overflow: hidden;
|
||||
}
|
||||
.sd-card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid #e6edf4;
|
||||
}
|
||||
.sd-shop-name {
|
||||
font-weight: 600;
|
||||
color: #24384d;
|
||||
}
|
||||
.sd-card-select-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px 16px 0;
|
||||
}
|
||||
.shop-card-task-no {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
font-weight: 600;
|
||||
font-size: 12px;
|
||||
color: #24384d;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sd-card-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
padding: 6px 16px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.sd-card-label {
|
||||
flex: none;
|
||||
width: 52px;
|
||||
color: #8293a5;
|
||||
}
|
||||
.sd-card-value {
|
||||
color: #40586e;
|
||||
min-width: 0;
|
||||
}
|
||||
.sd-card-file {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.sd-card-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
padding: 6px 16px 14px;
|
||||
}
|
||||
.st-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
line-height: 1.7;
|
||||
border: 1px solid transparent;
|
||||
white-space: nowrap;
|
||||
flex: none;
|
||||
}
|
||||
.st-pill.is-success {
|
||||
color: #3d7158;
|
||||
background: #e8f2eb;
|
||||
border-color: #bdd7c5;
|
||||
}
|
||||
.st-pill.is-failed {
|
||||
color: #91474f;
|
||||
background: #f8ebeb;
|
||||
border-color: #e4c2c5;
|
||||
}
|
||||
.st-pill.is-cancelled {
|
||||
color: #5b6f83;
|
||||
background: #f1f6fa;
|
||||
border-color: #d6e2ec;
|
||||
}
|
||||
.st-pill.is-pending,
|
||||
.st-pill.is-running {
|
||||
color: #8a6d3b;
|
||||
background: #fbf4ea;
|
||||
border-color: #e7d3ae;
|
||||
}
|
||||
.country-chip {
|
||||
padding: 1px 8px;
|
||||
margin-right: 4px;
|
||||
border-radius: 999px;
|
||||
background: #eef4fa;
|
||||
color: #40586e;
|
||||
font-size: 12px;
|
||||
}
|
||||
.dim {
|
||||
color: #8293a5;
|
||||
font-size: 12px;
|
||||
}
|
||||
.sd-progress-hint {
|
||||
margin: 10px 0 0;
|
||||
text-align: center;
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
}
|
||||
.empty-tip {
|
||||
grid-column: 1 / -1;
|
||||
padding: 44px 24px;
|
||||
text-align: center;
|
||||
color: #8293a5;
|
||||
font-size: 13.5px;
|
||||
}
|
||||
.pagination {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 18px;
|
||||
color: #5b6f83;
|
||||
font-size: 13px;
|
||||
}
|
||||
.page-total {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.page-jump {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
@media (max-width: 1400px) {
|
||||
.shop-card-grid {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
}
|
||||
@media (max-width: 1100px) {
|
||||
.shop-card-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
@media (max-width: 760px) {
|
||||
.shop-card-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style scoped src="./ShopDataTasksPage.css"></style>
|
||||
|
||||
@@ -291,3 +291,8 @@ button, input, textarea, select { font: inherit; }
|
||||
.admin-user-role { display: none; }
|
||||
.admin-shell .admin-content :is(.clean-filter-row, .dedupe-filter-row, .jd-filter-row) > .form-group { max-width: 100%; }
|
||||
}
|
||||
|
||||
/* 自绘表格的批量选择列保持窄列,不挤占数据列。 */
|
||||
.admin-shell table :is(th, td).batch-delete-cell { width: 38px; text-align: center; padding-inline: 4px; }
|
||||
.admin-shell table tbody tr.batch-selected > td { background: #fdf0ee; }
|
||||
.admin-shell .batch-selected:is(.sd-card, .option-row) { background: #fdf0ee; }
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import { failureDetail } from '../components/load-failure-model.ts'
|
||||
|
||||
type RowId = number | string
|
||||
interface BatchRow<Id extends RowId> { id: Id; label: string }
|
||||
|
||||
export interface BatchDeleteResult<Id extends RowId> {
|
||||
deleted: Id[]
|
||||
failures: Array<BatchRow<Id> & { reason: string }>
|
||||
remaining: number
|
||||
}
|
||||
|
||||
export function togglePageSelection<Id extends RowId, Row extends BatchRow<Id>>(
|
||||
selected: ReadonlyMap<Id, Row>, rows: readonly Row[],
|
||||
): Map<Id, Row> {
|
||||
const next = new Map(selected)
|
||||
if (rows.every(({ id }) => next.has(id))) {
|
||||
rows.forEach(({ id }) => next.delete(id))
|
||||
} else {
|
||||
rows.forEach((row) => next.set(row.id, row))
|
||||
}
|
||||
return next
|
||||
}
|
||||
|
||||
export async function runBatchDelete<Id extends RowId, Row extends BatchRow<Id>>(options: {
|
||||
rows: readonly Row[]
|
||||
deleteOne: (row: Row) => Promise<unknown>
|
||||
precheck?: (row: Row) => string | undefined
|
||||
isCurrent?: () => boolean
|
||||
onProgress?: (processed: number) => void
|
||||
}): Promise<BatchDeleteResult<Id>> {
|
||||
const { deleteOne, isCurrent, onProgress, precheck } = options
|
||||
const rows = [...new Map(options.rows.map((row) => [row.id, row])).values()]
|
||||
const deleted: Id[] = []
|
||||
const failures: BatchDeleteResult<Id>['failures'] = []
|
||||
let processed = 0
|
||||
for (const row of rows) {
|
||||
if (isCurrent && !isCurrent()) break
|
||||
try {
|
||||
const reason = precheck?.(row)
|
||||
if (reason) failures.push({ id: row.id, label: row.label, reason })
|
||||
else {
|
||||
await deleteOne(row)
|
||||
deleted.push(row.id)
|
||||
}
|
||||
} catch (error) {
|
||||
failures.push({ id: row.id, label: row.label, reason: failureDetail(error) || '删除请求失败' })
|
||||
}
|
||||
processed++
|
||||
onProgress?.(processed)
|
||||
}
|
||||
return { deleted, failures, remaining: rows.length - processed }
|
||||
}
|
||||
|
||||
export function batchResultMessage(result: BatchDeleteResult<RowId>, verb = '删除', detailLimit = Infinity): string {
|
||||
const counts = [`已${verb} ${result.deleted.length} 条`]
|
||||
if (result.failures.length) counts.push(`失败 ${result.failures.length} 条`)
|
||||
if (result.remaining) counts.push(`未处理 ${result.remaining} 条`)
|
||||
const details = result.failures.slice(0, detailLimit).map(({ label, reason }) => `${label}(${reason})`)
|
||||
if (details.length && details.length < result.failures.length) details.push('其余原因见列表上方')
|
||||
return counts.join(',') + (details.length ? `:${details.join(';')}` : '')
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
import { computed, onScopeDispose, reactive, ref, shallowRef, watch } from 'vue'
|
||||
import { openAdminConfirm } from '@/components/admin-confirm'
|
||||
import { showAdminFeedback } from '@/components/admin-feedback-ui'
|
||||
import { batchResultMessage, runBatchDelete, togglePageSelection, type BatchDeleteResult } from './batch-delete'
|
||||
|
||||
type RowId = number | string
|
||||
|
||||
export function useRowSelection<Row, Id extends RowId>(options: {
|
||||
pageRows: () => readonly Row[]
|
||||
rowId: (row: Row) => Id
|
||||
rowLabel: (row: Row) => string
|
||||
deleteOne: (id: Id, row: Row, isCurrent: () => boolean) => Promise<unknown>
|
||||
refresh: (result: BatchDeleteResult<Id>) => unknown
|
||||
scope?: () => unknown
|
||||
blocked?: () => boolean
|
||||
precheck?: (row: Row) => string | undefined
|
||||
consequence?: string
|
||||
verb?: string
|
||||
}) {
|
||||
type Item = { id: Id; label: string; row: Row }
|
||||
const selected = shallowRef(new Map<Id, Item>())
|
||||
const busy = ref(false)
|
||||
const progress = ref('')
|
||||
const result = shallowRef<BatchDeleteResult<Id> | null>(null)
|
||||
const disabled = computed(() => busy.value || Boolean(options.blocked?.()))
|
||||
const pageItems = computed(() => options.pageRows().filter((row) => !options.precheck?.(row)).map(itemOf))
|
||||
const pageAll = computed(() => pageItems.value.length > 0 && pageItems.value.every(({ id }) => selected.value.has(id)))
|
||||
const pageSome = computed(() => !pageAll.value && pageItems.value.some(({ id }) => selected.value.has(id)))
|
||||
const verb = options.verb ?? '删除'
|
||||
let generation = 0
|
||||
|
||||
function itemOf(row: Row): Item {
|
||||
return { id: options.rowId(row), label: options.rowLabel(row), row }
|
||||
}
|
||||
|
||||
function clearSelection() {
|
||||
generation++
|
||||
selected.value = new Map()
|
||||
result.value = null
|
||||
}
|
||||
|
||||
if (options.scope) watch(options.scope, clearSelection, { flush: 'sync' })
|
||||
onScopeDispose(clearSelection)
|
||||
|
||||
function removeFromSelection(id: Id) {
|
||||
const next = new Map(selected.value)
|
||||
next.delete(id)
|
||||
selected.value = next
|
||||
}
|
||||
|
||||
function toggle(row: Row) {
|
||||
if (disabled.value || options.precheck?.(row)) return
|
||||
selected.value = togglePageSelection(selected.value, [itemOf(row)])
|
||||
}
|
||||
|
||||
function togglePage() {
|
||||
if (disabled.value) return
|
||||
selected.value = togglePageSelection(selected.value, pageItems.value)
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
if (disabled.value || !selected.value.size) return
|
||||
const current = generation
|
||||
const isCurrent = () => current === generation
|
||||
const items = [...selected.value.values()]
|
||||
const names = items.slice(0, 3).map(({ label }) => label).join('、')
|
||||
const sample = items.length > 3 ? `${names}等` : names
|
||||
busy.value = true
|
||||
try {
|
||||
const confirmed = await openAdminConfirm({ danger: true,
|
||||
title: `批量${verb}`,
|
||||
confirmText: `确认${verb}`,
|
||||
message: `确定${verb}选中的 ${items.length} 条记录(${sample})吗?${options.consequence ?? '此操作不可恢复。'}`,
|
||||
})
|
||||
if (!confirmed || !isCurrent() || options.blocked?.()) return
|
||||
result.value = null
|
||||
progress.value = `0/${items.length}`
|
||||
const outcome = await runBatchDelete<Id, Item>({
|
||||
rows: items,
|
||||
precheck: ({ row }) => options.precheck?.(row),
|
||||
deleteOne: ({ id, row }) => options.deleteOne(id, row, isCurrent),
|
||||
isCurrent,
|
||||
onProgress: (done) => { progress.value = `${done}/${items.length}` },
|
||||
})
|
||||
if (isCurrent()) {
|
||||
const next = new Map(selected.value)
|
||||
outcome.deleted.forEach((id) => next.delete(id))
|
||||
selected.value = next
|
||||
result.value = outcome.failures.length ? outcome : null
|
||||
}
|
||||
showAdminFeedback(batchResultMessage(outcome, verb, isCurrent() ? 3 : Infinity),
|
||||
outcome.failures.length || outcome.remaining ? 'error' : 'success')
|
||||
if (isCurrent() && (outcome.deleted.length || outcome.failures.length)) await options.refresh(outcome)
|
||||
} finally {
|
||||
busy.value = false
|
||||
progress.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
return reactive({
|
||||
busy, disabled, progress, result, verb, pageAll, pageSome,
|
||||
count: computed(() => selected.value.size),
|
||||
pageEmpty: computed(() => !pageItems.value.length),
|
||||
isSelected: (row: Row) => selected.value.has(options.rowId(row)),
|
||||
reason: (row: Row) => options.precheck?.(row),
|
||||
label: options.rowLabel,
|
||||
toggle, togglePage, submit, clearSelection, removeFromSelection,
|
||||
})
|
||||
}
|
||||
@@ -41,7 +41,7 @@ test('align_product_category_row_buttons_old_btn', () => {
|
||||
})
|
||||
|
||||
test('align_product_category_no_indigo_left', () => {
|
||||
const s = readSource('src/pages/asin/ProductCategoryPage.vue')
|
||||
const s = readSource('src/pages/asin/ProductCategoryPage.vue', true)
|
||||
assert.doesNotMatch(s, /#6366f1|#eef0fe|6366f1|eef0fe/, '靛蓝色点已清')
|
||||
assert.match(s, /--admin-primary-soft/, '折叠钮改用蓝白主色 soft token')
|
||||
})
|
||||
@@ -63,7 +63,7 @@ test('align_dedupe_registry_row_buttons_old_btn', () => {
|
||||
test('align_asin_actions_cell_spacing', () => {
|
||||
// 反馈:查询ASIN操作按钮要有间距——asin-col-actions 统一 flex + gap 8px(对齐全站 ops-cell)。
|
||||
for (const page of ['src/pages/asin/QueryAsinPage.vue', 'src/pages/asin/SkipPricePage.vue']) {
|
||||
const s = readSource(page)
|
||||
const s = readSource(page, true)
|
||||
assert.match(s, /\.asin-col-actions\s*\{[^}]*gap:\s*8px/, `${page} 操作列按钮间距 8px`)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -31,7 +31,7 @@ test('align_invalid_asin_page_has_no_role_branch_left', () => {
|
||||
assert.doesNotMatch(page, /isSuperAdmin/, '品牌库页又出现了角色分支:这一页的可见集不随操作者变')
|
||||
assert.doesNotMatch(page, /useAdminSessionStore/, '同上:页面已经不需要知道操作者是谁')
|
||||
assert.doesNotMatch(page, /lockedGroupId/i, '锁定分组的老模型回流了')
|
||||
assert.doesNotMatch(page, /:disabled="/, '分组下拉又被禁用了:非站点超管也该能选任意分组(CSS 里的 :not(:disabled) 不算,只排绑定)')
|
||||
assert.doesNotMatch(page, /<el-select\b[^>]*:disabled="/, '分组下拉又被禁用了:非站点超管也该能选任意分组(CSS 里的 :not(:disabled) 不算,只排绑定)')
|
||||
})
|
||||
|
||||
test('align_invalid_asin_page_keeps_group_column_and_filter_for_everyone', () => {
|
||||
|
||||
@@ -21,7 +21,7 @@ test('el_message_above_custom_overlays', () => {
|
||||
})
|
||||
|
||||
test('dedupe_overlay_and_warning_kept', () => {
|
||||
const page = readSource('src/pages/asin/DedupeRegistryPage.vue')
|
||||
const page = readSource('src/pages/asin/DedupeRegistryPage.vue', true)
|
||||
assert.match(page, /\.modal-mask\s*\{[^}]*z-index:\s*3000/, '页内遮罩仍为 3000,消息 4000 需保持在其上')
|
||||
assert.match(page, /\.dedupe-export-wait-mask\s*\{[^}]*z-index:\s*3100/, '导出等待遮罩 3100 同样低于消息 4000')
|
||||
assert.match(page, /请选择数据权限分组|请选择分组/, '导入/编辑未选分组需保留警告岔口')
|
||||
|
||||
@@ -105,7 +105,7 @@ function categoryHeaderColumns(page: string): Array<{ label: string; px: number
|
||||
const theadBlocks = page.match(/<thead>[\s\S]*?<\/thead>/g) ?? []
|
||||
assert.equal(theadBlocks.length, 1, '类目页应只有一个 thead(本闸门按单个表头求列宽之和)')
|
||||
const columns: Array<{ label: string; px: number | null }> = []
|
||||
for (const cell of theadBlocks[0].matchAll(/<th\b[^>]*>([^<]*)<\/th>/g)) {
|
||||
for (const cell of theadBlocks[0].matchAll(/<th(?=[\s>])[^>]*>([\s\S]*?)<\/th>/g)) {
|
||||
const style = cell[0].match(/style="([^"]*)"/)?.[1] ?? ''
|
||||
const px = /width:\s*(\d+)px/.exec(style)?.[1]
|
||||
columns.push({ label: cell[1].trim(), px: px === undefined ? null : Number(px) })
|
||||
@@ -120,14 +120,14 @@ function categoryTableMinWidth(page: string): number | null {
|
||||
}
|
||||
|
||||
test('align_category_fixed_layout_never_leaves_a_column_to_be_squeezed', () => {
|
||||
const page = readSource('src/pages/asin/ProductCategoryPage.vue')
|
||||
const page = readSource('src/pages/asin/ProductCategoryPage.vue', true)
|
||||
// 前提也要钉:这条闸门只在 fixed 布局下成立,改成 auto 布局时它该喊,而不是安静地继续绿。
|
||||
// 窗口用 [^}] 而不是定长字符数:本页 CSS 注释里就写着 "table-layout:fixed 下……" 这句话,
|
||||
// 定长窗口能跨过 } 把注释喂成"前提成立"(变异自证时实测过一次 SURVIVED)。
|
||||
assert.match(page, /\.table-scroll\s+table\s*\{[^}]*table-layout:\s*fixed/, '本闸门的前提:表格是 table-layout:fixed')
|
||||
|
||||
const columns = categoryHeaderColumns(page)
|
||||
assert.equal(columns.length, 8, `表头应有 8 列(与 <td colspan="8"> 对齐),实际 ${columns.length}:${JSON.stringify(columns)}`)
|
||||
assert.equal(columns.length, 9, `表头应有 9 列(与 <td colspan="9"> 对齐),实际 ${columns.length}:${JSON.stringify(columns)}`)
|
||||
const unwidthed = columns.filter((c) => c.px === null).map((c) => c.label)
|
||||
assert.deepEqual(unwidthed, [], 'fixed 布局下没写宽度的列会在容器变窄时被第一个压到 0px:' + unwidthed.join('/'))
|
||||
assert.equal(/width:\s*\d+%/.test(page.match(/<thead>[\s\S]*?<\/thead>/)?.[0] ?? ''), false,
|
||||
@@ -137,7 +137,7 @@ test('align_category_fixed_layout_never_leaves_a_column_to_be_squeezed', () => {
|
||||
const minWidth = categoryTableMinWidth(page)
|
||||
assert.notEqual(minWidth, null, '.category-table-scroll > table 必须有 px 下限,否则塌缩区又合法了')
|
||||
assert.ok((minWidth ?? 0) >= sum,
|
||||
`min-width(${minWidth}px) 必须 >= 8 列宽度之和(${sum}px):否则表格落在 [min-width, 列宽和] 这一段时列被等比压缩`)
|
||||
`min-width(${minWidth}px) 必须 >= 9 列宽度之和(${sum}px):否则表格落在 [min-width, 列宽和] 这一段时列被等比压缩`)
|
||||
|
||||
// 控制方圈出的那两列是这次的直接症状:它们是文字列,宽度下限给死,别被"重新调配比"顺手砍回去。
|
||||
for (const label of ['层级路径', '备注']) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { readSource } from './helpers.ts'
|
||||
const PAGE = 'src/pages/tasks/ShopDataTasksPage.vue'
|
||||
|
||||
test('align_shop_data_grid_normal_primary_path', () => {
|
||||
const src = readSource(PAGE)
|
||||
const src = readSource(PAGE, true)
|
||||
assert.match(src, /grid-template-columns:\s*repeat\(4,\s*1fr\)/, '卡片容器应为 4 列宫格')
|
||||
})
|
||||
|
||||
@@ -19,10 +19,10 @@ test('align_shop_data_grid_normal_variant_input', () => {
|
||||
})
|
||||
|
||||
test('align_shop_data_grid_boundary_empty_input', () => {
|
||||
// 卡片区下方有翻页组件(prev/next),与店铺分页并存(均为旧式分页)。
|
||||
// 卡片分页与授权弹窗分页独立,不能用残留样式充当分页入口。
|
||||
const src = readSource(PAGE)
|
||||
const count = (src.match(/class="pagination"/g) || []).length + (src.match(/sd-shop-pager/g) || []).length
|
||||
assert.ok(count >= 2, '页面应含店铺分页 + 卡片分页两处分页')
|
||||
assert.match(src, /<OldPagination[^\n]*:page="cardPage"/, '卡片列表应有可操作的分页')
|
||||
assert.match(src, /<OldPagination[^\n]*:page="permPage"/, '授权弹窗应有独立分页')
|
||||
assert.match(src, /cardPage/, '卡片分页状态')
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { test } from 'node:test'
|
||||
import { batchResultMessage, runBatchDelete, togglePageSelection } from '../src/utils/batch-delete.ts'
|
||||
|
||||
const rows = [{ id: 1, label: '甲' }, { id: 2, label: '乙' }, { id: 3, label: '丙' }]
|
||||
|
||||
test('表头只选择或取消当前页,同一业务行不重复选择', () => {
|
||||
const selected = new Map([[1, rows[0]]])
|
||||
const next = togglePageSelection(selected, [rows[1], rows[1], rows[2]])
|
||||
assert.deepEqual([...next.keys()], [1, 2, 3])
|
||||
assert.deepEqual([...togglePageSelection(next, rows.slice(1)).keys()], [1])
|
||||
assert.deepEqual([...selected.keys()], [1])
|
||||
})
|
||||
|
||||
test('逐条执行,失败不阻塞其他行,受保护行不发请求', async () => {
|
||||
const calls: number[] = []
|
||||
const result = await runBatchDelete({
|
||||
rows: [...rows, { id: 4, label: '丁' }],
|
||||
precheck: (row) => row.id === 2 ? '不能删除当前登录账号' : undefined,
|
||||
deleteOne: async (row) => {
|
||||
calls.push(row.id)
|
||||
if (row.id === 3) throw new Error('分组下还有店铺')
|
||||
},
|
||||
})
|
||||
assert.deepEqual(calls, [1, 3, 4])
|
||||
assert.deepEqual(result.deleted, [1, 4])
|
||||
assert.deepEqual(result.failures.map(({ id, reason }) => [id, reason]), [[2, '不能删除当前登录账号'], [3, '分组下还有店铺']])
|
||||
assert.equal(batchResultMessage(result), '已删除 2 条,失败 2 条:乙(不能删除当前登录账号);丙(分组下还有店铺)')
|
||||
})
|
||||
|
||||
test('范围失效后不再发下一条请求,未处理记录不计为失败或成功', async () => {
|
||||
let current = true
|
||||
const result = await runBatchDelete({
|
||||
rows,
|
||||
isCurrent: () => current,
|
||||
deleteOne: async () => { current = false },
|
||||
})
|
||||
assert.deepEqual(result, { deleted: [1], failures: [], remaining: 2 })
|
||||
assert.equal(batchResultMessage(result), '已删除 1 条,未处理 2 条')
|
||||
})
|
||||
@@ -89,11 +89,11 @@ test('账号页与顶栏的源码里公司维度已摘干净', () => {
|
||||
|
||||
// 「删了列忘了改占位行 colspan」是这类改动最常留下的残行:按表头列数交叉核对
|
||||
// (`<th` 是 `<thead` 的前缀,必须带上后随字符才数得准)。
|
||||
// 2026-11-17 V206:上架上限列 v-if="isJdSide" 按平台动态渲染 ⇒ 表头数 10(含源码里的 v-if th),
|
||||
// 2026-11-17 V206:上架上限列 v-if="isJdSide" 按平台动态渲染 ⇒ 加上批量选择后表头数 11(含源码里的 v-if th),
|
||||
// 占位行走 :colspan 动态绑定;字面量 colspan 在动态列下必然错位一半的 tab,反向钉死。
|
||||
const headers = (page.match(/<th[\s>]/g) || []).length
|
||||
assert.equal(headers, 10, `用户列表表头应为 10 列(9 列存量 + 京东侧上架上限 v-if 列),实际 ${headers}`)
|
||||
assert.match(page, /:colspan="isJdSide \? 10 : 9"/, '空态占位行必须按平台动态切 colspan(静态值与动态列数错位一半 tab)')
|
||||
assert.equal(headers, 11, `用户列表表头应为 11 列(9 列存量 + 批量选择 + 京东侧上架上限 v-if 列),实际 ${headers}`)
|
||||
assert.match(page, /:colspan="isJdSide \? 11 : 10"/, '空态占位行必须按平台动态切 colspan(静态值与动态列数错位一半 tab)')
|
||||
assert.equal(/colspan="\d+"/.test(page), false, '动态列下不许再留字面量 colspan(必有一侧 tab 列数对不上)')
|
||||
|
||||
const dialog = readSource('src/pages/account/CreateUserDialog.vue')
|
||||
|
||||
@@ -110,7 +110,7 @@ test('不许用客户端猜测禁用行内入口:那会误伤真能改的行',
|
||||
const src = readSource(PAGE)
|
||||
const opsCell = /<td class="ops-cell">[\s\S]*?<\/td>/.exec(src)
|
||||
assert.ok(opsCell, '行内操作列结构变了:这条判据要重写')
|
||||
assert.equal(/:disabled=|v-if=/.test(opsCell[0]), false,
|
||||
assert.equal(/:disabled=|v-if=/.test(opsCell[0].replace(':disabled="batch.busy"', '')), false,
|
||||
'行内编辑/删除上加了客户端权限闸——但前端拿不到后端写侧的 companyGroupIds,'
|
||||
+ '按分组下拉收窄会把同事名下"看得见也改得动"的行一起禁掉(静默删功能)。'
|
||||
+ '要收窄请先让后端在列表响应里下发可写标志(先例:用户菜单授权树的 grantable)。')
|
||||
|
||||
@@ -15,8 +15,12 @@ const INDEX_CANDIDATES = ['/index.ts', '/index.tsx', '/index.vue', '/index.js']
|
||||
* (内容逐字节等价,主树 LF 3565 B / 新检出 CRLF 3629 B)在干净检出树上会多红一条与本任务无关的用例。
|
||||
* 归一之后判据只取决于内容,不取决于在哪台机器、哪个 worktree 里跑。
|
||||
*/
|
||||
export function readSource(rel: string): string {
|
||||
return readFileSync(join(ROOT, rel), 'utf8').replace(/\r\n/g, '\n')
|
||||
export function readSource(rel: string, includeVueStyles = false): string {
|
||||
const source = readFileSync(join(ROOT, rel), 'utf8').replace(/\r\n/g, '\n')
|
||||
if (!includeVueStyles) return source
|
||||
const styles = [...source.matchAll(/<style\b[^>]*\bsrc="(\.\/[^"\n]+\.css)"[^>]*>/g)]
|
||||
.map(([, path]) => readSource(join(dirname(rel), path)))
|
||||
return [source, ...styles].join('\n')
|
||||
}
|
||||
|
||||
/** 统计非重叠子串出现次数(幂等、只读)。 */
|
||||
|
||||
@@ -68,6 +68,24 @@ async function mountDialog(editable = true): Promise<VueWrapper<Element>> {
|
||||
return wrapper
|
||||
}
|
||||
|
||||
it('批量删除分类:全选当前页、确认只移除分类、刷新一次;只读模式无入口', async () => {
|
||||
jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3), group(8, '裤装', 1)])
|
||||
jdApi.deleteJdProductGroup.mockResolvedValue(undefined)
|
||||
const wrapper = await mountDialog()
|
||||
await wrapper.get('.option-head input[type="checkbox"]').setValue(true)
|
||||
await wrapper.get('.batch-delete-actions .btn-danger').trigger('click')
|
||||
await flushPromises()
|
||||
expect(confirmMock).toHaveBeenCalledWith(expect.objectContaining({ message: expect.stringContaining('商品本身不会被删除') }))
|
||||
expect(jdApi.deleteJdProductGroup.mock.calls).toEqual([[7], [8]])
|
||||
expect(jdApi.fetchJdProductGroups).toHaveBeenCalledTimes(2)
|
||||
expect(wrapper.emitted('changed')).toHaveLength(1)
|
||||
expect(wrapper.get('.batch-delete-actions .btn-danger').text()).toBe('批量删除(0)')
|
||||
await wrapper.setProps({ editable: false })
|
||||
expect(wrapper.find('.batch-delete-actions').exists()).toBe(false)
|
||||
expect(wrapper.find('.batch-delete-checkbox').exists()).toBe(false)
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
describe('京东分类管理对话框(V204 独立页 2026-11-17 并入京东数据库页)', () => {
|
||||
it('打开即按当前分组取分类(ownerGroupId 必带);标题不带分组名(2026-11-17 用户口径「不要显示周丽娥」)', async () => {
|
||||
jdApi.fetchJdProductGroups.mockResolvedValue([group(7, '裙装', 3)])
|
||||
|
||||
@@ -140,7 +140,7 @@ describe('菜单权限配置页的平台隔离', () => {
|
||||
])
|
||||
const databaseRow = page.findAll('tbody tr')
|
||||
.find((row) => row.find('.menu-name-text').text() === '京东数据库')
|
||||
expect(databaseRow!.findAll('td')[4].text()).toBe('数据管理')
|
||||
expect(databaseRow!.findAll('td')[5].text()).toBe('数据管理')
|
||||
expect(databaseRow!.find('.column-child-mark').exists()).toBe(true)
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { beforeEach, expect, it, vi } from 'vitest'
|
||||
import { flushPromises, mount } from '@vue/test-utils'
|
||||
import { createPinia, setActivePinia } from 'pinia'
|
||||
import QueryAsinPage from '@/pages/asin/QueryAsinPage.vue'
|
||||
import { useAdminSessionStore } from '@/stores/admin-session'
|
||||
|
||||
const api = vi.hoisted(() => ({
|
||||
fetchQueryAsinList: vi.fn(),
|
||||
deleteQueryAsinCountryAsin: vi.fn(),
|
||||
openAdminConfirm: vi.fn(),
|
||||
}))
|
||||
vi.mock('@/pages/asin/query-asin-api.ts', () => ({ ...api, createQueryAsin: vi.fn(), fetchShopNamesByGroup: vi.fn() }))
|
||||
vi.mock('@/pages/asin/query-asin-detail-api.ts', () => ({ ...api, updateQueryAsinCountryAsin: vi.fn() }))
|
||||
vi.mock('@/pages/shop/shop-manage-api.ts', () => ({ fetchShopManageGroups: vi.fn().mockResolvedValue([]) }))
|
||||
vi.mock('@/components/admin-confirm', () => ({ openAdminConfirm: api.openAdminConfirm }))
|
||||
|
||||
beforeEach(() => {
|
||||
vi.resetAllMocks()
|
||||
setActivePinia(createPinia())
|
||||
useAdminSessionStore().user = { id: 1, username: 'root', role: 'super_admin' }
|
||||
})
|
||||
|
||||
it('多站点店铺只占一个勾选;部分站点失败时,重试不重删成功站点', async () => {
|
||||
const shop = { id: 7, shopName: '甲店', groupName: '甲组', asinDe: 'B000000001', asinUk: 'B000000002' }
|
||||
api.fetchQueryAsinList.mockResolvedValue({ page: 1, total: 1, items: [shop] })
|
||||
api.deleteQueryAsinCountryAsin.mockResolvedValueOnce(undefined).mockRejectedValueOnce(new Error('暂时无法删除英国站'))
|
||||
api.openAdminConfirm.mockResolvedValue(true)
|
||||
const wrapper = mount(QueryAsinPage, { global: { stubs: ['el-select', 'el-option', 'el-dialog', 'el-drawer', 'el-progress'] } })
|
||||
await flushPromises()
|
||||
expect(wrapper.findAll('tbody .batch-delete-checkbox')).toHaveLength(1)
|
||||
expect(wrapper.get('tbody .batch-delete-cell').attributes('rowspan')).toBe('2')
|
||||
await wrapper.get('thead .batch-delete-checkbox').setValue(true)
|
||||
const button = wrapper.get('.batch-delete-actions .btn-danger')
|
||||
expect(button.text()).toBe('批量删除(1)')
|
||||
await button.trigger('click')
|
||||
await flushPromises()
|
||||
expect(api.openAdminConfirm).toHaveBeenCalledWith(expect.objectContaining({ message: expect.stringContaining('全部站点') }))
|
||||
expect(api.deleteQueryAsinCountryAsin.mock.calls).toEqual([[7, 'DE'], [7, 'UK']])
|
||||
expect(wrapper.get('details').text()).toContain('暂时无法删除英国站')
|
||||
await button.trigger('click')
|
||||
await flushPromises()
|
||||
expect(api.deleteQueryAsinCountryAsin.mock.calls).toEqual([[7, 'DE'], [7, 'UK'], [7, 'UK']])
|
||||
expect(button.text()).toBe('批量删除(0)')
|
||||
wrapper.unmount()
|
||||
})
|
||||
@@ -28,6 +28,22 @@ const secretsApi = vi.hoisted(() => ({
|
||||
}))
|
||||
|
||||
vi.mock('@/api/user-secrets', () => secretsApi)
|
||||
const confirmBatch = vi.hoisted(() => vi.fn())
|
||||
vi.mock('@/components/admin-confirm', () => ({ openAdminConfirm: confirmBatch }))
|
||||
|
||||
it('批量清空点名全部密钥与代理,只调用用户级清空接口', async () => {
|
||||
const wrapper = await mountWith([row(7), row(8)])
|
||||
confirmBatch.mockResolvedValue(true)
|
||||
secretsApi.deleteUserSecret.mockResolvedValue(undefined)
|
||||
await wrapper.get('thead .batch-delete-checkbox').setValue(true)
|
||||
await wrapper.get('.batch-delete-actions .btn-danger').trigger('click')
|
||||
await flushPromises()
|
||||
expect(confirmBatch).toHaveBeenCalledWith(expect.objectContaining({ danger: true, message: expect.stringContaining('全部密钥与代理配置') }))
|
||||
expect(secretsApi.deleteUserSecret.mock.calls).toEqual([[7], [8]])
|
||||
expect(secretsApi.clearUserSecretModule).not.toHaveBeenCalled()
|
||||
expect(wrapper.get('.batch-delete-actions .btn-danger').text()).toBe('批量清空(0)')
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
function moduleCell(moduleKey: string, over: Record<string, unknown> = {}) {
|
||||
return {
|
||||
@@ -122,7 +138,7 @@ describe('余额两列接在密钥管理列表上', () => {
|
||||
const headerCount = wrapper.findAll('thead th').length
|
||||
const cellCount = wrapper.findAll('tbody tr')[0].findAll('td').length
|
||||
expect(cellCount, '每行的 td 数必须等于表头列数').toBe(headerCount)
|
||||
expect(headerCount).toBe(12)
|
||||
expect(headerCount).toBe(13)
|
||||
|
||||
const emptyWrapper = await mountWith([])
|
||||
const colspan = Number(emptyWrapper.find('tbody td').attributes('colspan'))
|
||||
@@ -133,7 +149,7 @@ describe('余额两列接在密钥管理列表上', () => {
|
||||
useAdminSessionStore().user = { id: 2, username: 'leader', role: 'admin' }
|
||||
const wrapper = await mountWith([row(7)])
|
||||
const headerCount = wrapper.findAll('thead th').length
|
||||
expect(headerCount).toBe(11)
|
||||
expect(headerCount).toBe(12)
|
||||
expect(wrapper.findAll('tbody tr')[0].findAll('td').length).toBe(headerCount)
|
||||
|
||||
const emptyWrapper = await mountWith([])
|
||||
|
||||
@@ -21,6 +21,8 @@ const usersApi = vi.hoisted(() => ({
|
||||
}))
|
||||
|
||||
vi.mock('@/api/users', () => usersApi)
|
||||
const confirmBatch = vi.hoisted(() => vi.fn())
|
||||
vi.mock('@/components/admin-confirm', () => ({ openAdminConfirm: confirmBatch }))
|
||||
vi.mock('@/api/companies', () => ({ fetchCompanies: vi.fn().mockResolvedValue([]) }))
|
||||
vi.mock('@/pages/account/user-menu-auth-api', () => ({ loadUserMenuAuth: vi.fn() }))
|
||||
|
||||
@@ -48,6 +50,45 @@ beforeEach(() => {
|
||||
const session = useAdminSessionStore()
|
||||
session.user = { id: 1, username: 'root', role: 'super_admin' }
|
||||
usersApi.fetchUserList.mockResolvedValue(pageOf())
|
||||
usersApi.deleteUser.mockReset().mockResolvedValue(undefined)
|
||||
confirmBatch.mockReset().mockResolvedValue(false)
|
||||
})
|
||||
|
||||
it('批量删除取消不发请求;部分失败只保留失败用户', async () => {
|
||||
usersApi.deleteUser.mockRejectedValueOnce(new Error('无权删除此用户'))
|
||||
const wrapper = mount(UsersPage)
|
||||
await flushPromises()
|
||||
const button = wrapper.get('.batch-delete-actions .btn-danger')
|
||||
expect(button.attributes('disabled')).toBeDefined()
|
||||
await wrapper.get('input[aria-label="选择 京东号"]').setValue(true)
|
||||
await wrapper.get('input[aria-label="选择 存量号"]').setValue(true)
|
||||
await button.trigger('click')
|
||||
await flushPromises()
|
||||
expect(confirmBatch).toHaveBeenCalledWith(expect.objectContaining({ message: expect.stringContaining('京东号、存量号') }))
|
||||
expect(usersApi.deleteUser).not.toHaveBeenCalled()
|
||||
confirmBatch.mockResolvedValue(true)
|
||||
await button.trigger('click')
|
||||
await flushPromises()
|
||||
expect(usersApi.deleteUser.mock.calls).toEqual([[7], [8]])
|
||||
expect(button.text()).toBe('批量删除(1)')
|
||||
expect(wrapper.get('details').text()).toContain('京东号:无权删除此用户')
|
||||
expect(usersApi.fetchUserList).toHaveBeenCalledTimes(2)
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('确认弹窗期间切平台,旧勾选不发删除请求', async () => {
|
||||
let resolveConfirm!: (ok: boolean) => void
|
||||
confirmBatch.mockReturnValue(new Promise<boolean>((resolve) => { resolveConfirm = resolve }))
|
||||
const wrapper = mount(UsersPage)
|
||||
await flushPromises()
|
||||
await wrapper.get('input[aria-label="选择 京东号"]').setValue(true)
|
||||
await wrapper.get('.batch-delete-actions .btn-danger').trigger('click')
|
||||
usePlatformTabStore().setActive('jd')
|
||||
resolveConfirm(true)
|
||||
await flushPromises()
|
||||
expect(usersApi.deleteUser).not.toHaveBeenCalled()
|
||||
expect(wrapper.get('.batch-delete-actions .btn-danger').text()).toBe('批量删除(0)')
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
describe('UsersPage × 平台 tab(V206)', () => {
|
||||
@@ -60,8 +101,8 @@ describe('UsersPage × 平台 tab(V206)', () => {
|
||||
expect(params).toHaveProperty('companyId')
|
||||
const headers = wrapper.findAll('thead th').map((th) => th.text())
|
||||
expect(headers).not.toContain('上架上限')
|
||||
// 亚马逊侧表头 9 列(存量表头,quota 列不渲染)
|
||||
expect(headers.length).toBe(9)
|
||||
// 亚马逊侧保留原有 9 列,另加 1 列批量选择。
|
||||
expect(headers.length).toBe(10)
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
@@ -78,12 +119,11 @@ describe('UsersPage × 平台 tab(V206)', () => {
|
||||
|
||||
const headers = wrapper.findAll('thead th').map((th) => th.text())
|
||||
expect(headers).toContain('上架上限')
|
||||
expect(headers.length).toBe(10)
|
||||
expect(headers.length).toBe(11)
|
||||
// quota 单元格:0=不限(存量号 8),null/缺省=-(京东号 7、没配号 10),800 原样
|
||||
const quotaCells = wrapper.findAll('tbody tr').map((tr) => {
|
||||
const tds = tr.findAll('td')
|
||||
// 上架上限列在第 5 列(ID/用户名/角色/所属管理员/到期时间 之后)
|
||||
return tds[5]?.text()
|
||||
return tds[6]?.text()
|
||||
})
|
||||
expect(quotaCells).toEqual(['-', '不限', '800', '-'])
|
||||
wrapper.unmount()
|
||||
|
||||
@@ -118,7 +118,7 @@ function opsColDecl(source: string): string | null {
|
||||
}
|
||||
|
||||
function sourcesOfAll(): Array<{ file: string; source: string }> {
|
||||
return vueFiles(SRC).map((file) => ({ file, source: readSource(file) }))
|
||||
return vueFiles(SRC).map((file) => ({ file, source: readSource(file, true) }))
|
||||
}
|
||||
|
||||
test('ops_ruler_actually_sees_the_family', () => {
|
||||
|
||||
@@ -260,7 +260,7 @@ test('行级明细逐字搬后端 check_message:前端不改写、不另拼句
|
||||
})
|
||||
|
||||
test('页面只有一张码表:不留旧 switch、tooltip 取后端 checkMessage、is-retry 真有条配色', () => {
|
||||
const page = readSource('src/pages/account/UserSecretsPage.vue')
|
||||
const page = readSource('src/pages/account/UserSecretsPage.vue', true)
|
||||
// ① 页面不得自带第二张表:两处各判各的,后端加分档时界面只会漏(今天漏的就是 channel_busy)
|
||||
for (const code of BACKEND_CHECK_CODES) {
|
||||
// 'ok' 这种两字母串当子串查必然误报(token/lock 里就有),它也不是会漏进旧 switch 的那族
|
||||
|
||||
Reference in New Issue
Block a user