7299166e96
范围:src 里原生 <select> 由 36 处清零(含全站共享分页条),15 个页面 + 1 个组件。
换法统一:class="admin-filter"(main.css 皮肤 42px/9px/#f8fbfd/focus ring)+
aria-label 定位 + el-option 显式 label;「全部 XX」空值行与 value 形状逐字保留
('' / null / String(id) / '1'/'0' / `${source}|${deviceId}` 等,下游查询参数与后端枚举不动)。
- OldPagination:每页条数下拉换 el-select(局部 import,挂载测试单 mount 也能渲染),壳压回分页条 30px/8px 档
- account 三页(菜单类型/密钥状态/分组)+ GroupsPage/UsersPage 清死 select 规则
- asin 三页(国家/弹窗分组):弹窗分组用 placeholder+clearable+:value-on-clear 钉回 null,守 number|null 契约
- patent 页(国家/分组)
- records 两页(来源/用户/终端覆盖):终端覆盖 value 仍 source|deviceId
- tasks 四页 + 任务看板(业务/状态/类型/来源/店铺/分组/场景):BrandGating/DuplicateCheck/KeywordUsage 三页本地是 34px 紧凑档,
故把 el-select 壳压回本地 34px/7px 与同行输入框齐高(否则高 8px 错位)
测试:mount 全量 21 文件 164 passed;node --test 1924 例 1922 passed(2 红为在册:
date-range-order 环境红、company-config-entry-super-only 由 ee613db0 引入与本次无关);
vue-tsc rc=0。新增 account-select-el / records-select-el 两支换壳契约(值形状 + 空值行 + 点开→点选项)。
446 lines
16 KiB
Vue
446 lines
16 KiB
Vue
<script setup lang="ts">
|
||
import { formatDateTime, orderedPair } from '@/utils/datetime'
|
||
/** 外观专利数据库 · 明细分页表(2026-11-11 晚间按客户口径恢复「昨天那个格式」:
|
||
* 「不是这种格式 你就按照昨天那个格式」——撤掉一主管一卡视图,恢复只读明细表;
|
||
* 「添加个管理员 跟导出数据就可以」——表上加「管理员」列(后端读侧现算:主管/公司超管=自己,
|
||
* 普通账户=创建人,读不到为空展示 -,不猜名),筛选行加「导出」(与「去重数据库」页同款:
|
||
* 当前过滤面+公司 tab 全量出 xlsx,不传 supervisor_user_id——传了会走按主管分支并忽略任务号/ASIN);
|
||
* 「任务号/ASIN 两个筛选框恢复」(后端能力一直在,之前产品决定下过架,客户要「一目了然」选数据);
|
||
* 分组(主管)下拉保留「选中即查」。数据按 ASIN 累计:同 ASIN 只保留一条(V192 唯一键,
|
||
* 重复检测更新那条),不同 ASIN 同品牌全保留——页面只管展示,累计语义在后端同步链。
|
||
* 主管卡片视图与卡片级删除按钮从页面下架(客户下午反馈数据疑似被误删,删除入口先撤;
|
||
* 后端 /supervisors 两接口保留不动)。 */
|
||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||
import {
|
||
exportAppearancePatentCleanList,
|
||
fetchAppearancePatentCleanList,
|
||
fetchDedupeTotalGroups,
|
||
type DedupeGroupOption,
|
||
} from './appearance-patent-clean-api.ts'
|
||
import type { AppearancePatentCleanItem } from './appearance-patent-clean-model.ts'
|
||
import { cleanItemReasonTooltip } from './appearance-patent-clean-model.ts'
|
||
import { createAppearancePatentCleanFilterState } from './appearance-patent-clean-filter.ts'
|
||
import { ASIN_COUNTRY_CODES, asinCountryLabel } from '../asin/asin-country.ts'
|
||
import OldPagination from '@/components/OldPagination.vue'
|
||
import { useCompanyTabStore } from '@/stores/company-tab'
|
||
import { showAdminFeedback } from '@/components/admin-feedback-ui'
|
||
import { loadFailureMessage } from '@/components/load-failure-model'
|
||
import LoadFailureBar from '@/components/LoadFailureBar.vue'
|
||
|
||
const companyTab = useCompanyTabStore()
|
||
|
||
const loading = ref(false)
|
||
const loadFailure = ref('')
|
||
const rows = ref<AppearancePatentCleanItem[]>([])
|
||
const total = ref(0)
|
||
const page = ref(1)
|
||
const pageSize = ref(10)
|
||
/** 导出在途锁:避免连点导出把同一份过滤面重复请求两遍。 */
|
||
const exporting = ref(false)
|
||
/** 同步台账是累计数据,日期初值故意留空(默认当天会让首屏只剩今天同步的行);见 date-filter-default-today 护栏的 EXEMPT。 */
|
||
const filter = reactive(createAppearancePatentCleanFilterState())
|
||
/** 分组(主管)下拉选项:公司 tab 切换时重取;选项失败不拦列表,只回空下拉(可见「全部分组」)。 */
|
||
const groupOptions = ref<DedupeGroupOption[]>([])
|
||
/** min/max 挡不住手输,落值后把倒挂的起止交换回来。 */
|
||
function clampDatePair(): void {
|
||
const [s, e] = orderedPair(filter.startDate, filter.endDate)
|
||
filter.startDate = s
|
||
filter.endDate = e
|
||
}
|
||
|
||
const totalPages = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
|
||
|
||
/** 分组选项与去重页/店铺管理同源(GET /shop-manages/groups);失败静默回空——分组只是筛选项,
|
||
* 不该让它把首屏行集一起拖死(列表失败有自己的 LoadFailureBar)。 */
|
||
async function loadGroupOptions(): Promise<void> {
|
||
try {
|
||
groupOptions.value = await fetchDedupeTotalGroups(companyTab.requestCompanyId)
|
||
} catch {
|
||
groupOptions.value = []
|
||
}
|
||
}
|
||
|
||
async function load(): Promise<void> {
|
||
loading.value = true
|
||
loadFailure.value = ''
|
||
try {
|
||
const result = await fetchAppearancePatentCleanList({
|
||
page: page.value,
|
||
pageSize: pageSize.value,
|
||
taskId: filter.taskId,
|
||
asin: filter.asin,
|
||
country: filter.country,
|
||
groupId: filter.groupId,
|
||
startDate: filter.startDate,
|
||
endDate: filter.endDate,
|
||
companyId: companyTab.requestCompanyId,
|
||
})
|
||
rows.value = result.items
|
||
total.value = result.total
|
||
if (result.page >= 1) page.value = result.page
|
||
} catch (error) {
|
||
loadFailure.value = loadFailureMessage(error, '无侵权数据加载失败')
|
||
showAdminFeedback(loadFailure.value, 'error')
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
|
||
/** 导出与页签同一过滤面(含公司 tab 与分组),服务端全量出 xlsx;成功后浏览器落盘,失败弹可读文案。
|
||
* 不传 supervisor_user_id:按主管分支会忽略任务号/ASIN 参数,「按当前筛选导出」必须走明细分支。 */
|
||
async function exportAll(): Promise<void> {
|
||
if (exporting.value) return
|
||
exporting.value = true
|
||
try {
|
||
const result = await exportAppearancePatentCleanList({
|
||
taskId: filter.taskId,
|
||
asin: filter.asin,
|
||
country: filter.country,
|
||
groupId: filter.groupId,
|
||
startDate: filter.startDate,
|
||
endDate: filter.endDate,
|
||
companyId: companyTab.requestCompanyId,
|
||
})
|
||
const url = URL.createObjectURL(result.blob)
|
||
const anchor = document.createElement('a')
|
||
anchor.href = url
|
||
anchor.download = result.filename
|
||
document.body.appendChild(anchor)
|
||
anchor.click()
|
||
anchor.remove()
|
||
URL.revokeObjectURL(url)
|
||
showAdminFeedback(`已导出 ${result.filename}`, 'success')
|
||
} catch (error) {
|
||
const message = error instanceof Error && error.message ? error.message : '导出失败,请稍后重试'
|
||
showAdminFeedback(message, 'error')
|
||
} finally {
|
||
exporting.value = false
|
||
}
|
||
}
|
||
|
||
function apply(): void {
|
||
page.value = 1
|
||
void load()
|
||
}
|
||
|
||
/** 重置(对齐店铺数据记录页样式):筛选面回出厂空态,回第一页重取。 */
|
||
function reset(): void {
|
||
Object.assign(filter, createAppearancePatentCleanFilterState())
|
||
page.value = 1
|
||
void load()
|
||
}
|
||
|
||
function changePage(next: number): void {
|
||
if (next < 1 || next > totalPages.value) return
|
||
page.value = next
|
||
void load()
|
||
}
|
||
|
||
function changeSize(size: number) {
|
||
pageSize.value = size
|
||
page.value = 1
|
||
void load()
|
||
}
|
||
|
||
// 切公司 = 重新取数:任务号/ASIN/分组是上一家选中的值,在新一家的行集里筛不出东西,必须一起清,
|
||
// 分组选项也按新公司重取(选项集是公司隔离的)。
|
||
watch(() => companyTab.activeId, () => { filter.taskId = ''; filter.asin = ''; filter.groupId = ''; page.value = 1; void loadGroupOptions(); void load() })
|
||
|
||
onMounted(() => {
|
||
void loadGroupOptions()
|
||
void load()
|
||
})
|
||
</script>
|
||
|
||
<template>
|
||
<div class="clean-items-view">
|
||
<section class="panel-box">
|
||
<div class="clean-panel-head">
|
||
<h3>外观专利数据库</h3>
|
||
</div>
|
||
|
||
<div class="clean-filter-row">
|
||
<div class="form-group">
|
||
<label>任务号</label>
|
||
<input v-model="filter.taskId" type="text" placeholder="输入任务号" @keyup.enter="apply" />
|
||
</div>
|
||
<div class="form-group">
|
||
<label>ASIN</label>
|
||
<input v-model="filter.asin" type="text" placeholder="输入 ASIN" @keyup.enter="apply" />
|
||
</div>
|
||
<div class="form-group">
|
||
<label>国家</label>
|
||
<!-- 下拉 2026-11-17 用户口径「和亚马逊不统一」:原生 <select> 的弹层是浏览器直角
|
||
原生物 ⇒ 换 el-select(admin-filter 同壳 42px/9px,弹层 EP 圆角面板)。
|
||
「全部国家」保留为空值首行(与旧原生下拉同语义,查询参数仍是空串)。 -->
|
||
<el-select v-model="filter.country" class="admin-filter" aria-label="筛选国家">
|
||
<el-option label="全部国家" value="" />
|
||
<el-option v-for="code in ASIN_COUNTRY_CODES" :key="code" :label="asinCountryLabel(code)" :value="code" />
|
||
</el-select>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>分组</label>
|
||
<!-- 分组(主管)选中即查:选完立刻按该主管过滤刷新(回第一页),不必再点查询。
|
||
value 保持字符串形状(下游按字符串比对/透传)。 -->
|
||
<el-select v-model="filter.groupId" class="admin-filter" aria-label="筛选分组" @change="apply">
|
||
<el-option label="全部分组" value="" />
|
||
<el-option v-for="group in groupOptions" :key="group.id" :label="group.name" :value="String(group.id)" />
|
||
</el-select>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>同步开始日期</label>
|
||
<input v-model="filter.startDate" type="date" :max="filter.endDate" @change="clampDatePair" />
|
||
</div>
|
||
<div class="form-group">
|
||
<label>同步结束日期</label>
|
||
<input v-model="filter.endDate" type="date" :min="filter.startDate" @change="clampDatePair" />
|
||
</div>
|
||
<div class="clean-filter-actions">
|
||
<button class="btn" type="button" @click="apply">查询</button>
|
||
<button class="btn btn-export" type="button" :disabled="exporting" @click="exportAll">
|
||
{{ exporting ? '导出中...' : '导出' }}
|
||
</button>
|
||
<button class="btn btn-secondary" type="button" @click="reset">重置</button>
|
||
</div>
|
||
</div>
|
||
|
||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="load" />
|
||
<div class="clean-toolbar">
|
||
<span class="clean-summary">共 {{ total }} 条无侵权数据</span>
|
||
</div>
|
||
<div class="table-scroll clean-table-scroll">
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th style="width: 90px">任务号</th>
|
||
<th style="width: 110px">管理员</th>
|
||
<th>ASIN</th>
|
||
<th style="width: 64px">国家</th>
|
||
<th>SKU</th>
|
||
<th>品牌</th>
|
||
<th style="width: 90px">价格</th>
|
||
<th>标题</th>
|
||
<th style="width: 130px">结论</th>
|
||
<th style="width: 170px">同步时间</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<template v-if="rows.length">
|
||
<tr v-for="row in rows" :key="row.id">
|
||
<td>{{ row.taskId ?? '-' }}</td>
|
||
<td :title="row.supervisorName || ''">{{ row.supervisorName || '-' }}</td>
|
||
<td class="mono-cell">{{ row.asin || '-' }}</td>
|
||
<td>{{ asinCountryLabel(row.country || '') }}</td>
|
||
<td class="mono-cell">{{ row.sku || '-' }}</td>
|
||
<td>{{ row.brand || '-' }}</td>
|
||
<td>{{ row.price || '-' }}</td>
|
||
<td class="title-cell" :title="row.title">{{ row.title || '-' }}</td>
|
||
<td class="conclusion-cell" :title="cleanItemReasonTooltip(row)">{{ row.conclusion || '-' }}</td>
|
||
<td>{{ formatDateTime(row.syncedAt || '') }}</td>
|
||
</tr>
|
||
</template>
|
||
<tr v-else-if="loading">
|
||
<td colspan="10" class="empty-tip">加载中...</td>
|
||
</tr>
|
||
<tr v-else>
|
||
<td colspan="10" class="empty-tip">暂无无侵权数据</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
<OldPagination :total="total" :page="page" :page-size="pageSize" @change="changePage" @size-change="changeSize" />
|
||
</section>
|
||
</div>
|
||
</template>
|
||
|
||
<style scoped>
|
||
/* 像素复刻参照「去重数据库」页(panel-box + 自绘表格 + 旧式分页),只读无操作列。
|
||
2026-11-11 晚间恢复明细表形态(客户「按照昨天那个格式」),表头第二列=管理员。 */
|
||
.clean-items-view {
|
||
font-family: inherit;
|
||
color: var(--c-text, #24384d);
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 18px;
|
||
}
|
||
.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;
|
||
}
|
||
.clean-panel-head h3 {
|
||
margin: 0 0 16px;
|
||
}
|
||
.clean-filter-row {
|
||
display: grid;
|
||
grid-template-columns: repeat(6, minmax(150px, 1fr)) auto;
|
||
gap: 12px;
|
||
align-items: end;
|
||
margin-bottom: 16px;
|
||
}
|
||
.clean-filter-row .form-group {
|
||
min-width: 0;
|
||
}
|
||
.clean-filter-actions {
|
||
display: flex;
|
||
gap: 10px;
|
||
align-items: center;
|
||
white-space: nowrap;
|
||
}
|
||
.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);
|
||
}
|
||
.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;
|
||
}
|
||
.clean-toolbar {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-bottom: 10px;
|
||
}
|
||
.clean-summary {
|
||
color: #5b6f83;
|
||
font-size: 13px;
|
||
white-space: nowrap;
|
||
}
|
||
.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;
|
||
}
|
||
/* 同步时间列=`YYYY-MM-DD HH:mm:ss` 固定 19 字符,13.5px 下实测约 133px;全局 `* { box-sizing: border-box }`
|
||
把 24px 左右内边距算进列宽,旧的 150px 只剩 126px 内容宽 ⇒ 末尾被 ellipsis 吃掉(客户 2026-11-12
|
||
反馈「日期显示不全」)。170px 与店铺管理/跳过价格等页的时间列同值(内容宽 146px,留 13px 余量);
|
||
表 min-width 同步 +20px,其余列的可用宽度与改前一致。 */
|
||
.clean-table-scroll > table {
|
||
min-width: 1060px;
|
||
}
|
||
.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;
|
||
}
|
||
.title-cell {
|
||
max-width: 260px;
|
||
}
|
||
.conclusion-cell {
|
||
max-width: 130px;
|
||
}
|
||
.empty-tip {
|
||
padding: 44px 24px;
|
||
text-align: center;
|
||
color: #8293a5;
|
||
font-size: 13.5px;
|
||
}
|
||
</style>
|