feat(in-transit-transfer): 更新证据下载与待匹配清单逻辑
- 修改证据下载接口,分别签发预览地址与带保存名的下载地址,避免浏览器使用对象键哈希作为保存名。 - 待匹配清单接口调整,按外部单号合计数量,不再返回外部项次,提升数据展示的清晰度。 - 移除待匹配桶的「清空并重新解析」功能,简化操作流程,确保用户体验一致性。 - 新增跨页全选支持的 API,允许用户在待处理池中选择全部待处理明细 ID,优化批量操作体验。
This commit is contained in:
1 parent
4c2a7e2a23
commit
663f401873
50 files changed
+2156
-1309
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
features/chat/components/messages/TransferBacklogSummaryCard.vue
|
||||
用途:待处理异常卡(可恢复/已关闭/结果未知三组)——列与匹配窗口一致,
|
||||
支持关键字/结果筛选、多选批量操作(重查/恢复/关闭)与行级快捷操作。
|
||||
支持关键字/结果筛选、多选批量操作(重查库存/关闭)与行级快捷操作。
|
||||
依赖:Element Plus ElTable/ElTableColumn/ElSelect/ElOption/ElPagination/
|
||||
ElInput/ElButton/ElTag/ElCheckbox(2026-10-20:勾选列一并 EP;testid 挂
|
||||
el-checkbox,规格经内层 input 读写)、
|
||||
@@ -12,18 +12,24 @@
|
||||
由宿主经 useChatTransfer.loadBacklog 拉取当前页;行渲染/勾选/批量语义:
|
||||
仅 blocked_recoverable 可勾选与操作;result_unknown / manually_closed 只读;
|
||||
可恢复行按 result_code 细分徽标(blocked_file_removed=文件已移除);
|
||||
blocked_file_removed 行行内仅留「关闭」(重查不可恢复——消失证据
|
||||
无法由重查翻回,唯一出口=人工关闭或等文件重新同步);
|
||||
批量按钮与行内按钮同用短文案键(重查/恢复/关闭,2026-10-12 文案一致化,
|
||||
完整语义经 title 悬浮)。
|
||||
blocked_file_removed 行行内仅留「关闭」(消失证据无法由重查翻回,
|
||||
唯一出口=人工关闭或等文件重新同步);
|
||||
批量与行内都只有「重查库存」和「关闭」。重查库存与恢复是同一次 ERP 核对,
|
||||
2026-10-22 起不再并列两个按钮。
|
||||
调拨类型列取行上 transfer_type,按启用类型配置显示当前语言名称。
|
||||
勾选集合跨页保留(翻页/筛选不清空;批量计数=勾选总数,后端逐行校验兜底);
|
||||
关键字 300ms 防抖后上抛,筛选/翻页变更即上抛,首挂载上抛初始切片查询
|
||||
(首页计数卡进入时 initialFilter 直接生效)。
|
||||
行定位:el-table 行不支持逐行 attr,行 testid 改经 row-class-name 注入
|
||||
(transfer-backlog-row-<invoice_no>,spec/e2e 用类选择器等价定位)。
|
||||
[2026-10-22 跨页全选] 服务端分页下表头全选只能覆盖当前页——Gmail 式补链:
|
||||
有勾选且未全选时透出「选择全部 N 行(按当前筛选)」,点击经
|
||||
GET /backlog/item-ids 按同一筛选口径拉全量 id 合并进勾选集合(批量端点
|
||||
按 item_ids 列表逐行校验,无需新批量契约);拉取失败经 useMessage 行内报错。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElButton,
|
||||
ElCheckbox,
|
||||
@@ -36,12 +42,15 @@ import {
|
||||
ElTag,
|
||||
} from 'element-plus';
|
||||
import type { CheckboxValueType } from 'element-plus';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { fetchBacklogSelectableItemIds } from '../../api/transfer.api';
|
||||
import { TRANSFER_PAGE_SIZE } from '../../composables/useChatTransfer';
|
||||
import { deriveBatchNo } from './transferBatch';
|
||||
import { formatQuantity } from './transferFormat';
|
||||
import type { TransferBacklogItem } from '../../types/transfer.types';
|
||||
import { transferTypeDisplay } from './transferTypeLabel';
|
||||
import type { TransferBacklogItem, TransferTypeOption } from '../../types/transfer.types';
|
||||
|
||||
const props = defineProps<{
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 当前页行切片(服务端分页返回;筛选在服务端执行)。 */
|
||||
items: TransferBacklogItem[];
|
||||
/** 筛选后全量计数(分页器数据源;不传视为 0=隐藏分页条)。 */
|
||||
@@ -49,12 +58,27 @@ const props = defineProps<{
|
||||
busy?: boolean;
|
||||
/** 初始结果筛选(首页计数卡切片进入:closed 卡落「已关闭」切片等)。 */
|
||||
initialFilter?: 'all' | 'recoverable' | 'closed' | 'unknown';
|
||||
}>();
|
||||
/** 启用中的调拨类型。用来把行上的 code 显示成当前语言名称。 */
|
||||
transferTypes?: TransferTypeOption[];
|
||||
}>(), {
|
||||
transferTypes: () => [],
|
||||
});
|
||||
|
||||
const { locale } = useI18n();
|
||||
|
||||
/**
|
||||
* 把待处理行的调拨类型 code 显示成名称。
|
||||
* 核心逻辑:复用 transferTypeDisplay;没有类型时显示 —。
|
||||
* @param code - 行上的 transfer_type
|
||||
* @returns 当前语言名称、编码或占位
|
||||
*/
|
||||
function typeLabel(code: string | null | undefined): string {
|
||||
return transferTypeDisplay(code, props.transferTypes, locale.value);
|
||||
}
|
||||
|
||||
const emit = defineEmits<{
|
||||
refresh: [];
|
||||
retry: [itemId: number];
|
||||
resume: [itemIds: number[]];
|
||||
/** 行级与批量共用:按明细 id 重查 ERP 库存。 */
|
||||
requery: [itemIds: number[]];
|
||||
close: [item: TransferBacklogItem];
|
||||
batchClose: [itemIds: number[]];
|
||||
@@ -111,6 +135,35 @@ function clearSelection() {
|
||||
selectedIds.value = new Set();
|
||||
}
|
||||
|
||||
const { error: notifyError } = useMessage();
|
||||
|
||||
/** 跨页全选拉取进行中(防重入)。 */
|
||||
const selectAllBusy = ref(false);
|
||||
|
||||
/** 跨页全选入口可见性:有筛选总量且勾选未覆盖全量时透出(选完后自动隐藏)。 */
|
||||
const showSelectAll = computed(() => (props.total ?? 0) > selectedIds.value.size);
|
||||
|
||||
/**
|
||||
* 跨页全选(Gmail 式,2026-10-22):按当前筛选拉取全部待处理明细 id 合并进勾选集合。
|
||||
* 服务端分页下表头全选只覆盖当前页;批量端点按 item_ids 列表逐行校验,全量 id 直接复用
|
||||
* (GET /backlog/item-ids,keyword/result_filter 与当前筛选同源)。
|
||||
*/
|
||||
async function selectAllMatching() {
|
||||
if (selectAllBusy.value) return;
|
||||
selectAllBusy.value = true;
|
||||
try {
|
||||
const data = await fetchBacklogSelectableItemIds({
|
||||
keyword: keyword.value,
|
||||
resultFilter: resultFilter.value,
|
||||
});
|
||||
selectedIds.value = new Set(data.ids.map((id) => Number(id)));
|
||||
} catch (e) {
|
||||
notifyError(e instanceof Error ? e.message : String(e));
|
||||
} finally {
|
||||
selectAllBusy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// [STEP 1] 查询上抛:翻页/筛选立即上抛,关键字 300ms 防抖(服务端逐次查询防抖动);
|
||||
// 首挂载即上抛初始切片查询(宿主不再兜底首拉,避免双请求)。
|
||||
function emitQuery() {
|
||||
@@ -193,6 +246,19 @@ function resultLabelKey(item: TransferBacklogItem): string {
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 跨页全选入口(Gmail 式,2026-10-22):服务端分页下表头全选只覆盖当前页,
|
||||
有未选中行时透出「选择全部 N 行」,按当前筛选拉全量 id 合并进勾选集合
|
||||
(testid 独立于表头全选 checkbox 的 transfer-backlog-select-all) -->
|
||||
<div v-if="showSelectAll" class="mb-2 text-xs">
|
||||
<button
|
||||
type="button"
|
||||
class="text-secondary underline decoration-dotted underline-offset-2 disabled:opacity-50"
|
||||
:disabled="selectAllBusy"
|
||||
data-testid="transfer-backlog-select-all-matching"
|
||||
@click="selectAllMatching"
|
||||
>{{ $t('chat.transfer.selectAllRows', { count: total ?? 0 }) }}</button>
|
||||
</div>
|
||||
|
||||
<!-- 批量操作条:勾选 ≥1 行时原位替换筛选区(跨页勾选同样计入) -->
|
||||
<div v-if="selectedActionableIds.length" class="mb-2 flex flex-wrap items-center gap-2">
|
||||
<span class="text-xs font-bold text-secondary" data-testid="transfer-backlog-selected-count">
|
||||
@@ -206,20 +272,7 @@ function resultLabelKey(item: TransferBacklogItem): string {
|
||||
:disabled="busy"
|
||||
@click="emit('requery', selectedActionableIds)"
|
||||
>
|
||||
{{ $t('chat.transfer.requeryRow') }}({{ selectedActionableIds.length }})
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
plain
|
||||
data-testid="transfer-backlog-batch-resume"
|
||||
:disabled="busy"
|
||||
:title="$t('chat.transfer.resumeAction')"
|
||||
@click="emit('resume', selectedActionableIds)"
|
||||
>
|
||||
<!-- [2026-10-12 文案一致化] 批量按钮与行内按钮同用短文案键(恢复/关闭),
|
||||
勾选计数保留;完整语义经 title 悬浮透出(与行内按钮同模式) -->
|
||||
{{ $t('chat.transfer.resumeActionShort') }}({{ selectedActionableIds.length }})
|
||||
{{ $t('chat.transfer.requeryStock') }}({{ selectedActionableIds.length }})
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
@@ -297,6 +350,11 @@ function resultLabelKey(item: TransferBacklogItem): string {
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('chat.transfer.colSource')" prop="source_code" min-width="110" class-name="whitespace-nowrap" />
|
||||
<el-table-column :label="$t('chat.transfer.transferTypeLabel')" min-width="140" class-name="whitespace-nowrap">
|
||||
<template #default="{ row }">
|
||||
<span :data-testid="`transfer-backlog-type-${row.invoice_no}`">{{ typeLabel(row.transfer_type) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('chat.transfer.colInvoice')" prop="invoice_no" min-width="130" class-name="whitespace-nowrap">
|
||||
<template #default="{ row }">
|
||||
<span class="font-semibold">{{ row.invoice_no }}</span>
|
||||
@@ -343,8 +401,7 @@ function resultLabelKey(item: TransferBacklogItem): string {
|
||||
<el-table-column :label="$t('chat.transfer.colAction')" min-width="150" class-name="whitespace-nowrap">
|
||||
<template #default="{ row }">
|
||||
<template v-if="isActionable(row as TransferBacklogItem)">
|
||||
<!-- 失效行(文件已移除)隐藏重查/恢复处理:重查会被后端拒绝
|
||||
(TRANSFER.RETRY_NOT_ALLOWED),恢复处理也无济于事,只留关闭出口 -->
|
||||
<!-- 失效行(文件已移除)只留关闭:重查会被后端拒绝(TRANSFER.RETRY_NOT_ALLOWED)。 -->
|
||||
<el-button
|
||||
v-if="!isFileRemoved(row as TransferBacklogItem)"
|
||||
link
|
||||
@@ -352,21 +409,9 @@ function resultLabelKey(item: TransferBacklogItem): string {
|
||||
size="small"
|
||||
:data-testid="`transfer-backlog-requery-${row.invoice_no}`"
|
||||
:disabled="busy"
|
||||
@click="emit('retry', row.item_id)"
|
||||
@click="emit('requery', [row.item_id])"
|
||||
>
|
||||
{{ $t('chat.transfer.requeryRow') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="!isFileRemoved(row as TransferBacklogItem)"
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:title="$t('chat.transfer.resumeAction')"
|
||||
:data-testid="`transfer-backlog-resume-${row.invoice_no}`"
|
||||
:disabled="busy"
|
||||
@click="emit('resume', [row.item_id])"
|
||||
>
|
||||
{{ $t('chat.transfer.resumeActionShort') }}
|
||||
{{ $t('chat.transfer.requeryStock') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
|
||||
Reference in new issue
Block a user