fix: 看板已激活追溯码与列表口径一致,修正未激活筛选返回已激活的码
This commit is contained in:
@@ -258,6 +258,8 @@ const query = reactive<{
|
||||
batchId: number | null;
|
||||
status: string | null;
|
||||
outboundStatus: string | null;
|
||||
// 是否激活过:YES 有激活时间,NO 从未激活。与看板「已激活追溯码」同一口径
|
||||
activated: string | null;
|
||||
keyword: string;
|
||||
}>({
|
||||
artworkId: fixedArtworkId.value,
|
||||
@@ -265,6 +267,7 @@ const query = reactive<{
|
||||
batchId: null,
|
||||
status: null,
|
||||
outboundStatus: null,
|
||||
activated: null,
|
||||
keyword: '',
|
||||
});
|
||||
const { pagination, page, pageSize, resetPage, setPageResult } = useTablePage(load, embedded.value ? 20 : 20);
|
||||
@@ -274,6 +277,11 @@ const outboundStatusOptions = computed(() => [
|
||||
{ label: t('pages.traceCode.outRegistered'), value: 'OUTBOUND' },
|
||||
{ label: t('pages.traceCode.notOutbound'), value: 'NOT_OUTBOUND' },
|
||||
]);
|
||||
const activatedOptions = computed(() => [
|
||||
{ label: t('pages.traceCode.everActivated'), value: 'YES' },
|
||||
{ label: t('pages.traceCode.neverActivated'), value: 'NO' },
|
||||
]);
|
||||
const activatedParam = () => (query.activated === 'YES' ? true : query.activated === 'NO' ? false : undefined);
|
||||
|
||||
const batchOptions = ref<{ label: string; value: number }[]>([]);
|
||||
const batchMoveOptions = computed(() => batchOptions.value.map((b) => ({ label: b.label, value: b.value })));
|
||||
@@ -471,7 +479,14 @@ const columns = computed<DataTableColumns<any>>(() => {
|
||||
// 查询次数
|
||||
{ title: () => t('pages.traceCode.queryCount'), key: 'queryCount', width: 100, align: 'center' },
|
||||
// 激活时间
|
||||
{ title: () => t('pages.traceCode.firstActivatedAt'), key: 'firstActivatedAt', width: 150, align: 'center', render: (r) => fmt(r.firstActivatedAt), ...sortProps('firstActivatedAt') },
|
||||
{
|
||||
title: () => renderFilterTitle(t('pages.traceCode.firstActivatedAt'), query.activated, activatedOptions.value, (value) => setHeaderFilter('activated', value)),
|
||||
key: 'firstActivatedAt',
|
||||
width: 170,
|
||||
align: 'center',
|
||||
render: (r) => fmt(r.firstActivatedAt),
|
||||
...sortProps('firstActivatedAt'),
|
||||
},
|
||||
// 链接:拦截直跳,先告知「直接访问会激活/计数」,再让用户选预览或实际访问
|
||||
{
|
||||
title: () => t('pages.traceCode.url'),
|
||||
@@ -592,7 +607,7 @@ function confirmVisitReal(row: any) {
|
||||
});
|
||||
}
|
||||
|
||||
type HeaderFilterField = 'batchId' | 'groupId' | 'status' | 'outboundStatus';
|
||||
type HeaderFilterField = 'batchId' | 'groupId' | 'status' | 'outboundStatus' | 'activated';
|
||||
type HeaderFilterValue = string | number | null;
|
||||
type HeaderFilterOption = { label: string; value: string | number };
|
||||
|
||||
@@ -626,6 +641,8 @@ function renderFilterTitle(
|
||||
size: 'tiny',
|
||||
class: ['filter-trigger', { active }],
|
||||
title: t('pages.traceCode.tableFilter'),
|
||||
// 可排序的列点表头会切换排序,点筛选按钮时不要连带触发
|
||||
onClick: (event: MouseEvent) => event.stopPropagation(),
|
||||
},
|
||||
{ icon: () => h(NIcon, null, { default: () => h(FilterOutline) }) },
|
||||
),
|
||||
@@ -673,6 +690,7 @@ async function load() {
|
||||
batchId: query.batchId || undefined,
|
||||
status: query.status || undefined,
|
||||
outboundStatus: query.outboundStatus || undefined,
|
||||
activated: activatedParam(),
|
||||
keyword: query.keyword || undefined,
|
||||
page: page.value,
|
||||
pageSize: pageSize.value,
|
||||
@@ -759,6 +777,7 @@ const hasActiveExportFilter = computed(() => Boolean(
|
||||
query.batchId ||
|
||||
query.status ||
|
||||
query.outboundStatus ||
|
||||
query.activated ||
|
||||
(!fixedArtworkId.value && query.artworkId),
|
||||
));
|
||||
|
||||
@@ -781,6 +800,7 @@ async function onExport() {
|
||||
if (query.batchId) params.batchId = query.batchId;
|
||||
if (query.status) params.status = query.status;
|
||||
if (query.outboundStatus) params.outboundStatus = query.outboundStatus;
|
||||
if (query.activated) params.activated = activatedParam();
|
||||
if (query.keyword) params.keyword = query.keyword;
|
||||
}
|
||||
exporting.value = true;
|
||||
@@ -1142,6 +1162,7 @@ onMounted(async () => {
|
||||
genForm.artworkId = aid;
|
||||
}
|
||||
if (typeof route.query.status === 'string') query.status = route.query.status;
|
||||
if (route.query.activated === '1') query.activated = 'YES';
|
||||
}
|
||||
await Promise.all([loadBatches(), loadGroups()]);
|
||||
await load();
|
||||
|
||||
Reference in New Issue
Block a user