fix: 简化追溯码导出按钮
This commit is contained in:
@@ -17,12 +17,10 @@
|
||||
<template #icon><n-icon :component="FolderOutline" /></template>
|
||||
{{ t('pages.traceCode.manageGroups') }}
|
||||
</n-button>
|
||||
<n-dropdown v-if="auth.canWrite" trigger="click" :options="exportOptions" @select="onExport">
|
||||
<n-button>
|
||||
<template #icon><n-icon :component="DownloadOutline" /></template>
|
||||
{{ t('common.action.export') }}
|
||||
</n-button>
|
||||
</n-dropdown>
|
||||
<n-button v-if="auth.canWrite" @click="onExport">
|
||||
<template #icon><n-icon :component="DownloadOutline" /></template>
|
||||
{{ exportButtonText }}
|
||||
</n-button>
|
||||
<n-button v-if="auth.canWrite" type="primary" @click="openGenerate">
|
||||
<template #icon><n-icon :component="AddOutline" /></template>
|
||||
{{ t('pages.traceCode.generate') }}
|
||||
@@ -562,22 +560,25 @@ async function showQr(r: any) {
|
||||
qrModal.value = true;
|
||||
}
|
||||
|
||||
const exportOptions = computed(() => {
|
||||
const cur = t('pages.traceCode.exportCurrent');
|
||||
const opts: Array<{ label: string; key: string }> = [
|
||||
{ label: cur, key: 'filter' },
|
||||
];
|
||||
if (checkedKeys.value.length) {
|
||||
const sel = t('pages.traceCode.selected', { n: checkedKeys.value.length });
|
||||
opts.push({ label: sel, key: 'selected' });
|
||||
}
|
||||
return opts;
|
||||
const hasActiveExportFilter = computed(() => Boolean(
|
||||
query.keyword ||
|
||||
query.groupId ||
|
||||
query.batchId ||
|
||||
query.status ||
|
||||
query.outboundStatus ||
|
||||
(!fixedArtworkId.value && query.artworkId),
|
||||
));
|
||||
|
||||
const exportButtonText = computed(() => {
|
||||
const base = t('common.action.export');
|
||||
if (checkedKeys.value.length) return `${base}(${t('pages.traceCode.selected', { n: checkedKeys.value.length })})`;
|
||||
if (hasActiveExportFilter.value) return `${base}(${t('pages.traceCode.exportCurrent')})`;
|
||||
return base;
|
||||
});
|
||||
|
||||
async function onExport(key: string) {
|
||||
const scope = key;
|
||||
async function onExport() {
|
||||
const params: Record<string, unknown> = {};
|
||||
if (scope === 'selected') {
|
||||
if (checkedKeys.value.length) {
|
||||
params.ids = checkedKeys.value.map(String).join(',');
|
||||
} else {
|
||||
const aid = currentArtworkId();
|
||||
|
||||
@@ -344,7 +344,7 @@
|
||||
"registerOutbound": "登记出库/上链",
|
||||
"enableOne": "启用",
|
||||
"disableOne": "禁用",
|
||||
"selected": "已选 {n} 项",
|
||||
"selected": "已选{n}项",
|
||||
"assignGroup": "设为分组"
|
||||
},
|
||||
"outbound": {
|
||||
|
||||
Reference in New Issue
Block a user