新需求更新 同步更新

This commit is contained in:
supernijia
2026-08-06 01:11:54 +08:00
parent 9048bbb7f8
commit 28e7fce11c
112 changed files with 7739 additions and 637 deletions
@@ -3,7 +3,7 @@
<BrandTopBar active="similar-asin" />
<div class="main-content">
<aside class="left-panel">
<aside class="left-panel left-panel--with-template">
<div class="section-title">上传文件</div>
<div class="upload-zone">
<div class="hint">选择 Excel 后点击解析后端会提取 idASIN国家价格每一行都会独立送检</div>
@@ -22,18 +22,25 @@
<label class="switch-row">
<span>
<strong>图片检测</strong>
<em>开启后请求 Coze 时携带 img_switch=true</em>
</span>
<input v-model="imgSwitch" type="checkbox" />
<i></i>
</label>
<label class="switch-row">
<span>
<strong>类目检测</strong>
</span>
<input v-model="categorySwitch" type="checkbox" />
<i></i>
</label>
</div>
<div class="run-row">
<button type="button" class="btn-run" :disabled="parsing || !uploadedFiles.length" @click="parseFiles">
{{ parsing ? '解析中...' : '解析并创建任务' }}
</button>
<button type="button" class="btn-run btn-queue" :disabled="pushing || !parseResult?.taskId" @click="pushToPythonQueue">
<button type="button" class="btn-run btn-queue" :disabled="pushing || !parseResult?.taskId"
@click="pushToPythonQueue">
{{ pushing ? '推送中...' : '推送到 Python 队列' }}
</button>
</div>
@@ -41,9 +48,11 @@
<div v-if="visibleTaskSummary" class="parse-card">
<div>任务 ID{{ visibleTaskSummary.taskId }}</div>
<div>总行数{{ visibleTaskSummary.totalRows }}有效{{ visibleTaskSummary.acceptedRows }}过滤{{ visibleTaskSummary.droppedRows }}</div>
<div>总行数{{ visibleTaskSummary.totalRows }}有效{{ visibleTaskSummary.acceptedRows }}过滤{{
visibleTaskSummary.droppedRows }}</div>
</div>
<pre v-if="queuePayloadText" class="queue-payload">{{ queuePayloadText }}</pre>
<ModuleTemplateDownload module-code="similar-asin" filename="货源查询 文档格式.xlsx" />
</aside>
<section class="right-panel">
@@ -136,8 +145,10 @@
</div>
<div class="task-right">
<span class="status" :class="statusClass(item)">{{ statusText(item) }}</span>
<button v-if="canDownload(item)" type="button" class="download" @click="downloadResult(item)">下载</button>
<button v-if="item.resultId" type="button" class="btn-delete" @click="deleteTaskRecord(item)">删除</button>
<button v-if="canDownload(item)" type="button" class="download"
@click="downloadResult(item)">下载</button>
<button v-if="item.resultId" type="button" class="btn-delete"
@click="deleteTaskRecord(item)">删除</button>
</div>
</li>
</ul>
@@ -153,6 +164,7 @@
import { computed, onMounted, onUnmounted, ref } from 'vue'
import { ElMessage } from 'element-plus'
import BrandTopBar from '@/pages/brand/components/BrandTopBar.vue'
import ModuleTemplateDownload from '@/shared/components/ModuleTemplateDownload.vue'
import {
activateSimilarAsinTask,
deleteSimilarAsinHistory,
@@ -184,6 +196,7 @@ const queuedTaskSummary = ref<TaskSummary | null>(null)
const parsing = ref(false)
const pushing = ref(false)
const imgSwitch = ref(false)
const categorySwitch = ref(false)
const queuePayloadText = ref('')
const pollingTaskIds = ref<number[]>([])
const pendingFileTaskIds = ref<number[]>([])
@@ -291,9 +304,9 @@ function payloadForDisplay<T extends { data?: Record<string, unknown> }>(payload
...payload,
data: payload.data
? {
...payload.data,
api_key: maskSecret(String(payload.data.api_key || '')),
}
...payload.data,
api_key: maskSecret(String(payload.data.api_key || '')),
}
: payload.data,
}
}
@@ -416,8 +429,9 @@ async function parseFiles() {
originalFilename: f.originalFilename,
relativePath: f.relativePath,
}))
const res = await parseSimilarAsin(files, effectiveCozeApiKey(), imgSwitch.value)
const res = await parseSimilarAsin(files, effectiveCozeApiKey(), imgSwitch.value, categorySwitch.value)
parseResult.value = res
categorySwitch.value = Boolean(res.categorySwitch)
queuedTaskSummary.value = null
queuePayloadText.value = ''
ElMessage.success(`解析完成,共 ${res.acceptedRows}`)
@@ -962,65 +976,403 @@ onUnmounted(() => {
</script>
<style scoped>
.module-page { min-height: 100vh; background: #1a1a1a; }
.main-content { display: flex; height: calc(100vh - 56px); min-height: calc(100vh - 56px); }
.left-panel { width: 400px; background: #1e1e1e; padding: 20px; overflow-y: auto; border-right: 1px solid #2a2a2a; }
.right-panel { flex: 1; min-width: 0; background: #1a1a1a; display: flex; flex-direction: column; }
.section-title, .subsection-title { font-size: 13px; color: #bbb; margin-bottom: 10px; }
.upload-zone { border: 1px dashed #3a3a3a; border-radius: 10px; padding: 18px; background: #252525; margin-bottom: 18px; }
.condition-card { margin-bottom: 18px; padding: 14px 16px; border: 1px solid #2f3a34; border-radius: 10px; background: linear-gradient(135deg, #222a25, #202020); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #d8e4dc; cursor: pointer; user-select: none; }
.switch-row span { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.switch-row strong { font-size: 13px; font-weight: 600; }
.switch-row em { color: #8d9a91; font-size: 12px; font-style: normal; line-height: 1.4; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row i { position: relative; width: 46px; height: 24px; flex: 0 0 auto; border-radius: 999px; background: #3a3a3a; box-shadow: inset 0 0 0 1px #4b4b4b; transition: background .2s ease, box-shadow .2s ease; }
.switch-row i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #c7c7c7; transition: transform .2s ease, background .2s ease; }
.switch-row input:checked + i { background: #27ae60; box-shadow: inset 0 0 0 1px #42d17a; }
.switch-row input:checked + i::after { transform: translateX(22px); background: #fff; }
.hint, .loading-msg, .files, .muted { color: #888; font-size: 12px; line-height: 1.5; }
.link { color: #6ea8fe; text-decoration: none; }
.link:hover { color: #9fc5ff; }
.btns, .run-row { display: flex; gap: 10px; flex-wrap: wrap; }
.opt-btn, .btn-run, .btn-delete, .download { border: none; cursor: pointer; border-radius: 7px; }
.opt-btn { padding: 8px 14px; color: #ccc; background: #2a2a2a; border: 1px solid #3a3a3a; }
.btn-run { padding: 10px 18px; color: #fff; background: #3498db; font-weight: 600; }
.btn-queue { background: #27ae60; }
.btn-run:disabled { opacity: .55; cursor: not-allowed; }
.selected-files { margin-top: 14px; color: #999; font-size: 12px; word-break: break-all; }
.selected-files span { display: block; margin: 4px 0; }
.parse-card, .queue-payload { margin-top: 14px; padding: 12px; border: 1px solid #2a2a2a; border-radius: 8px; background: #202020; color: #b8c1cc; font-size: 12px; }
.queue-payload { max-height: 220px; overflow: auto; color: #8fd3ff; white-space: pre-wrap; }
.panel-header { padding: 16px 20px; border-bottom: 1px solid #2a2a2a; font-size: 15px; font-weight: 600; color: #ddd; }
.task-list-wrap { flex: 1; padding: 16px 20px; overflow: auto; }
.clean-result-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-card { padding: 14px 16px; border: 1px solid #2a2a2a; border-radius: 8px; background: #1e1e1e; }
.summary-card strong { display: block; margin-top: 8px; color: #eaf4ff; font-size: 22px; }
.summary-label { color: #8d8d8d; font-size: 12px; }
.result-list-wrap { border: 1px solid #2a2a2a; border-radius: 8px; background: #1e1e1e; min-height: 180px; margin: 0 0 16px; }
.result-list-header { display: flex; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #2a2a2a; color: #ddd; font-size: 14px; }
.empty-tasks { color: #666; font-size: 13px; padding: 18px; text-align: center; }
.task-list { list-style: none; margin: 0; padding: 12px; }
.task-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid #2a2a2a; border-radius: 8px; margin-bottom: 8px; background: #222; }
.left { flex: 1; min-width: 0; }
.id { color: #e0e0e0; font-size: 13px; font-weight: 600; }
.task-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status { padding: 4px 10px; border-radius: 6px; font-size: 12px; }
.status.success { background: rgba(46, 204, 113, .18); color: #2ecc71; }
.status.failed { background: rgba(231, 76, 60, .18); color: #ff6b6b; }
.status.running { background: rgba(52, 152, 219, .18); color: #3498db; }
.status.pending { background: rgba(149, 165, 166, .18); color: #bdc3c7; }
.result-hint { margin-top: 6px; color: #e0b96d; }
.file-progress { margin-top: 8px; max-width: 520px; }
.file-progress-meta { display: flex; justify-content: space-between; gap: 12px; color: #d8c278; font-size: 12px; }
.file-progress-track { margin-top: 5px; height: 8px; border-radius: 999px; overflow: hidden; background: #303030; border: 1px solid #3b3b3b; }
.file-progress-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4aa3ff, #f0c75e); transition: width .25s ease; }
.file-progress-count { margin-top: 4px; color: #858585; font-size: 11px; }
.download { padding: 6px 10px; color: #d6ecff; background: rgba(52, 152, 219, .18); }
.btn-delete { padding: 6px 10px; color: #ff8f8f; background: rgba(231, 76, 60, .12); }
.module-page {
min-height: 100vh;
background: #1a1a1a;
}
.main-content {
display: flex;
height: calc(100vh - 56px);
min-height: calc(100vh - 56px);
}
.left-panel {
width: 400px;
background: #1e1e1e;
padding: 20px;
overflow-y: auto;
border-right: 1px solid #2a2a2a;
}
.right-panel {
flex: 1;
min-width: 0;
background: #1a1a1a;
display: flex;
flex-direction: column;
}
.section-title,
.subsection-title {
font-size: 13px;
color: #bbb;
margin-bottom: 10px;
}
.upload-zone {
border: 1px dashed #3a3a3a;
border-radius: 10px;
padding: 18px;
background: #252525;
margin-bottom: 18px;
}
.condition-card {
margin-bottom: 18px;
padding: 14px 16px;
border: 1px solid #2f3a34;
border-radius: 10px;
background: linear-gradient(135deg, #222a25, #202020);
}
.switch-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 14px;
color: #d8e4dc;
cursor: pointer;
user-select: none;
}
.switch-row span {
display: flex;
flex-direction: column;
gap: 4px;
min-width: 0;
}
.switch-row strong {
font-size: 13px;
font-weight: 600;
}
.switch-row em {
color: #8d9a91;
font-size: 12px;
font-style: normal;
line-height: 1.4;
}
.switch-row input {
position: absolute;
opacity: 0;
pointer-events: none;
}
.switch-row i {
position: relative;
width: 46px;
height: 24px;
flex: 0 0 auto;
border-radius: 999px;
background: #3a3a3a;
box-shadow: inset 0 0 0 1px #4b4b4b;
transition: background .2s ease, box-shadow .2s ease;
}
.switch-row i::after {
content: '';
position: absolute;
top: 3px;
left: 3px;
width: 18px;
height: 18px;
border-radius: 50%;
background: #c7c7c7;
transition: transform .2s ease, background .2s ease;
}
.switch-row input:checked+i {
background: #27ae60;
box-shadow: inset 0 0 0 1px #42d17a;
}
.switch-row input:checked+i::after {
transform: translateX(22px);
background: #fff;
}
.hint,
.loading-msg,
.files,
.muted {
color: #888;
font-size: 12px;
line-height: 1.5;
}
.link {
color: #6ea8fe;
text-decoration: none;
}
.link:hover {
color: #9fc5ff;
}
.btns,
.run-row {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.opt-btn,
.btn-run,
.btn-delete,
.download {
border: none;
cursor: pointer;
border-radius: 7px;
}
.opt-btn {
padding: 8px 14px;
color: #ccc;
background: #2a2a2a;
border: 1px solid #3a3a3a;
}
.btn-run {
padding: 10px 18px;
color: #fff;
background: #3498db;
font-weight: 600;
}
.btn-queue {
background: #27ae60;
}
.btn-run:disabled {
opacity: .55;
cursor: not-allowed;
}
.selected-files {
margin-top: 14px;
color: #999;
font-size: 12px;
word-break: break-all;
}
.selected-files span {
display: block;
margin: 4px 0;
}
.parse-card,
.queue-payload {
margin-top: 14px;
padding: 12px;
border: 1px solid #2a2a2a;
border-radius: 8px;
background: #202020;
color: #b8c1cc;
font-size: 12px;
}
.queue-payload {
max-height: 220px;
overflow: auto;
color: #8fd3ff;
white-space: pre-wrap;
}
.panel-header {
padding: 16px 20px;
border-bottom: 1px solid #2a2a2a;
font-size: 15px;
font-weight: 600;
color: #ddd;
}
.task-list-wrap {
flex: 1;
padding: 16px 20px;
overflow: auto;
}
.clean-result-summary {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 12px;
margin-bottom: 16px;
}
.summary-card {
padding: 14px 16px;
border: 1px solid #2a2a2a;
border-radius: 8px;
background: #1e1e1e;
}
.summary-card strong {
display: block;
margin-top: 8px;
color: #eaf4ff;
font-size: 22px;
}
.summary-label {
color: #8d8d8d;
font-size: 12px;
}
.result-list-wrap {
border: 1px solid #2a2a2a;
border-radius: 8px;
background: #1e1e1e;
min-height: 180px;
margin: 0 0 16px;
}
.result-list-header {
display: flex;
justify-content: space-between;
padding: 12px 16px;
border-bottom: 1px solid #2a2a2a;
color: #ddd;
font-size: 14px;
}
.empty-tasks {
color: #666;
font-size: 13px;
padding: 18px;
text-align: center;
}
.task-list {
list-style: none;
margin: 0;
padding: 12px;
}
.task-item {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
padding: 12px 14px;
border: 1px solid #2a2a2a;
border-radius: 8px;
margin-bottom: 8px;
background: #222;
}
.left {
flex: 1;
min-width: 0;
}
.id {
color: #e0e0e0;
font-size: 13px;
font-weight: 600;
}
.task-right {
display: flex;
gap: 8px;
align-items: center;
flex-wrap: wrap;
}
.status {
padding: 4px 10px;
border-radius: 6px;
font-size: 12px;
}
.status.success {
background: rgba(46, 204, 113, .18);
color: #2ecc71;
}
.status.failed {
background: rgba(231, 76, 60, .18);
color: #ff6b6b;
}
.status.running {
background: rgba(52, 152, 219, .18);
color: #3498db;
}
.status.pending {
background: rgba(149, 165, 166, .18);
color: #bdc3c7;
}
.result-hint {
margin-top: 6px;
color: #e0b96d;
}
.file-progress {
margin-top: 8px;
max-width: 520px;
}
.file-progress-meta {
display: flex;
justify-content: space-between;
gap: 12px;
color: #d8c278;
font-size: 12px;
}
.file-progress-track {
margin-top: 5px;
height: 8px;
border-radius: 999px;
overflow: hidden;
background: #303030;
border: 1px solid #3b3b3b;
}
.file-progress-bar {
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, #4aa3ff, #f0c75e);
transition: width .25s ease;
}
.file-progress-count {
margin-top: 4px;
color: #858585;
font-size: 11px;
}
.download {
padding: 6px 10px;
color: #d6ecff;
background: rgba(52, 152, 219, .18);
}
.btn-delete {
padding: 6px 10px;
color: #ff8f8f;
background: rgba(231, 76, 60, .12);
}
@media (max-width: 1100px) {
.main-content { flex-direction: column; height: auto; }
.left-panel { width: 100%; border-right: none; border-bottom: 1px solid #2a2a2a; }
.clean-result-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.main-content {
flex-direction: column;
height: auto;
}
.left-panel {
width: 100%;
border-right: none;
border-bottom: 1px solid #2a2a2a;
}
.clean-result-summary {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
</style>