feat(shipping-notice): 人工重取库存前置候选刷新并放开行级库存源下拉
- 人工重试库存准备前置幂等重判:任务级整单重路由、行级定向重评目标行,复用裁决与冻结链路,零新动作码零契约变更 - 新版候选集 supersede 时内置失效旧库存事实,导出归档与查询服务同步适配 - 行级「库存源」下拉抽纯函数合并选项:歧义行候选置顶 + 全部已启用源去重兜底,任一已启用源可人工指定 - 库存源门禁归一 Notice→OT 身份解析;任务中心抽屉与表格接入行级重取入口 - 同步四语言文案、技术文档与实施计划
This commit is contained in:
1 parent
e38e5a63fe
commit
ea94fb28db
35 files changed
+2675
-83
No files matched your search
@@ -90,6 +90,13 @@ export const REVIEW_BUILD_ELIGIBILITY_BLOCKED = 'SHIPPING.REVIEW_BUILD_ELIGIBILI
|
||||
*/
|
||||
export const PROGRESS_POLL_MS = 5000;
|
||||
|
||||
/**
|
||||
* waiting_human / failed 的降频保活间隔。两者不是不可逆终态:自愈回收、
|
||||
* RPA 回调仍会把任务继续推进(历史缺陷:一帧停死令界面永久冻结在旧阶段),
|
||||
* 降频而非停转,状态回到活跃态自动恢复基础间隔。
|
||||
*/
|
||||
export const PROGRESS_POLL_IDLE_MS = 15000;
|
||||
|
||||
/** / Case */
|
||||
export type DraftVersionConflict = {
|
||||
localVersion: number;
|
||||
@@ -449,6 +456,7 @@ export function useShippingOrderReview(options: {
|
||||
// 浏览器端 window.setInterval 返回 number;勿用 ReturnType<typeof window.setInterval>,
|
||||
// 其在 @types/node 与 DOM lib 混用时会解析为 NodeJS.Timeout 导致 TS2322。
|
||||
let progressPollTimer: number | null = null;
|
||||
let progressPollIntervalMs = PROGRESS_POLL_MS;
|
||||
let stpCreatePollTimer: number | null = null;
|
||||
let reparseCaseRefreshTimer: number | null = null;
|
||||
|
||||
@@ -639,15 +647,17 @@ export function useShippingOrderReview(options: {
|
||||
if (!authoritativeOrderTaskNo.value && !targetRunNo) return;
|
||||
showWorkflowProgress.value = true;
|
||||
workflowProgressPolling.value = true;
|
||||
// RPA 超时、可重试失败和人工复核都可能被后续回调推进,页面留存期间持续读取 Projection。
|
||||
// 等待人工(waiting_human,即“中断”)视为线性终态:结果不会自行变化,继续轮询浪费资源。
|
||||
// 注意:统一投影的用户态值是 waiting_human(旧字段是 needs_human),若沿用旧的
|
||||
// needs_human 会让已中断任务永远匹配不到终态、一直空转轮询;failed 同理是停止状态。
|
||||
// 可重试失败(retryable)不在此列,需保留轮询以便后续成功回调自动刷新工作流。
|
||||
const UNIFIED_TERMINAL = new Set(['completed', 'cancelled', 'waiting_human', 'failed']);
|
||||
// RPA 超时、可重试失败、人工复核与自愈回收都可能被后续回调推进,页面留存期间持续
|
||||
// 读取 Projection。completed/cancelled 是不可逆终态,命中即停;waiting_human/failed
|
||||
// 不是终态(自愈回收、回调仍会推进),历史缺陷是一帧停死令界面永久冻结在旧阶段——
|
||||
// 改为降频保活,状态回到活跃态自动恢复基础间隔。
|
||||
const WORKFLOW_STOP_STATUSES = new Set(['completed', 'cancelled']);
|
||||
const WORKFLOW_SLOW_STATUSES = new Set(['waiting_human', 'failed']);
|
||||
let lastUnifiedStatus = '';
|
||||
let lastLifecycleFingerprint = '';
|
||||
const RUN_TERMINAL = new Set(['completed', 'partially_completed', 'failed', 'cancelled']);
|
||||
// Run 级 partially_completed 只代表解析阶段收尾,OT 随后仍会被 STP 建单产出;
|
||||
// 命中即停会令提交订单后的轮询在 OT 诞生前死亡(历史缺陷),同样只降频不停转。
|
||||
const RUN_STOP_STATUSES = new Set(['completed', 'cancelled']);
|
||||
const tick = async () => {
|
||||
// 页面不可见时暂停轮询(返回前台后下一拍自动恢复),避免后台标签持续占用服务端。
|
||||
if (typeof document !== 'undefined' && document.hidden) return;
|
||||
@@ -677,10 +687,13 @@ export function useShippingOrderReview(options: {
|
||||
// 否则提交订单后秒级阻断时五阶段条卡在订单复核、自动跳转永不触发。
|
||||
await refreshActiveAutomationLifecycle();
|
||||
}
|
||||
if (UNIFIED_TERMINAL.has(unifiedStatus)) {
|
||||
if (WORKFLOW_STOP_STATUSES.has(unifiedStatus)) {
|
||||
stopWorkflowProgressPolling();
|
||||
return;
|
||||
}
|
||||
ensureWorkflowProgressInterval(
|
||||
WORKFLOW_SLOW_STATUSES.has(unifiedStatus) ? PROGRESS_POLL_IDLE_MS : PROGRESS_POLL_MS,
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (targetRunNo) {
|
||||
@@ -695,15 +708,26 @@ export function useShippingOrderReview(options: {
|
||||
userTaskNo: reviewProgressContext.value?.user_task_no,
|
||||
});
|
||||
if (synthesized) reviewProgressContext.value = synthesized;
|
||||
if (RUN_TERMINAL.has(String(run.status || '').trim())) {
|
||||
const runStatus = String(run.status || '').trim();
|
||||
if (RUN_STOP_STATUSES.has(runStatus)) {
|
||||
stopWorkflowProgressPolling();
|
||||
return;
|
||||
}
|
||||
ensureWorkflowProgressInterval(runStatus === 'failed' ? PROGRESS_POLL_IDLE_MS : PROGRESS_POLL_MS);
|
||||
}
|
||||
} catch {
|
||||
/* */
|
||||
}
|
||||
};
|
||||
// 状态分级轮询:活跃态基础间隔;waiting_human/failed 降频保活。间隔变化才重建定时器。
|
||||
const ensureWorkflowProgressInterval = (intervalMs: number) => {
|
||||
if (progressPollTimer != null && progressPollIntervalMs === intervalMs) return;
|
||||
if (progressPollTimer != null) window.clearInterval(progressPollTimer);
|
||||
progressPollIntervalMs = intervalMs;
|
||||
progressPollTimer = window.setInterval(() => { void tick(); }, intervalMs);
|
||||
};
|
||||
void tick();
|
||||
progressPollIntervalMs = PROGRESS_POLL_MS;
|
||||
progressPollTimer = window.setInterval(() => { void tick(); }, PROGRESS_POLL_MS);
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* features/chat/shipping/inlineSourceOptions.test.ts
|
||||
*
|
||||
* 用途:行级库存源下拉选项合并的纯函数单测——歧义行候选置顶、全量源兜底去重、空态回退。
|
||||
* 依赖:被测 mergeInlineSourceOptions(无副作用纯函数)。
|
||||
* 逻辑:断言合并顺序(候选在前、已启用源按后端下发序追加)、去重、大小写归一与空态。
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { mergeInlineSourceOptions } from './inlineSourceOptions';
|
||||
|
||||
describe('mergeInlineSourceOptions', () => {
|
||||
it('歧义行候选置顶,后接全部已启用源去重兜底(补源场景:新源出现在末尾)', () => {
|
||||
const options = mergeInlineSourceOptions(
|
||||
{ source_ambiguous: true, source_candidates: ['DSV360_AWSCV', 'DSV360_AWSBI_BYAWSCMH01'] },
|
||||
[{ source_code: 'DSV360_AWSCV' }, { source_code: 'DSV360_AWSDU' }],
|
||||
);
|
||||
expect(options.map((option) => option.value)).toEqual([
|
||||
'DSV360_AWSCV',
|
||||
'DSV360_AWSBI_BYAWSCMH01',
|
||||
'DSV360_AWSDU',
|
||||
]);
|
||||
});
|
||||
|
||||
it('非歧义行仅给全部已启用源(保持既有行为,不前置候选)', () => {
|
||||
const options = mergeInlineSourceOptions(
|
||||
{ source_ambiguous: false, source_candidates: ['DSV360_AWSCV'] },
|
||||
[{ source_code: 'DSV360_AWSDU' }],
|
||||
);
|
||||
expect(options.map((option) => option.value)).toEqual(['DSV360_AWSDU']);
|
||||
});
|
||||
|
||||
it('歧义行候选缺省时退化为全部已启用源,编码统一大写', () => {
|
||||
const options = mergeInlineSourceOptions(
|
||||
{ source_ambiguous: true },
|
||||
[{ source_code: 'dsv360_awssg' }],
|
||||
);
|
||||
expect(options.map((option) => option.value)).toEqual(['DSV360_AWSSG']);
|
||||
});
|
||||
|
||||
it('两侧皆空返回空数组(调用方据此回退文本展示)', () => {
|
||||
expect(mergeInlineSourceOptions({ source_ambiguous: true }, [])).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* features/chat/shipping/inlineSourceOptions.ts
|
||||
*
|
||||
* 用途:通知准备行级「库存源」编辑下拉的选项合并(纯函数,无副作用)。
|
||||
* 依赖:无(仅入参结构约束,类型与 ui_state preparation 投影字段对齐)。
|
||||
* 逻辑:多候选歧义行(source_ambiguous)的路由冻结候选置顶,后接全部已启用库存源
|
||||
* (preparation.source_options)去重兜底——后端 override_line_inventory_source 已放开
|
||||
* 「任一已启用源都允许」,管理端补源后新源即使不在候选内也可人工指定。
|
||||
*/
|
||||
|
||||
/** 行级库存源下拉选项(value=源编码,label=展示编码,统一大写便于识别)。 */
|
||||
export interface InlineSourceOption {
|
||||
value: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
/** 准备行投影中与本合并相关的字段(ui_state preparation.lines[] 子集)。 */
|
||||
export interface InlineSourceLine {
|
||||
source_ambiguous?: boolean;
|
||||
source_candidates?: Array<string>;
|
||||
}
|
||||
|
||||
/** 后端下发的已启用库存源(ui_state preparation.source_options[] 子集)。 */
|
||||
export interface EnabledSourceOption {
|
||||
source_code?: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并行级库存源下拉选项:歧义行候选置顶 + 全部已启用源兜底,按源编码去重保序。
|
||||
* @param line - 准备行(读 source_ambiguous / source_candidates)
|
||||
* @param enabledSources - 后端下发的全部已启用库存源(保持后端排序)
|
||||
* @returns 下拉选项;两侧皆空时返回空数组(调用方据此回退文本展示)
|
||||
*/
|
||||
export function mergeInlineSourceOptions(
|
||||
line: InlineSourceLine,
|
||||
enabledSources: ReadonlyArray<EnabledSourceOption>,
|
||||
): InlineSourceOption[] {
|
||||
const merged = new Map<string, InlineSourceOption>();
|
||||
if (line.source_ambiguous) {
|
||||
for (const raw of line.source_candidates || []) {
|
||||
const code = String(raw || '').trim().toUpperCase();
|
||||
if (code && !merged.has(code)) merged.set(code, { value: code, label: code });
|
||||
}
|
||||
}
|
||||
for (const source of enabledSources) {
|
||||
const code = String(source.source_code || '').trim().toUpperCase();
|
||||
if (code && !merged.has(code)) merged.set(code, { value: code, label: code });
|
||||
}
|
||||
return [...merged.values()];
|
||||
}
|
||||
@@ -922,6 +922,8 @@ export interface ShippingTaskSummary {
|
||||
owner_agent_id?: number | null;
|
||||
/** 当前用户是否可写;管理员查看他人任务时为 false */
|
||||
can_handle?: boolean;
|
||||
/** 当前用户是否可下载正式 Excel(与导出端点同一谓词:创建者或管理员) */
|
||||
can_download_export?: boolean;
|
||||
/** 统一 ShippingProcessing status(列表轮询优先读此字段)。 */
|
||||
shipping_processing_status?: string | null;
|
||||
/** 统一 ShippingProcessing stage(任务中心紧凑进度)。 */
|
||||
|
||||
@@ -52,6 +52,7 @@ import {
|
||||
resolveExtractionActivityMessage,
|
||||
resolveRunLifecycleUserStatus,
|
||||
} from '../shipping/shippingProcessingLabels';
|
||||
import { mergeInlineSourceOptions } from '../shipping/inlineSourceOptions';
|
||||
import ReviewActionConfirmDialog, {
|
||||
type ReviewConfirmAction,
|
||||
type ReviewConfirmPayload,
|
||||
@@ -2654,20 +2655,9 @@ const formalPreparationSourceLocked = computed(() => Boolean(formalPreparationCo
|
||||
/** 库存源选择不再有独立确认流:行进入就地编辑态后在下拉中改选,随行级「保存」统一提交
|
||||
* (override_line_inventory_source Gate 动作,见 saveInlineEdit);展示态回退为文本。 */
|
||||
|
||||
/** 选源下拉项文案:源编码始终可见(等宽语义由样式层保证)。 */
|
||||
function lineSourceOptionLabel(code: string): string {
|
||||
// 兜底:只会展示源编码(如 DSV360_AWSSG),不展示冗长显示名。
|
||||
return String(code || '').trim().toUpperCase();
|
||||
}
|
||||
|
||||
/** 人工覆写库存源(方案 3·放开):后端下发全部已启用源 source_options,供行级下拉人工指定。 */
|
||||
const formSourceOptions = computed(() => formalPreparationContext.value?.source_options || []);
|
||||
|
||||
function overrideSourceOptionLabel(code: string): string {
|
||||
// 兜底:下拉只展示源编码(如 DSV360_AWSSG),不展示冗长 display_name,便于快速识别。
|
||||
return String(code || '').trim().toUpperCase();
|
||||
}
|
||||
|
||||
/** 整单 ODM 裁决列可见性:任一行候选多于一个时展示(候选已经客户范围过滤)。 */
|
||||
const formalPreparationOdmColumnVisible = computed(() =>
|
||||
(formalPreparationContext.value?.lines || []).some((line) => (line.odm_values?.length || 0) > 1),
|
||||
@@ -3051,20 +3041,14 @@ function isInlineEditing(line: { snapshot_line_id?: number | null }): boolean {
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑态库存源下拉选项:多文件冲突行优先取候选源,其余行取全部已启用源;
|
||||
* 行级编辑态库存源下拉选项:歧义行候选置顶 + 全部已启用源兜底(合并去重,纯函数委托)。
|
||||
* 无可用项返回空——此时编辑态库存源保持文本展示(无可选即不可改)。
|
||||
*/
|
||||
function inlineSourceOptions(line: {
|
||||
source_ambiguous?: boolean;
|
||||
source_candidates?: Array<string>;
|
||||
}): Array<{ value: string; label: string }> {
|
||||
if (line.source_ambiguous && (line.source_candidates?.length || 0) > 0) {
|
||||
return (line.source_candidates || []).map((code) => ({ value: String(code), label: lineSourceOptionLabel(String(code)) }));
|
||||
}
|
||||
if (formSourceOptions.value.length) {
|
||||
return formSourceOptions.value.map((s) => ({ value: String(s.source_code), label: overrideSourceOptionLabel(String(s.source_code)) }));
|
||||
}
|
||||
return [];
|
||||
return mergeInlineSourceOptions(line, formSourceOptions.value);
|
||||
}
|
||||
|
||||
/** 同步编辑态库存源草稿(与三个值列一致:改动仅在保存时提交)。 */
|
||||
@@ -3516,9 +3500,11 @@ async function runFreightBatchAction(action: 'download' | 'confirm' | 'rpa') {
|
||||
if (action === 'download') {
|
||||
await downloadWorkspaceShippingNoticeExportArchive(selectedFreightBusinessNos.value);
|
||||
} else if (action === 'confirm') {
|
||||
await batchConfirmWorkspaceShippingNoticesUploaded(selectedFreightBusinessNos.value);
|
||||
const summary = await batchConfirmWorkspaceShippingNoticesUploaded(selectedFreightBusinessNos.value);
|
||||
warnBlockedFreightNoticeResults(summary.results);
|
||||
} else {
|
||||
await batchStartWorkspaceShippingNoticeRpaUpload(selectedFreightBusinessNos.value);
|
||||
const summary = await batchStartWorkspaceShippingNoticeRpaUpload(selectedFreightBusinessNos.value);
|
||||
warnBlockedFreightNoticeResults(summary.results);
|
||||
}
|
||||
// 确认/RPA 后重拉同 PO 通知聚合,使通知完成面能立即呈现最新 uploaded 状态。
|
||||
if (action === 'confirm' || action === 'rpa') {
|
||||
@@ -3554,9 +3540,11 @@ async function runFreightNoticeAction(
|
||||
freightBatchBusy.value = action;
|
||||
try {
|
||||
if (action === 'confirm') {
|
||||
await batchConfirmWorkspaceShippingNoticesUploaded([group.business_no]);
|
||||
const summary = await batchConfirmWorkspaceShippingNoticesUploaded([group.business_no]);
|
||||
warnBlockedFreightNoticeResults(summary.results);
|
||||
} else if (action === 'rpa') {
|
||||
await batchStartWorkspaceShippingNoticeRpaUpload([group.business_no]);
|
||||
const summary = await batchStartWorkspaceShippingNoticeRpaUpload([group.business_no]);
|
||||
warnBlockedFreightNoticeResults(summary.results);
|
||||
} else {
|
||||
if (String(formalTaskDetail.value?.business_no || '').trim() !== group.business_no) return;
|
||||
await submitFormalGateAction('regenerate_excel_artifact');
|
||||
@@ -3577,6 +3565,25 @@ async function runFreightNoticeAction(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量 RPA/确认结果逐单消费:被拦截项的原因必须浮出。
|
||||
* 核心逻辑:批量接口恒返回 202 成功 envelope,逐单 blocked 藏在 results 里
|
||||
* (历史缺陷:前端不检查,界面零反馈,用户以为点击无效——如「库存源尚未确定」)。
|
||||
* blocked 携带后端本地化 message(AppError 在顶层、tool_response 在 result 内),
|
||||
* 去重后合并为一条 warning;accepted 项的状态推进由既有投影刷新呈现。
|
||||
* @param results - 批量接口返回的逐单结果数组。
|
||||
*/
|
||||
function warnBlockedFreightNoticeResults(results: Array<Record<string, unknown>> | undefined): void {
|
||||
const reasons = new Set<string>();
|
||||
for (const item of results || []) {
|
||||
if (String(item?.status || '') !== 'blocked') continue;
|
||||
const detail = item as { message?: unknown; code?: unknown; result?: { message?: unknown } };
|
||||
const reason = String(detail.message || detail.result?.message || detail.code || '').trim();
|
||||
if (reason) reasons.add(reason);
|
||||
}
|
||||
if (reasons.size) msg.warning(Array.from(reasons).join(';'));
|
||||
}
|
||||
|
||||
/** 当前任务的 Excel 重生只可映射到其自身 business_no,禁止跨 PO/通知单展示。 */
|
||||
function canRegenerateFreightNotice(group: ShippingFreightNoticeGroup): boolean {
|
||||
return canRunFreightNoticeAction(group, 'regenerate_excel_artifact')
|
||||
|
||||
+2
@@ -147,6 +147,8 @@ function notice(businessNo: string, poNumber: string, partNumber: string) {
|
||||
id: Number(businessNo.slice(-2)), task_no: `SN-${businessNo}`, business_no: businessNo,
|
||||
item_kind: 'task', todo_ref: `SN-${businessNo}`, source_type: 'post_ot_fulfillment_wave',
|
||||
po_number: poNumber, customer_name: 'Customer', upload_status: 'pending',
|
||||
// 后端 SUMMARY 契约:下载能力与导出端点同一谓词(创建者或管理员)。
|
||||
can_download_export: true,
|
||||
ui_state: { stage: { code: 'freight_upload', label: '货代上传' }, lifecycle_entries: [] },
|
||||
notice_line_summary: [
|
||||
{ line_no: '10', part_number: partNumber, shipment_qty: '4', available_qty: '9' },
|
||||
|
||||
@@ -38,7 +38,7 @@ import { useShippingTodoBadge } from '../composables/useShippingTodoBadge';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import {
|
||||
isFreightUploadRow,
|
||||
isBatchDownloadableRow,
|
||||
lifecycleStageCodeOf,
|
||||
todoItemKey,
|
||||
type LifecycleStageCode,
|
||||
@@ -134,8 +134,8 @@ const filteredTasks = computed(() => (
|
||||
? tasks.value
|
||||
: tasks.value.filter((item) => lifecycleStageCodeOf(item) === lifecycleStageFilter.value)
|
||||
));
|
||||
/** 批量可选行:货代上传阶段的正式 Notice(业务约束:批量仅该阶段可用)。 */
|
||||
const selectableRows = computed(() => filteredTasks.value.filter((item) => isFreightUploadRow(item)));
|
||||
/** 批量可选行:货代上传阶段的正式 Notice 且当前用户可下载(与批量导出端点同口径)。 */
|
||||
const selectableRows = computed(() => filteredTasks.value.filter((item) => isBatchDownloadableRow(item)));
|
||||
const selectedBusinessNoSet = computed(() => new Set(selectedBusinessNos.value));
|
||||
|
||||
/** 当前桶是否为通知完成明细报表视图。 */
|
||||
@@ -366,7 +366,7 @@ async function loadTodos(resetPage = false, options?: { silent?: boolean }) {
|
||||
tasks.value = result.items || [];
|
||||
const visibleBusinessNos = new Set(
|
||||
tasks.value
|
||||
.filter((item) => isFreightUploadRow(item))
|
||||
.filter((item) => isBatchDownloadableRow(item))
|
||||
.map((item) => String(item.business_no || '').trim()),
|
||||
);
|
||||
selectedBusinessNos.value = selectedBusinessNos.value.filter((value) => visibleBusinessNos.has(value));
|
||||
|
||||
@@ -137,6 +137,9 @@ const exportFileName = computed(() => String(
|
||||
props.item?.artifact_summary?.export_file_name || '',
|
||||
));
|
||||
|
||||
/** 下载能力由后端统一谓词下发(创建者或管理员);缺失按不可下载处理。 */
|
||||
const canDownloadExport = computed(() => props.item?.can_download_export === true);
|
||||
|
||||
const lineRows = computed(() => {
|
||||
const item = props.item as ShippingTaskSummary | null;
|
||||
return Array.isArray(item?.notice_line_summary) ? item!.notice_line_summary : [];
|
||||
@@ -376,7 +379,7 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onEsc));
|
||||
{{ $t('chat.shippingOrderReview.autoProgress.retryStp') }}
|
||||
</button>
|
||||
<a
|
||||
v-if="exportFileName"
|
||||
v-if="exportFileName && canDownloadExport"
|
||||
class="inline-flex cursor-pointer items-center gap-1 text-xs text-brand-700 hover:underline"
|
||||
:href="`/api/workspace/shipping-notices/${encodeURIComponent(String(item.business_no || ''))}/export`"
|
||||
target="_blank"
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useI18n } from 'vue-i18n';
|
||||
import { CheckSquare, Download, Upload, X } from 'lucide-vue-next';
|
||||
import type { ShippingTaskSummary } from '@/features/chat/api/shipping.api';
|
||||
import {
|
||||
isFreightUploadRow,
|
||||
isBatchDownloadableRow,
|
||||
lifecycleStageCodeOf,
|
||||
todoBlockerText,
|
||||
todoDisplayNo,
|
||||
@@ -46,7 +46,8 @@ const emit = defineEmits<{
|
||||
}>();
|
||||
|
||||
const selectedSet = computed(() => new Set(props.selectedBusinessNos || []));
|
||||
const selectableRows = computed(() => props.items.filter((item) => isFreightUploadRow(item)));
|
||||
/** 复选框与全选状态消费同一可下载谓词,保证"能勾的都能下单成功"。 */
|
||||
const selectableRows = computed(() => props.items.filter((item) => isBatchDownloadableRow(item)));
|
||||
const hasSelection = computed(() => (props.selectedBusinessNos?.length || 0) > 0);
|
||||
const allSelectableChecked = computed(() => (
|
||||
selectableRows.value.length > 0
|
||||
@@ -158,7 +159,7 @@ function onToggleAll(): void {
|
||||
>
|
||||
<td v-if="selectable" class="px-3 py-2.5 align-middle">
|
||||
<input
|
||||
v-if="isFreightUploadRow(item)"
|
||||
v-if="isBatchDownloadableRow(item)"
|
||||
type="checkbox"
|
||||
:checked="selectedSet.has(String(item.business_no))"
|
||||
:aria-label="String(item.business_no)"
|
||||
|
||||
@@ -172,3 +172,12 @@ export function isFreightUploadRow(item: ShippingTaskSummary): boolean {
|
||||
return Boolean(String(item.business_no || '').trim())
|
||||
&& lifecycleStageCodeOf(item) === 'freight_upload';
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量可下载行:在上传阶段约束之上叠加下载授权谓词字段(创建者或管理员)。
|
||||
* 核心逻辑:与后端 /shipping-notices/batch/export 同一口径,无权行不可勾选,
|
||||
* 避免"勾了下单却整体 404"的体验;字段缺失(异常路径)按不可下载处理。
|
||||
*/
|
||||
export function isBatchDownloadableRow(item: ShippingTaskSummary): boolean {
|
||||
return isFreightUploadRow(item) && item.can_download_export === true;
|
||||
}
|
||||
Reference in new issue
Block a user