2cae0d742c
「切 tab 数据还一样」的根因一直是分母小于现实:批次 1 只登记 8 页,本轮按控制方 三次点名扩到 16 页(company-scope.ts 是唯一清单,routes.ts 的 companyScoped 逐页对平)。 批次 2(五页 ASIN 中心):去重总数据 / 不符合ASIN / 查询ASIN / 最低价ASIN / 商品类目。 批次 3(两页店铺中心):撞款监控、店铺数据记录。这两页没有归属列可筛,归属口径是 「本公司账号名下的店铺」——后端由 DataReadScope 推公司 → 成员账号 → biz_shop_manage. created_by_id,前端只把 activeId 当 company_id 送下去。空成员集必须交空集合,绝不能 退化成 null(null 在这里=全量,那样第二家会看到全部数据)。 批次 4(用户管理):后端早就认 company_id(只对站点超管生效,公司超管恒锁本公司), 断的是前端——UserListQuery 里连这个字段都没有,三家 tab 看的是同一份全量列表。 三处口径改动,逐条说明: 1)company-user-list.test.ts 的反向钉被改写。2026-10-04 定案把公司维度从用户页整体摘掉, 那条钉的原文是「列表查询/筛选/行渲染不允许出现公司维度」。控制方 2026-10-05 明确要 用户管理区分公司 tab,所以钉的边界收窄成两半:渲染层(行级公司列、「所属公司」标签、 筛选状态、顶栏公司名)仍不得回流;请求层的 company_id 是这次加回来的,尺子换成 「取值口唯一」——页面每处 companyId 都必须等于 companyTab.requestCompanyId,且 normalizeUserPageParams/toUserListQuery 两只白名单构造器体内不许出现公司值。 新增一支行为钉:往归一化里传 companyId 必须被丢掉,这是 users.ts 读原始入参的全部理由 (写成 normalized.companyId 时 TS 照样绿、运行时恒 undefined)。 2)align-dup-console 那条 watch 看守的 token 扩到含 reload。变异自证里「删掉 void loadConsole()」当场全绿:体里的清筛选项守住了,重新取数那半没人守。批次 3/4 三对 token 一起写到 reload 为止(批次 1/2 的老条目不动)。 3)公司管理页补正/反向两把尺子:company-config-entry-super-only 新增「吃公司 tab 的页面 集合恰好等于 COMPANY_SCOPED_PAGES 的 pageFiles」——按代码真值比,不按清单比,所以 清单不改一字而往 CompaniesPage.vue 里塞 store 也会红。谓词带括号,否则 import 行也算消费者。 菜单权限(admin_columns)本轮不动:MenusPage 只消费 /api/admin/permission-menus 这一份全局 菜单字典,切 tab 一样是数据本身全局,不是筛选坏了。真问题在写侧——PermissionMenuService create/update/delete 只有 ensureAdminOperatorIfPresent(isAdmin 即放行),公司管理员改的是 全平台的菜单行。收窄为仅站点超管 vs 给 permission_menu 加归属列,两种改法代价差一个量级, 留给控制方定档。 护栏:G1 发送口 22 个 / 页面分组 17、watch 体看守 10 对、operation-guide 的 tab 文案 15 页 (撞款监控是显式豁免,另有一条自检盯「豁免落空」)。 变异自证 12/12 全杀(前端 10 + 公司管理反向钉 2),分母钉死在 27 例。 门禁:后端全量 3823 例 / 0 失败 / 0 错误 / 7 skipped,BUILD SUCCESS;admin-frontend-vue 1741 例 / 0 红;vue-tsc rc=0。首轮后端 4 红是另一路 task_partial 改动与本轮编译抢跑, 单跑 13 例已绿,本笔不含他们的任何文件。 未上线:jar 与 admin-vue 都没出包,V147 未在生产执行。
805 lines
25 KiB
Vue
805 lines
25 KiB
Vue
<script setup lang="ts">
|
||
import { formatDateTime } from '@/utils/datetime'
|
||
/** 店铺数据记录页 · 像素复刻旧版 admin.html panel-shop-data-crawl-tasks(自绘:form-box 筛选[h4 筛选条件] + panel-box toolbar[全选/批量下载/权限配置/汇总] + 每店卡片网格 + 旧式分页(店铺级+卡片级 9/页))。
|
||
* script 逻辑沿用现有 Vue 实现(批量打包/删除结果文件[保留]/权限授权)。 */
|
||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||
import { ElMessage } from 'element-plus'
|
||
import { asinCountryLabel } from '../asin/asin-country.ts'
|
||
import { createShopDataFilter, type ShopDataFilter } from './shop-data-filter.ts'
|
||
import type { ShopDataResultRow, ShopDataTaskGroup } from './shop-data-model.ts'
|
||
import { isUsableShopDataResult } from './shop-data-model.ts'
|
||
import {
|
||
deleteShopDataResultHistory,
|
||
fetchShopDataResultDownload,
|
||
fetchShopDataTaskList,
|
||
fetchShopDataTaskPermissionUsers,
|
||
requestShopDataZipDownload,
|
||
saveShopDataTaskPermissions,
|
||
} from './shop-data-api.ts'
|
||
import { isTerminalStatus } from './image-video-view.ts'
|
||
import { grantedUserIds, type TaskPermissionItem } from './task-permission.ts'
|
||
import {
|
||
addShopDataSelection,
|
||
countShopDataSelection,
|
||
createShopDataSelection,
|
||
toggleShopDataSelection,
|
||
} from './shop-data-selection.ts'
|
||
import { useAdminSessionStore } from '@/stores/admin-session'
|
||
import { useCompanyTabStore } from '@/stores/company-tab'
|
||
import OldPagination from '@/components/OldPagination.vue'
|
||
|
||
const session = useAdminSessionStore()
|
||
const companyTab = useCompanyTabStore()
|
||
const loading = ref(false)
|
||
const groups = ref<ShopDataTaskGroup[]>([])
|
||
const totalShops = ref(0)
|
||
const page = ref(1)
|
||
// 店铺级一次全载(>200 家店铺时后端按页截断,可上调或恢复底部店铺级分页)。
|
||
const pageSize = ref(200)
|
||
// 卡片宫格分页:一行 4 个、一页 10 张卡片(在店铺分页的结果文件内翻页)。
|
||
const cardPage = ref(1)
|
||
const cardPageSize = ref(10)
|
||
const cardJump = ref('')
|
||
const cardTotalPages = computed(() => Math.max(1, Math.ceil(allResultRows.value.length / cardPageSize.value)))
|
||
|
||
/** 创建时间初值故意留空:默认锁当天会让首屏只剩今天新建的任务(用户 2026-10-04 定案),见 date-filter-default-today 护栏的 EXEMPT。 */
|
||
const filter = reactive<ShopDataFilter & { dateRange: string[] }>({
|
||
...createShopDataFilter(),
|
||
dateRange: ['', ''],
|
||
})
|
||
const selection = ref<Set<string>>(new Set())
|
||
|
||
const permissionVisible = ref(false)
|
||
const permissionItems = ref<TaskPermissionItem[]>([])
|
||
const permissionSaving = ref(false)
|
||
/** 权限弹窗用户表客户端分页(全量用户在表格内翻页,10/20/50/100 可选)。 */
|
||
const permPage = ref(1)
|
||
const permPageSize = ref(10)
|
||
const pagedPermissionItems = computed(() =>
|
||
permissionItems.value.slice((permPage.value - 1) * permPageSize.value, permPage.value * permPageSize.value),
|
||
)
|
||
|
||
const busyKey = ref('')
|
||
const deletingKey = ref('')
|
||
|
||
/** 下载进度弹窗:percent=0~100;indeterminate=true 表示后端未回 Content-Length,只显示流动条。 */
|
||
const downloadProgress = reactive({ visible: false, percent: 0, indeterminate: false, label: '' })
|
||
|
||
function startDownloadProgress(label: string) {
|
||
downloadProgress.label = label
|
||
downloadProgress.percent = 0
|
||
downloadProgress.indeterminate = false
|
||
downloadProgress.visible = true
|
||
}
|
||
|
||
function updateDownloadProgress(percent: number) {
|
||
if (percent < 0) {
|
||
downloadProgress.indeterminate = true
|
||
return
|
||
}
|
||
downloadProgress.indeterminate = false
|
||
downloadProgress.percent = percent
|
||
}
|
||
|
||
/** 旧版状态 label 映射(对齐 admin.js 状态徽章)。 */
|
||
function statusLabel(status: string): string {
|
||
const map: Record<string, string> = {
|
||
PENDING: '待执行',
|
||
WAITING: '排队中',
|
||
RUNNING: '执行中',
|
||
PROCESSING: '处理中',
|
||
SUCCESS: '已完成',
|
||
COMPLETED: '已完成',
|
||
FAILED: '失败',
|
||
ERROR: '失败',
|
||
CANCELLED: '已取消',
|
||
UNKNOWN: '未知',
|
||
}
|
||
const key = (status || '').toUpperCase()
|
||
if (map[key]) return map[key]
|
||
return key || '未知'
|
||
}
|
||
|
||
function statusType(status: string): 'pending' | 'running' | 'success' | 'failed' | 'cancelled' {
|
||
const key = (status || '').toUpperCase()
|
||
if (key === 'SUCCESS' || key === 'COMPLETED') return 'success'
|
||
if (key === 'FAILED' || key === 'ERROR') return 'failed'
|
||
if (key === 'CANCELLED') return 'cancelled'
|
||
if (key === 'PENDING' || key === 'WAITING') return 'pending'
|
||
return 'running'
|
||
}
|
||
|
||
function toFilter(): ShopDataFilter {
|
||
return {
|
||
shopName: filter.shopName.trim(),
|
||
groupName: filter.groupName.trim(),
|
||
country: filter.country.trim(),
|
||
createdFrom: filter.dateRange?.[0] || '',
|
||
createdTo: filter.dateRange?.[1] || '',
|
||
}
|
||
}
|
||
|
||
async function load() {
|
||
loading.value = true
|
||
try {
|
||
const result = await fetchShopDataTaskList(toFilter(), page.value, pageSize.value, companyTab.requestCompanyId)
|
||
groups.value = result.items
|
||
totalShops.value = result.total
|
||
page.value = result.page
|
||
} catch (error) {
|
||
ElMessage.error(error instanceof Error ? error.message : '店铺数据记录加载失败')
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
|
||
function apply() {
|
||
page.value = 1
|
||
void load()
|
||
}
|
||
|
||
function reset() {
|
||
Object.assign(filter, createShopDataFilter())
|
||
filter.dateRange = ['', '']
|
||
page.value = 1
|
||
void load()
|
||
}
|
||
|
||
const allResultRows = computed(() => groups.value.flatMap((group) => group.results))
|
||
const pagedResultRows = computed(() =>
|
||
allResultRows.value.slice((cardPage.value - 1) * cardPageSize.value, cardPage.value * cardPageSize.value),
|
||
)
|
||
const selectionCount = computed(() => countShopDataSelection(selection.value))
|
||
|
||
function changeCardPage(p: number) {
|
||
cardPage.value = p
|
||
}
|
||
|
||
function changeCardSize(size: number) {
|
||
cardPageSize.value = size
|
||
cardPage.value = 1
|
||
}
|
||
|
||
function goCardJump() {
|
||
const n = Number.parseInt(cardJump.value, 10)
|
||
if (Number.isNaN(n)) {
|
||
ElMessage.warning('请输入页码')
|
||
return
|
||
}
|
||
changeCardPage(Math.min(Math.max(n, 1), cardTotalPages.value))
|
||
}
|
||
|
||
function resultFileCount(): number {
|
||
return groups.value.reduce((sum, group) => sum + group.results.length, 0)
|
||
}
|
||
|
||
/** 可勾选行(对齐 admin.js syncShopDataSelectionUi:file_ready && resultId>0,不附加终态约束)。 */
|
||
function selectableRows(): ShopDataResultRow[] {
|
||
return allResultRows.value.filter((row) => isUsableShopDataResult(row))
|
||
}
|
||
|
||
function toggleRow(row: ShopDataResultRow) {
|
||
selection.value = toggleShopDataSelection(selection.value, row.resultId)
|
||
}
|
||
|
||
function toggleSelectAllReady() {
|
||
const rows = selectableRows()
|
||
const allIn = rows.length > 0 && rows.every((row) => selection.value.has(row.resultId))
|
||
selection.value = allIn
|
||
? createShopDataSelection()
|
||
: addShopDataSelection(new Set(selection.value), rows.map((row) => row.resultId))
|
||
}
|
||
|
||
function rowSelected(row: ShopDataResultRow): boolean {
|
||
return selection.value.has(row.resultId)
|
||
}
|
||
|
||
function selectAllChecked(): boolean {
|
||
const rows = selectableRows()
|
||
return rows.length > 0 && rows.every((row) => selection.value.has(row.resultId))
|
||
}
|
||
|
||
function selectAllIndeterminate(): boolean {
|
||
const rows = selectableRows()
|
||
return selectionCount.value > 0 && selectionCount.value < rows.length
|
||
}
|
||
|
||
async function downloadRow(row: ShopDataResultRow) {
|
||
if (!row.fileReady) {
|
||
ElMessage.warning('文件未就绪,无法下载')
|
||
return
|
||
}
|
||
busyKey.value = row.resultId
|
||
startDownloadProgress(`正在下载「${row.shopName || '-'}」的数据文件`)
|
||
try {
|
||
const { blob, filename } = await fetchShopDataResultDownload(row.resultId, updateDownloadProgress)
|
||
saveBlob(blob, filename)
|
||
downloadProgress.visible = false
|
||
ElMessage.success('下载已开始')
|
||
} catch (error) {
|
||
ElMessage.error(error instanceof Error ? error.message : '下载失败')
|
||
} finally {
|
||
busyKey.value = ''
|
||
}
|
||
}
|
||
|
||
async function downloadBatch() {
|
||
const resultIds = Array.from(selection.value)
|
||
if (!resultIds.length) {
|
||
ElMessage.warning('请先勾选要下载的结果文件')
|
||
return
|
||
}
|
||
busyKey.value = 'batch'
|
||
startDownloadProgress(`正在打包下载 ${resultIds.length} 个结果文件`)
|
||
try {
|
||
const zip = await requestShopDataZipDownload(resultIds, updateDownloadProgress)
|
||
saveBlob(zip.blob, `店铺数据批量下载_${resultIds.length}.zip`)
|
||
downloadProgress.visible = false
|
||
const note = zip.errorCount ? `,${zip.errorCount} 个失败(详见包内错误清单)` : ''
|
||
ElMessage.success(`已下载 ${zip.fileCount ?? resultIds.length} 个文件${note}`)
|
||
} catch (error) {
|
||
ElMessage.error(error instanceof Error ? error.message : '批量下载失败')
|
||
} finally {
|
||
busyKey.value = ''
|
||
}
|
||
}
|
||
|
||
async function removeRowByRow(row: ShopDataResultRow) {
|
||
// 管理端真删:删除该店这条店铺数据记录(累计档 + 文件 + 明细),前台任务记录仍保留但文件不可再下载
|
||
if (!window.confirm(`确认删除店铺“${row.shopName}”这条店铺数据记录及其数据文件?此操作不可恢复。`)) return
|
||
deletingKey.value = row.resultId
|
||
try {
|
||
await deleteShopDataResultHistory(row.resultId)
|
||
ElMessage.success('删除成功')
|
||
await load()
|
||
} catch (error) {
|
||
ElMessage.error(error instanceof Error ? error.message : `删除店铺“${row.shopName}”的记录失败`)
|
||
} finally {
|
||
deletingKey.value = ''
|
||
}
|
||
}
|
||
|
||
function saveBlob(blob: Blob, filename: string) {
|
||
const url = URL.createObjectURL(blob)
|
||
const anchor = document.createElement('a')
|
||
anchor.href = url
|
||
anchor.download = filename
|
||
anchor.click()
|
||
URL.revokeObjectURL(url)
|
||
}
|
||
|
||
async function openPermission() {
|
||
try {
|
||
permissionItems.value = await fetchShopDataTaskPermissionUsers()
|
||
permPage.value = 1
|
||
permissionVisible.value = true
|
||
} catch (error) {
|
||
ElMessage.error(error instanceof Error ? error.message : '权限用户加载失败')
|
||
}
|
||
}
|
||
|
||
function toggleGrant(item: TaskPermissionItem) {
|
||
item.granted = !item.granted
|
||
}
|
||
|
||
async function savePermission() {
|
||
permissionSaving.value = true
|
||
try {
|
||
const next = grantedUserIds(permissionItems.value)
|
||
await saveShopDataTaskPermissions(next)
|
||
ElMessage.success('保存成功')
|
||
permissionVisible.value = false
|
||
} catch (error) {
|
||
ElMessage.error(error instanceof Error ? error.message : '保存失败')
|
||
} finally {
|
||
permissionSaving.value = false
|
||
}
|
||
}
|
||
|
||
const grantedCount = computed(() => grantedUserIds(permissionItems.value).length)
|
||
|
||
// 切公司 = 重新取数,并把上一家的两处遗留一起清掉:
|
||
// ① 店铺名/分组名是自由文本筛选项,上一家填的值在新一家的可见集里不存在 ⇒ 首屏筛成空页;
|
||
// ② 勾选集住的是 resultId,跨公司留着会让「批量下载」把别家店铺的结果文件打进同一个 zip。
|
||
watch(() => companyTab.activeId, () => { filter.shopName = ''; filter.groupName = ''; selection.value = createShopDataSelection(); page.value = 1; cardPage.value = 1; void load() })
|
||
|
||
onMounted(load)
|
||
</script>
|
||
|
||
<template>
|
||
<div class="sd-view">
|
||
<section class="form-box">
|
||
<h3>店铺数据记录</h3>
|
||
<h4 class="sd-filter-title">筛选条件</h4>
|
||
<div class="form-row">
|
||
<div class="form-group" style="min-width: 160px">
|
||
<label>店铺</label>
|
||
<input v-model="filter.shopName" type="text" placeholder="模糊搜索店铺名" @keyup.enter="apply" />
|
||
</div>
|
||
<div v-if="session.isSuperAdmin" class="form-group" style="min-width: 150px">
|
||
<label>分组</label>
|
||
<input v-model="filter.groupName" type="text" placeholder="模糊搜索分组名" @keyup.enter="apply" />
|
||
</div>
|
||
<div class="form-group" style="min-width: 130px">
|
||
<label>国家</label>
|
||
<select v-model="filter.country">
|
||
<option value="">全部</option>
|
||
<option v-for="code in ['UK', 'DE', 'FR', 'ES', 'IT']" :key="code" :value="code">{{ asinCountryLabel(code) }}</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group" style="min-width: 176px">
|
||
<label>创建开始</label>
|
||
<input v-model="filter.dateRange[0]" type="datetime-local" />
|
||
</div>
|
||
<div class="form-group" style="min-width: 176px">
|
||
<label>创建结束</label>
|
||
<input v-model="filter.dateRange[1]" type="datetime-local" />
|
||
</div>
|
||
<button class="btn" type="button" @click="apply">查询</button>
|
||
<button class="btn btn-secondary" type="button" @click="reset">重置</button>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="panel-box">
|
||
<div class="sd-toolbar">
|
||
<div class="sd-toolbar-main">
|
||
<label class="sd-select-all">
|
||
<input type="checkbox" :checked="selectAllChecked()" :indeterminate="selectAllIndeterminate()" @change="toggleSelectAllReady" />
|
||
全选可下载
|
||
</label>
|
||
<button class="btn" type="button" :disabled="selectionCount === 0 || busyKey === 'batch'" @click="downloadBatch">
|
||
批量下载{{ selectionCount ? `(${selectionCount})` : '' }}
|
||
</button>
|
||
<button v-if="session.isSuperAdmin" class="btn btn-secondary" type="button" @click="openPermission">权限配置</button>
|
||
</div>
|
||
<div class="sd-toolbar-side">
|
||
<span class="sd-summary">共 {{ totalShops }} 家店铺 · 本页 {{ resultFileCount() }} 个结果文件</span>
|
||
</div>
|
||
</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"
|
||
>
|
||
<header class="sd-card-head">
|
||
<span class="sd-shop-name" :title="row.shopName || '-'">{{ row.shopName || '-' }}</span>
|
||
</header>
|
||
<div class="sd-card-select-row">
|
||
<input type="checkbox" :checked="rowSelected(row)" :disabled="!isUsableShopDataResult(row)" @change="toggleRow(row)" />
|
||
<span class="shop-card-task-no" :title="`任务 ${row.taskId || row.taskNo || row.resultId}`">任务 {{ row.taskId || row.taskNo || row.resultId }}</span>
|
||
<span class="st-pill" :class="`is-${statusType(row.status)}`">{{ statusLabel(row.status) }}</span>
|
||
</div>
|
||
<div v-if="session.isSuperAdmin && row.groupName" class="sd-card-row">
|
||
<span class="sd-card-label">分组</span>
|
||
<span class="sd-card-value">{{ row.groupName }}</span>
|
||
</div>
|
||
<div class="sd-card-row">
|
||
<span class="sd-card-label">最新</span>
|
||
<span class="sd-card-value">{{ formatDateTime(row.updatedAt || row.createdAt) || '-' }}</span>
|
||
</div>
|
||
<div class="sd-card-row">
|
||
<span class="sd-card-label">国家</span>
|
||
<span class="sd-card-value">
|
||
<span v-for="code in row.countryCodes" :key="code" class="country-chip">{{ asinCountryLabel(code) }}</span>
|
||
<span v-if="!row.countryCodes.length" class="dim">-</span>
|
||
</span>
|
||
</div>
|
||
<div class="sd-card-row">
|
||
<span class="sd-card-label">文件</span>
|
||
<span class="sd-card-value sd-card-file" :title="row.filename">{{ row.filename || '-' }}</span>
|
||
</div>
|
||
<div class="sd-card-actions">
|
||
<button
|
||
class="btn btn-sm"
|
||
type="button"
|
||
:disabled="!isUsableShopDataResult(row) || busyKey === row.resultId"
|
||
@click="downloadRow(row)"
|
||
>
|
||
{{ busyKey === row.resultId ? '下载中...' : '下载文件' }}
|
||
</button>
|
||
<button
|
||
v-if="isTerminalStatus(row.status) && !!row.resultId"
|
||
class="btn btn-sm btn-danger"
|
||
type="button"
|
||
:disabled="deletingKey === row.resultId"
|
||
@click="removeRowByRow(row)"
|
||
>
|
||
{{ deletingKey === row.resultId ? '删除中...' : '删除' }}
|
||
</button>
|
||
</div>
|
||
</article>
|
||
</template>
|
||
<div v-else-if="!loading" class="empty-tip">暂无符合条件的店铺数据记录</div>
|
||
</div>
|
||
|
||
<OldPagination v-if="allResultRows.length > 0" :total="allResultRows.length" :page="cardPage" :page-size="cardPageSize" @change="changeCardPage" @size-change="changeCardSize" />
|
||
</section>
|
||
|
||
<el-dialog v-model="permissionVisible" title="店铺数据记录数据范围授权" width="620px">
|
||
<p class="dim">勾选允许查看/操作店铺数据记录的用户(仅数据范围)。当前已授权 {{ grantedCount }} 人。</p>
|
||
<el-table :data="pagedPermissionItems" border size="small" max-height="420">
|
||
<el-table-column prop="id" label="ID" min-width="80" />
|
||
<el-table-column prop="username" label="用户名" min-width="180" />
|
||
<el-table-column label="授权" min-width="90" align="center">
|
||
<template #default="{ row }">
|
||
<el-checkbox :model-value="(row as TaskPermissionItem).granted" @change="toggleGrant(row as TaskPermissionItem)" />
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<OldPagination v-if="permissionItems.length > permPageSize" :total="permissionItems.length" :page="permPage" :page-size="permPageSize" @change="permPage = $event" @size-change="(s: number) => { permPageSize = s; permPage = 1 }" />
|
||
<template #footer>
|
||
<el-button @click="permissionVisible = false">取消</el-button>
|
||
<el-button type="primary" :loading="permissionSaving" @click="savePermission">保存</el-button>
|
||
</template>
|
||
</el-dialog>
|
||
|
||
<el-dialog v-model="downloadProgress.visible" :title="downloadProgress.label" width="440px" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false">
|
||
<el-progress
|
||
:percentage="downloadProgress.indeterminate ? 50 : downloadProgress.percent"
|
||
:indeterminate="downloadProgress.indeterminate"
|
||
:duration="downloadProgress.indeterminate ? 3 : undefined"
|
||
:stroke-width="14"
|
||
/>
|
||
<p class="sd-progress-hint">{{ downloadProgress.indeterminate ? '正在接收数据,大小未知,请稍候…' : `已完成 ${downloadProgress.percent}%` }}</p>
|
||
</el-dialog>
|
||
</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,
|
||
.form-group select {
|
||
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,
|
||
.form-group select:hover {
|
||
border-color: #9fb7cd;
|
||
}
|
||
.form-group input:focus,
|
||
.form-group select: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>
|