Merge branch 'dev' into order-delivery-reply
# Conflicts: # backend/app/services/schedule/job_options.py # frontend/src/locales/th/admin.json # frontend/src/locales/zh-TW/admin.json
This commit is contained in:
commit
f0ac888d60
144 files changed
+10193
-2156
No files matched your search
@@ -159,6 +159,9 @@ export const adminRunExcelUrl = (runId: number) => `/api/admin/schedule-runs/${r
|
||||
export const adminRunInventoryRawZipUrl = (runId: number) =>
|
||||
`/api/admin/schedule-runs/${runId}/inventory-raw-zip`;
|
||||
|
||||
export const adminRunReceiptRawZipUrl = (runId: number) =>
|
||||
`/api/admin/schedule-runs/${runId}/receipt-raw-zip`;
|
||||
|
||||
export interface RpaWorkerHeartbeatWorker {
|
||||
worker_id?: string;
|
||||
hostname?: string;
|
||||
@@ -178,6 +181,7 @@ export interface RpaWorkerHeartbeatWorker {
|
||||
}
|
||||
|
||||
export interface RpaWorkerHeartbeatSummary {
|
||||
scope?: 'inventory' | 'receipt' | string;
|
||||
ready: boolean;
|
||||
message: string;
|
||||
detail_message?: string;
|
||||
@@ -191,7 +195,7 @@ export interface RpaWorkerHeartbeatSummary {
|
||||
workers: RpaWorkerHeartbeatWorker[];
|
||||
}
|
||||
|
||||
export const getAdminRpaWorkersStatus = () =>
|
||||
getJson<RpaWorkerHeartbeatSummary>('/api/admin/rpa-workers/status');
|
||||
export const getAdminRpaWorkersStatus = (scope: 'inventory' | 'receipt' = 'inventory') =>
|
||||
getJson<RpaWorkerHeartbeatSummary>(`/api/admin/rpa-workers/status?scope=${encodeURIComponent(scope)}`);
|
||||
|
||||
export type { DifyExecutionSnapshot, ScheduleRun, ScheduleTask, StepLog, TestScheduleRunResult, TestScheduleSqlResult };
|
||||
@@ -36,7 +36,7 @@ const admin = useSchedulesAdminContext();
|
||||
</div>
|
||||
<button
|
||||
class="inline-flex items-center gap-2 admin-panel px-5 py-2.5 text-sm font-semibold text-secondary transition hover:bg-surface-soft"
|
||||
@click="admin.loadSchedules"
|
||||
@click="() => void admin.loadSchedules()"
|
||||
>
|
||||
<RefreshCw class="h-5 w-5" />
|
||||
{{ $t('admin.schedule.refresh') }}
|
||||
|
||||
+5
-2
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* features/admin/modules/schedules/components/ScheduleWorkbenchPanel.spec.ts
|
||||
* 用途:断言执行记录页不默认展示原始库存下载;仅企微深链 raw_zip=1 时突出下载入口。
|
||||
* 用途:断言执行记录页不默认展示原始库存/收料下载;仅企微深链 raw_zip=1 时突出下载入口。
|
||||
*/
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
@@ -11,13 +11,16 @@ describe('ScheduleWorkbenchPanel run table actions', () => {
|
||||
const panelPath = resolve(__dirname, 'ScheduleWorkbenchPanel.vue');
|
||||
const content = readFileSync(panelPath, 'utf8');
|
||||
expect(content).not.toMatch(/downloadScheduleInventoryRawZip\(r\.id\)/);
|
||||
expect(content).not.toMatch(/downloadScheduleReceiptRawZip\(r\.id\)/);
|
||||
});
|
||||
|
||||
it('only shows raw inventory download when wecom deep link prompt is active', () => {
|
||||
it('only shows raw inventory/receipt download when wecom deep link prompt is active', () => {
|
||||
const panelPath = resolve(__dirname, 'ScheduleWorkbenchPanel.vue');
|
||||
const content = readFileSync(panelPath, 'utf8');
|
||||
expect(content).toMatch(/wecomRawZipPromptRunId/);
|
||||
expect(content).not.toMatch(/v-if="admin\.expandedScheduleRun\.inventory_raw_zip_available"/);
|
||||
expect(content).not.toMatch(/v-if="admin\.expandedScheduleRun\.receipt_raw_zip_available"/);
|
||||
expect(content).toMatch(/admin\.wecomRawZipPromptRunId === admin\.expandedScheduleRun\.id/);
|
||||
expect(content).toMatch(/downloadScheduleReceiptRawZip/);
|
||||
});
|
||||
});
|
||||
+22
-2
@@ -34,7 +34,13 @@ const admin = useSchedulesAdminContext();
|
||||
</div>
|
||||
<div class="admin-stat-tile px-4 py-3 text-center">
|
||||
<div class="text-base font-semibold text-amber-600">{{ admin.selectedScheduleRunMetrics.skipped }}</div>
|
||||
<div class="mt-1 text-xs text-muted">{{ $t('admin.schedule.totalSkipped') }}</div>
|
||||
<div class="mt-1 text-xs text-muted">{{
|
||||
admin.isReceiptRpaSchedule
|
||||
? $t('admin.schedule.totalSkippedReceipt')
|
||||
: admin.isInventoryRpaSchedule
|
||||
? $t('admin.schedule.totalSkippedInventory')
|
||||
: $t('admin.schedule.totalSkipped')
|
||||
}}</div>
|
||||
</div>
|
||||
<div class="admin-stat-tile px-4 py-3 text-center">
|
||||
<div class="text-base font-semibold text-rose-600">{{ admin.selectedScheduleRunMetrics.failed }}</div>
|
||||
@@ -131,7 +137,7 @@ const admin = useSchedulesAdminContext();
|
||||
<p class="mt-1 text-sm text-muted">{{ $t('admin.schedule.recordsSubtitle') }}</p>
|
||||
</div>
|
||||
<div
|
||||
v-if="admin.isInventoryRpaSchedule"
|
||||
v-if="admin.showsRpaWorkerStatus"
|
||||
class="inline-flex items-center gap-2 rounded-lg border border-default px-3 py-2 text-xs"
|
||||
>
|
||||
<span class="text-muted">{{ $t('admin.schedule.rpaWorker.title') }}</span>
|
||||
@@ -310,6 +316,20 @@ const admin = useSchedulesAdminContext();
|
||||
{{ $t('admin.schedule.downloadInventoryRawZipPackage') }}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-if="admin.wecomRawZipPromptRunId === admin.expandedScheduleRun.id && admin.expandedScheduleRun.receipt_raw_zip_available"
|
||||
class="rounded-xl border border-blue-200 bg-blue-50/80 p-4"
|
||||
>
|
||||
<p class="text-sm font-medium text-blue-900">{{ $t('admin.schedule.rawReceiptZipWecomHint') }}</p>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-3 inline-flex items-center gap-2 rounded-xl border border-blue-300 bg-surface px-4 py-2 text-sm font-semibold text-blue-700 shadow-sm transition-colors hover:bg-blue-50"
|
||||
@click="admin.downloadScheduleReceiptRawZip(admin.expandedScheduleRun.id)"
|
||||
>
|
||||
<Download class="h-4 w-4 shrink-0" />
|
||||
{{ $t('admin.schedule.downloadReceiptRawZipPackage') }}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-if="admin.expandedScheduleRun.kb_sync_status"
|
||||
class="rounded-xl border border-emerald-200 bg-emerald-50/50 p-3 text-xs text-secondary"
|
||||
|
||||
+2
-2
@@ -72,7 +72,7 @@ export function createScheduleAdminState() {
|
||||
{ key: 'status', label: '', width: 130, min: 50 },
|
||||
{ key: 'total_count', label: '', width: 70, min: 40 },
|
||||
{ key: 'success_count', label: '', width: 70, min: 40 },
|
||||
{ key: 'skipped_count', label: '', width: 70, min: 40 },
|
||||
{ key: 'skipped_count', label: '', width: 110, min: 88 },
|
||||
{ key: 'failed_count', label: '', width: 70, min: 40 },
|
||||
{ key: 'wecom_notified', label: '', width: 100, min: 80 },
|
||||
{ key: 'detail', label: '', width: 100, min: 80 },
|
||||
@@ -88,7 +88,7 @@ export function createScheduleAdminState() {
|
||||
const scheduleConfigCollapsed = ref(true);
|
||||
|
||||
const expandedScheduleRunId = ref<number | null>(null);
|
||||
/** 企微深链 raw_zip=1 进入时待手动下载的执行记录 ID;普通列表浏览不展示原始库存下载入口。 */
|
||||
/** 企微深链 raw_zip=1 进入时待手动下载的执行记录 ID;普通列表浏览不展示原始库存/收料下载入口。 */
|
||||
const wecomRawZipPromptRunId = ref<number | null>(null);
|
||||
|
||||
const showTestRunDialog = ref(false);
|
||||
|
||||
+20
-8
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* features/admin/modules/schedules/composables/schedule-admin/useScheduleAdminDeepLink.ts
|
||||
* 用途:解析企微深链 query,定位排程执行记录并在登录后自动下载原始库存包。
|
||||
* 用途:解析企微深链 query,定位排程执行记录并在登录后自动下载原始库存/收料包。
|
||||
* 依赖:vue-router、schedule-admin.state、useScheduleAdminRuns。
|
||||
* 逻辑:SchedulesPage onMounted 在 loadAll 后调用;消费 task_id/run_id/raw_zip/download,自动下载失败时保留手动入口。
|
||||
*/
|
||||
@@ -16,11 +16,15 @@ function parsePositiveInt(raw: unknown): number | null {
|
||||
|
||||
/**
|
||||
* 根据路由 query 打开工作台执行记录;raw_zip=1 时展开 run 并保留手动下载按钮。
|
||||
* 核心逻辑:download=inventory_raw_zip 时登录后自动下载一次;若企微内置浏览器拦截,用户仍可点醒目按钮重试。
|
||||
* 核心逻辑:download=inventory_raw_zip / receipt_raw_zip 时登录后自动下载一次;
|
||||
* 若企微内置浏览器拦截,用户仍可点醒目按钮重试。
|
||||
*/
|
||||
export function useScheduleAdminDeepLink(
|
||||
state: ScheduleAdminState,
|
||||
runs: Pick<ScheduleAdminRuns, 'viewScheduleRuns' | 'downloadScheduleInventoryRawZip'>,
|
||||
runs: Pick<
|
||||
ScheduleAdminRuns,
|
||||
'viewScheduleRuns' | 'downloadScheduleInventoryRawZip' | 'downloadScheduleReceiptRawZip'
|
||||
>,
|
||||
) {
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
@@ -31,7 +35,11 @@ export function useScheduleAdminDeepLink(
|
||||
|
||||
const runId = parsePositiveInt(route.query.run_id);
|
||||
const rawZipPrompt = String(route.query.raw_zip || '') === '1';
|
||||
const shouldAutoDownloadRawZip = rawZipPrompt && String(route.query.download || '') === 'inventory_raw_zip';
|
||||
const downloadKind = String(route.query.download || '');
|
||||
const shouldAutoDownloadInventory =
|
||||
rawZipPrompt && downloadKind === 'inventory_raw_zip';
|
||||
const shouldAutoDownloadReceipt =
|
||||
rawZipPrompt && downloadKind === 'receipt_raw_zip';
|
||||
|
||||
state.scheduleViewMode.value = 'workbench';
|
||||
state.selectedScheduleId.value = taskId;
|
||||
@@ -42,11 +50,15 @@ export function useScheduleAdminDeepLink(
|
||||
state.expandedScheduleRunId.value = runId;
|
||||
if (rawZipPrompt) {
|
||||
const target = state.selectedScheduleRuns.value.find((item) => item.id === runId);
|
||||
if (target?.inventory_raw_zip_available) {
|
||||
if (target?.inventory_raw_zip_available && shouldAutoDownloadInventory) {
|
||||
state.wecomRawZipPromptRunId.value = runId;
|
||||
await runs.downloadScheduleInventoryRawZip(runId);
|
||||
} else if (target?.receipt_raw_zip_available && shouldAutoDownloadReceipt) {
|
||||
state.wecomRawZipPromptRunId.value = runId;
|
||||
await runs.downloadScheduleReceiptRawZip(runId);
|
||||
} else if (target?.inventory_raw_zip_available || target?.receipt_raw_zip_available) {
|
||||
// 深链仅 raw_zip=1 无 download 时仍展示手动入口。
|
||||
state.wecomRawZipPromptRunId.value = runId;
|
||||
if (shouldAutoDownloadRawZip) {
|
||||
await runs.downloadScheduleInventoryRawZip(runId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+26
-9
@@ -1,9 +1,11 @@
|
||||
/**
|
||||
* features/admin/modules/schedules/composables/schedule-admin/useScheduleAdminList.ts
|
||||
* 任务列表加载、概览统计、启停/立即执行/删除与视图切换。
|
||||
* 等待轮询策略:点「立即执行」后每 RUN_NOW_POLL_MS 刷新记录与列表,直到任务离开 running;
|
||||
* 同一任务仅保留一个轮询(重复点击先清旧定时器)、上一轮未返回时跳过本轮,
|
||||
* 并设 RUN_NOW_POLL_MAX_MS 上限,防止任务长时间不终态造成页面无限请求。
|
||||
* 等待轮询策略:点「立即执行」后只轻量刷新任务 last_status(不刷执行记录 runs),
|
||||
* 直到离开 running 再拉一次 runs;与「执行记录=历史查询、不做定时刷新」对齐。
|
||||
* 同一任务仅保留一个轮询、上一轮未返回时跳过,并设 RUN_NOW_POLL_MAX_MS 上限。
|
||||
* 库存/收料 RPA 写 trigger 后会长时间保持 running(awaiting callback),旧逻辑每 5s
|
||||
* 全量 runs + loading 遮罩会把收料工作台打成「正在查询记录…」连环请求。
|
||||
*/
|
||||
import { computed } from 'vue';
|
||||
import type { ComposerTranslation } from 'vue-i18n';
|
||||
@@ -18,7 +20,7 @@ import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type { ScheduleAdminState } from './schedule-admin.state';
|
||||
import type { ScheduleAdminRuns } from './useScheduleAdminRuns';
|
||||
|
||||
/** 立即执行后的等待轮询间隔 */
|
||||
/** 立即执行后的等待轮询间隔(仅任务列表 last_status) */
|
||||
const RUN_NOW_POLL_MS = 5_000;
|
||||
/** 等待轮询总上限:与服务端库存导出超时(默认 900s)对齐,超限后停止自动刷新提示手动查询 */
|
||||
const RUN_NOW_POLL_MAX_MS = 15 * 60_000;
|
||||
@@ -47,7 +49,12 @@ export function useScheduleAdminList(
|
||||
const scheduleDisabledCount = computed(() => schedules.value.filter((item) => !item.enabled).length);
|
||||
const scheduleRunningCount = computed(() => schedules.value.filter((item) => item.last_status === 'running').length);
|
||||
|
||||
const loadSchedules = async () => {
|
||||
/**
|
||||
* 加载排程任务列表;可选顺带刷新当前工作台执行记录。
|
||||
* @param options.includeRuns - 工作台模式下是否拉取 runs;立即执行等待轮询传 false,避免连环打 API
|
||||
*/
|
||||
const loadSchedules = async (options?: { includeRuns?: boolean }) => {
|
||||
const includeRuns = options?.includeRuns !== false;
|
||||
scheduleLoading.value = true;
|
||||
try {
|
||||
schedules.value = await listAdminSchedules();
|
||||
@@ -62,7 +69,7 @@ export function useScheduleAdminList(
|
||||
if (!exists && nextScheduleId) {
|
||||
selectedScheduleId.value = nextScheduleId;
|
||||
}
|
||||
if (scheduleViewMode.value === 'workbench' && nextScheduleId) {
|
||||
if (includeRuns && scheduleViewMode.value === 'workbench' && nextScheduleId) {
|
||||
await runs.viewScheduleRuns(nextScheduleId);
|
||||
}
|
||||
} finally {
|
||||
@@ -83,6 +90,11 @@ export function useScheduleAdminList(
|
||||
scheduleViewMode.value = 'overview';
|
||||
};
|
||||
|
||||
/**
|
||||
* 立即执行排程;等待期只轮询任务 last_status,不定时刷新执行记录。
|
||||
* 核心逻辑:触发后先拉一次 runs;之后每 RUN_NOW_POLL_MS 仅 listAdminSchedules;
|
||||
* 终态或超时后再拉一次 runs。库存/收料共用,避免 RPA awaiting 长 running 连环打 runs。
|
||||
*/
|
||||
const runScheduleNow = async (taskId: number) => {
|
||||
try {
|
||||
await runAdminSchedule(taskId);
|
||||
@@ -90,8 +102,9 @@ export function useScheduleAdminList(
|
||||
msg.error(err?.message || t('admin.schedule.msg.runNowFailed'));
|
||||
return;
|
||||
}
|
||||
// [STEP 1] 触发后立刻展示本轮记录一次;任务列表不重复带 runs
|
||||
await runs.viewScheduleRuns(taskId, true);
|
||||
await loadSchedules();
|
||||
await loadSchedules({ includeRuns: false });
|
||||
|
||||
// 同一任务只保留一个等待轮询:重复点击先停旧定时器,避免多路 interval 并行放大请求频率
|
||||
const previousPoll = runNowPollTimers.get(taskId);
|
||||
@@ -103,8 +116,8 @@ export function useScheduleAdminList(
|
||||
if (runNowPollsInFlight.has(taskId)) return;
|
||||
runNowPollsInFlight.add(taskId);
|
||||
try {
|
||||
await runs.viewScheduleRuns(taskId, true);
|
||||
await loadSchedules();
|
||||
// [STEP 2] 等待期只刷新 last_status,禁止 viewScheduleRuns(否则工作台会遮「正在查询记录…」)
|
||||
await loadSchedules({ includeRuns: false });
|
||||
elapsedMs += RUN_NOW_POLL_MS;
|
||||
const target = schedules.value.find((s: ScheduleTask) => s.id === taskId);
|
||||
const terminal = !!target?.last_status && target.last_status !== 'running';
|
||||
@@ -112,6 +125,10 @@ export function useScheduleAdminList(
|
||||
if (terminal || timedOut) {
|
||||
clearInterval(pollInterval);
|
||||
runNowPollTimers.delete(taskId);
|
||||
// [STEP 3] 终态/超时后再拉一次执行记录,给表格最终结果
|
||||
if (scheduleViewMode.value === 'workbench') {
|
||||
await runs.viewScheduleRuns(taskId, true);
|
||||
}
|
||||
if (timedOut && !terminal) {
|
||||
msg.warning(t('admin.schedule.msg.runNowWaitTimeout'));
|
||||
}
|
||||
|
||||
+70
-15
@@ -2,15 +2,17 @@
|
||||
* features/admin/modules/schedules/composables/schedule-admin/useScheduleAdminRuns.ts
|
||||
* 执行批次列表:筛选、列宽、展开详情、Excel 下载、指标派生与 RPA Worker 心跳轮询。
|
||||
* 轮询策略(历史查询与监控职责分离):执行记录列表是纯历史查询,仅切任务/查询/重置时按需加载;
|
||||
* RPA Worker 在线状态是监控信号,仅在库存排程工作台模式下每 RPA_WORKER_STATUS_POLL_MS 静默轮询一次,
|
||||
* RPA Worker 在线状态是监控信号,仅在库存/收料排程工作台模式下每 RPA_WORKER_STATUS_POLL_MS 静默轮询一次,
|
||||
* 后台标签页暂停、请求未返回时跳过(防堆叠),使「在线/离线」徽标及时反映心跳。
|
||||
* 收料/库存排程的跳过列与统计砖分别显示「无收料/跳过」「无库存/跳过」。
|
||||
*/
|
||||
import { computed, onBeforeUnmount, watch, type Ref } from 'vue';
|
||||
import type { ComposerTranslation } from 'vue-i18n';
|
||||
import { listAdminScheduleRuns, adminRunInventoryRawZipUrl, getAdminRpaWorkersStatus } from '@/features/admin/api/schedule.api';
|
||||
import { listAdminScheduleRuns, adminRunInventoryRawZipUrl, adminRunReceiptRawZipUrl, getAdminRpaWorkersStatus } from '@/features/admin/api/schedule.api';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import { formatDateTime } from '../../utils/schedule-format.utils';
|
||||
import { normalizePlatformJobKey } from '../../utils/schedule-job-key.utils';
|
||||
import {
|
||||
getScheduleRunFailedCountTitle as buildScheduleRunFailedCountTitle,
|
||||
isScheduleRunExcelExportFailed,
|
||||
@@ -39,7 +41,31 @@ export function useScheduleAdminRuns(
|
||||
scheduleViewMode,
|
||||
} = state;
|
||||
|
||||
const selectedSchedule = computed(() =>
|
||||
schedules.value.find((item) => item.id === selectedScheduleId.value) || null,
|
||||
);
|
||||
|
||||
const selectedScheduleJobKey = computed(
|
||||
() => normalizePlatformJobKey(selectedSchedule.value?.platform_api_path),
|
||||
);
|
||||
|
||||
const isInventoryRpaSchedule = computed(
|
||||
() => selectedScheduleJobKey.value === 'shipping-inventory-rpa',
|
||||
);
|
||||
|
||||
const isReceiptRpaSchedule = computed(
|
||||
() => selectedScheduleJobKey.value === 'freight-receipt-rpa',
|
||||
);
|
||||
|
||||
/**
|
||||
* 同步执行记录列表表头文案;收料/库存排程的「跳过」列分别显示无收料/无库存。
|
||||
*/
|
||||
const syncScheduleRunColumnLabels = () => {
|
||||
const skippedKey = isReceiptRpaSchedule.value
|
||||
? 'skippedCountReceipt'
|
||||
: isInventoryRpaSchedule.value
|
||||
? 'skippedCountInventory'
|
||||
: 'skippedCount';
|
||||
const keyToI18n: Record<string, string> = {
|
||||
run_no: 'runNo',
|
||||
started_at: 'startedAt',
|
||||
@@ -47,7 +73,7 @@ export function useScheduleAdminRuns(
|
||||
status: 'status',
|
||||
total_count: 'totalCount',
|
||||
success_count: 'successCount',
|
||||
skipped_count: 'skippedCount',
|
||||
skipped_count: skippedKey,
|
||||
failed_count: 'failedCount',
|
||||
wecom_notified: 'wecomNotified',
|
||||
detail: 'detail',
|
||||
@@ -58,7 +84,11 @@ export function useScheduleAdminRuns(
|
||||
if (i18nKey) col.label = t(`admin.schedule.columns.${i18nKey}`);
|
||||
});
|
||||
};
|
||||
watch(locale, syncScheduleRunColumnLabels, { immediate: true });
|
||||
watch(
|
||||
[locale, isReceiptRpaSchedule, isInventoryRpaSchedule],
|
||||
syncScheduleRunColumnLabels,
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
const onScheduleColResizeMove = (event: MouseEvent) => {
|
||||
const resizeState = resizingScheduleCol.value;
|
||||
@@ -88,10 +118,6 @@ export function useScheduleAdminRuns(
|
||||
window.addEventListener('mouseup', stopScheduleColResize);
|
||||
};
|
||||
|
||||
const selectedSchedule = computed(() =>
|
||||
schedules.value.find((item) => item.id === selectedScheduleId.value) || null,
|
||||
);
|
||||
|
||||
const scheduleRunStatusOptions = computed(() => [
|
||||
{ value: 'all', label: t('admin.schedule.status.all') },
|
||||
{ value: 'success', label: t('admin.schedule.status.success') },
|
||||
@@ -152,8 +178,13 @@ export function useScheduleAdminRuns(
|
||||
return raw ? formatDateTime(raw) : '-';
|
||||
});
|
||||
|
||||
const isInventoryRpaSchedule = computed(
|
||||
() => selectedSchedule.value?.platform_api_path === 'shipping-inventory-rpa',
|
||||
/** 库存或收料排程工作台均展示 RPA Worker 心跳徽标。 */
|
||||
const showsRpaWorkerStatus = computed(
|
||||
() => isInventoryRpaSchedule.value || isReceiptRpaSchedule.value,
|
||||
);
|
||||
|
||||
const rpaWorkerStatusScope = computed<'inventory' | 'receipt'>(() =>
|
||||
(isReceiptRpaSchedule.value ? 'receipt' : 'inventory'),
|
||||
);
|
||||
|
||||
const rpaWorkerLastHeartbeatAt = computed(() => {
|
||||
@@ -171,13 +202,13 @@ export function useScheduleAdminRuns(
|
||||
* @param silent - 静默模式:由后台轮询调用,不翻转 loading,避免徽标每轮闪烁「加载中」
|
||||
*/
|
||||
const refreshRpaWorkerStatus = async (silent = false) => {
|
||||
if (!isInventoryRpaSchedule.value) {
|
||||
if (!showsRpaWorkerStatus.value) {
|
||||
rpaWorkerStatus.value = null;
|
||||
return;
|
||||
}
|
||||
if (!silent) rpaWorkerStatusLoading.value = true;
|
||||
try {
|
||||
rpaWorkerStatus.value = await getAdminRpaWorkersStatus();
|
||||
rpaWorkerStatus.value = await getAdminRpaWorkersStatus(rpaWorkerStatusScope.value);
|
||||
} catch {
|
||||
rpaWorkerStatus.value = null;
|
||||
} finally {
|
||||
@@ -185,14 +216,14 @@ export function useScheduleAdminRuns(
|
||||
}
|
||||
};
|
||||
|
||||
// ── RPA Worker 心跳轮询(监控信号,仅库存排程) ─────────────────────────
|
||||
// ── RPA Worker 心跳轮询(监控信号,库存/收料排程) ───────────────────────
|
||||
// 心跳由 Worker 每约 20s 上报一次(服务端 TTL 默认 90s),UI 每 10s 刷新即足够;
|
||||
// 2s 固定轮询只有少量时间点在变化,属于对无变化数据的过度请求。
|
||||
const RPA_WORKER_STATUS_POLL_MS = 10_000;
|
||||
|
||||
/** 是否需要前台轮询心跳:仅工作台模式且当前排程为库存类(该徽标仅在此时可见) */
|
||||
/** 是否需要前台轮询心跳:工作台模式且当前排程为库存或收料类 */
|
||||
const shouldPollRpaWorkerStatus = computed(
|
||||
() => scheduleViewMode.value === 'workbench' && isInventoryRpaSchedule.value && !!selectedScheduleId.value,
|
||||
() => scheduleViewMode.value === 'workbench' && showsRpaWorkerStatus.value && !!selectedScheduleId.value,
|
||||
);
|
||||
|
||||
let rpaStatusPollTimer: ReturnType<typeof setInterval> | null = null;
|
||||
@@ -301,6 +332,27 @@ export function useScheduleAdminRuns(
|
||||
URL.revokeObjectURL(url);
|
||||
};
|
||||
|
||||
/**
|
||||
* 下载收料原始 ZIP;API 与文件名口径对齐库存 raw zip。
|
||||
*/
|
||||
const downloadScheduleReceiptRawZip = async (runId: number) => {
|
||||
const res = await fetch(adminRunReceiptRawZipUrl(runId), { headers: getAuthHeaders() });
|
||||
if (!res.ok) {
|
||||
msg.error(t('admin.schedule.msg.downloadReceiptRawZipFailed'));
|
||||
return;
|
||||
}
|
||||
const blob = await res.blob();
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
const disposition = res.headers.get('content-disposition');
|
||||
a.download = disposition?.match(/filename\*?=(?:UTF-8'')?["']?([^;"'\n]+)/)?.[1] || '收料RPA-收料.zip';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
};
|
||||
|
||||
const getScheduleRunFailedCountTitle = (run: (typeof selectedScheduleRuns.value)[number]) =>
|
||||
buildScheduleRunFailedCountTitle(run, t('admin.schedule.excelExportFailedHint'));
|
||||
|
||||
@@ -315,12 +367,15 @@ export function useScheduleAdminRuns(
|
||||
selectedScheduleRunMetrics,
|
||||
selectedScheduleLatestRunAt,
|
||||
isInventoryRpaSchedule,
|
||||
isReceiptRpaSchedule,
|
||||
showsRpaWorkerStatus,
|
||||
rpaWorkerLastHeartbeatAt,
|
||||
refreshRpaWorkerStatus,
|
||||
resetScheduleRunFilters,
|
||||
viewScheduleRuns,
|
||||
downloadScheduleExcel,
|
||||
downloadScheduleInventoryRawZip,
|
||||
downloadScheduleReceiptRawZip,
|
||||
startScheduleColResize,
|
||||
formatDateTime,
|
||||
isScheduleRunExcelExportFailed,
|
||||
|
||||
+120
-193
@@ -124,39 +124,40 @@
|
||||
<label><span>{{ t('admin.shippingInventory.inventorySiteName') }}</span><input v-model="source.display_name" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.connectorType') }}</span><select v-model="source.connector_type" class="select-field"><option value="dbs">{{ t('admin.shippingInventory.platform.dbs') }}</option><option value="crane">{{ t('admin.shippingInventory.platform.crane') }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.connection') }}</span><select v-model.number="source.rpa_profile_id" class="select-field" required><option :value="0">{{ t('admin.shippingInventory.chooseConnection') }}</option><option v-for="item in compatibleProfiles" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.profile_code }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.parsingProfiles') }}</span><select v-model.number="source.parsing_profile_id" class="select-field" :disabled="source.enabled"><option :value="0">{{ t('admin.shippingInventory.notConfigured') }}</option><option v-for="item in parsingProfiles.filter((row) => row.status === 'published' && row.purpose !== 'movement')" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.profile_code }} V{{ item.version }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.excelTemplates') }}</span><select v-model.number="source.excel_template_id" class="select-field"><option :value="0">{{ t('admin.shippingInventory.notConfigured') }}</option><option v-for="item in excelTemplates.filter((row) => row.status === 'published')" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.template_code }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.warehouseResolution') }}</span><select v-model="source.warehouse_resolution_mode" class="select-field"><option value="fixed">{{ t('admin.shippingInventory.fixedWarehouse') }}</option><option value="inventory_match">{{ t('admin.shippingInventory.inventoryMatch') }}</option></select></label>
|
||||
<label v-if="source.warehouse_resolution_mode === 'fixed'"><span>{{ t('admin.shippingInventory.warehouse') }}</span><input v-model="source.fixed_warehouse_id" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.snapshotTtl') }}</span><input v-model.number="source.snapshot_ttl_seconds" class="input-field" min="1" type="number" required></label>
|
||||
<div v-if="!selectedId" class="form-tip full">{{ t('admin.shippingInventory.sourceSavedDisabledHint') }}</div>
|
||||
<template v-if="source.connector_type === 'dbs'">
|
||||
<section class="path-card full">
|
||||
<!-- DBS/Crane 共用「库存报表配置」分组:DBS 含路径+条件,Crane 仅解析绑定;徽标与收料卡同构。 -->
|
||||
<section class="path-card full" :class="{ configured: inventoryReportConfigExists }">
|
||||
<button type="button" class="path-card-header" :aria-expanded="inventoryPathOpen" @click="inventoryPathOpen = !inventoryPathOpen">
|
||||
<span class="path-card-title"><b>{{ t('admin.shippingInventory.reportPath') }}</b></span>
|
||||
<span class="path-card-title"><b>{{ t('admin.shippingInventory.inventoryReportConfig') }}</b></span>
|
||||
<span class="path-badge" :class="inventoryReportConfigExists ? 'on' : 'off'">{{ inventoryReportConfigExists ? t('admin.shippingInventory.pathSectionConfigured') : t('admin.shippingInventory.pathSectionNotConfigured') }}</span>
|
||||
<span class="path-card-toggle" aria-hidden="true">{{ inventoryPathOpen ? '▾' : '▸' }}</span>
|
||||
</button>
|
||||
<div v-show="inventoryPathOpen" class="path-card-body">
|
||||
<label><span>{{ t('admin.shippingInventory.programGroup') }}</span><input v-model="source.report_path_json.program_group" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.programLabel') }}</span><input v-model="source.report_path_json.program_label" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.reportGroup') }}</span><input v-model="source.report_path_json.report_group" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.reportName') }}</span><input v-model="source.report_path_json.report_name" class="input-field" required></label>
|
||||
<div class="subsection full">{{ t('admin.shippingInventory.queryParameters') }}</div>
|
||||
<div v-for="(parameter, index) in source.query_parameters_json" :key="`${index}-${parameter.name}`" class="parameter-row full">
|
||||
<input v-model="parameter.name" class="input-field" :placeholder="t('admin.shippingInventory.parameterName')">
|
||||
<select v-model="parameter.mode" class="select-field"><option value="single">{{ t('admin.shippingInventory.single') }}</option><option value="multi_text">{{ t('admin.shippingInventory.multiText') }}</option><option value="multi_select">{{ t('admin.shippingInventory.multiSelect') }}</option></select>
|
||||
<input class="input-field" :value="parameter.values.join(', ')" :placeholder="t('admin.shippingInventory.parameterValues')" @input="parameter.values = splitValues(($event.target as HTMLInputElement).value)">
|
||||
<label class="inline-check"><input v-model="parameter.required" type="checkbox">{{ t('admin.shippingInventory.required') }}</label>
|
||||
<label class="inline-check"><input v-model="parameter.select_all" type="checkbox">{{ t('admin.shippingInventory.selectAll') }}</label>
|
||||
<button type="button" class="btn-danger btn-sm" @click="source.query_parameters_json.splice(index, 1)">{{ t('admin.delete') }}</button>
|
||||
</div>
|
||||
<button type="button" class="btn-secondary btn-sm full" @click="addParameter">{{ t('admin.shippingInventory.addParameter') }}</button>
|
||||
<template v-if="source.connector_type === 'dbs'">
|
||||
<label><span>{{ t('admin.shippingInventory.programGroup') }}</span><input v-model="source.report_path_json.program_group" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.programLabel') }}</span><input v-model="source.report_path_json.program_label" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.reportGroup') }}</span><input v-model="source.report_path_json.report_group" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.reportName') }}</span><input v-model="source.report_path_json.report_name" class="input-field" required></label>
|
||||
<div class="subsection full">{{ t('admin.shippingInventory.queryParameters') }}</div>
|
||||
<div v-for="(parameter, index) in source.query_parameters_json" :key="`${index}-${parameter.name}`" class="parameter-row full">
|
||||
<input v-model="parameter.name" class="input-field" :placeholder="t('admin.shippingInventory.parameterName')">
|
||||
<select v-model="parameter.mode" class="select-field"><option value="single">{{ t('admin.shippingInventory.single') }}</option><option value="multi_text">{{ t('admin.shippingInventory.multiText') }}</option><option value="multi_select">{{ t('admin.shippingInventory.multiSelect') }}</option></select>
|
||||
<input class="input-field" :value="parameter.values.join(', ')" :placeholder="t('admin.shippingInventory.parameterValues')" @input="parameter.values = splitValues(($event.target as HTMLInputElement).value)">
|
||||
<label class="inline-check"><input v-model="parameter.required" type="checkbox">{{ t('admin.shippingInventory.required') }}</label>
|
||||
<label class="inline-check"><input v-model="parameter.select_all" type="checkbox">{{ t('admin.shippingInventory.selectAll') }}</label>
|
||||
<button type="button" class="btn-danger btn-sm" @click="source.query_parameters_json.splice(index, 1)">{{ t('admin.delete') }}</button>
|
||||
</div>
|
||||
<button type="button" class="btn-secondary btn-sm full" @click="addParameter">{{ t('admin.shippingInventory.addParameter') }}</button>
|
||||
</template>
|
||||
<label class="full"><span>{{ t('admin.shippingInventory.parsingProfiles') }}</span><select v-model.number="source.parsing_profile_id" class="select-field"><option :value="0">{{ t('admin.shippingInventory.notConfigured') }}</option><option v-for="item in parsingProfiles.filter((row) => row.status === 'published' && row.purpose !== 'movement')" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.profile_code }} V{{ item.version }}</option></select></label>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
<section v-if="selectedId" class="path-card receipt full" :class="{ configured: receiptConfigExists }">
|
||||
<button type="button" class="path-card-header" :aria-expanded="receiptSectionOpen" @click="toggleReceiptSection">
|
||||
<span class="path-card-title"><b>{{ t('admin.shippingInventory.receiptReportConfig') }}</b><small>{{ t('admin.shippingInventory.receiptReportConfigHint') }}</small></span>
|
||||
<span class="path-card-title"><b>{{ t('admin.shippingInventory.receiptReportConfig') }}</b></span>
|
||||
<span class="path-badge" :class="receiptConfigExists ? 'on' : 'off'">{{ receiptConfigExists ? t('admin.shippingInventory.pathSectionConfigured') : t('admin.shippingInventory.pathSectionNotConfigured') }}</span>
|
||||
<span class="path-card-toggle" aria-hidden="true">{{ receiptSectionOpen ? '▾' : '▸' }}</span>
|
||||
</button>
|
||||
@@ -166,7 +167,7 @@
|
||||
<label><span>{{ t('admin.shippingInventory.programLabel') }}</span><input v-model="receiptConfig.report_path_json.program_label" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.reportGroup') }}</span><input v-model="receiptConfig.report_path_json.report_group" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.reportName') }}</span><input v-model="receiptConfig.report_path_json.report_name" class="input-field" required></label>
|
||||
<div class="subsection full">{{ t('admin.shippingInventory.queryParameters') }}<small>{{ t('admin.shippingInventory.receiptQueryParametersHint') }}</small></div>
|
||||
<div class="subsection full">{{ t('admin.shippingInventory.queryParameters') }}</div>
|
||||
<div v-for="(parameter, index) in receiptConfig.query_parameters_json" :key="`receipt-${index}-${parameter.name}`" class="parameter-row full">
|
||||
<input v-model="parameter.name" class="input-field" :placeholder="t('admin.shippingInventory.parameterName')">
|
||||
<select v-model="parameter.mode" class="select-field"><option value="single">{{ t('admin.shippingInventory.single') }}</option><option value="multi_text">{{ t('admin.shippingInventory.multiText') }}</option><option value="multi_select">{{ t('admin.shippingInventory.multiSelect') }}</option></select>
|
||||
@@ -177,8 +178,7 @@
|
||||
</div>
|
||||
<button type="button" class="btn-secondary btn-sm full" @click="addReceiptParameter">{{ t('admin.shippingInventory.addParameter') }}</button>
|
||||
</template>
|
||||
<p v-else class="form-tip full">{{ t('admin.shippingInventory.receiptCraneFixedPath') }}</p>
|
||||
<label class="full"><span>{{ t('admin.shippingInventory.movementBindingLabel') }}</span><select v-model.number="receiptConfig.parsing_profile_id" class="select-field"><option :value="null">{{ t('admin.shippingInventory.movementBindingNone') }}</option><option v-for="item in parsingProfiles.filter((row) => row.status === 'published' && row.purpose === 'movement')" :key="`movement-bind-${item.id}`" :value="Number(item.id)">{{ item.display_name || item.profile_code }} V{{ item.version }}</option></select><small>{{ t('admin.shippingInventory.movementBindingHint') }}</small></label>
|
||||
<label class="full"><span>{{ t('admin.shippingInventory.movementBindingLabel') }}</span><select v-model.number="receiptConfig.parsing_profile_id" class="select-field"><option :value="null">{{ t('admin.shippingInventory.movementBindingNone') }}</option><option v-for="item in parsingProfiles.filter((row) => row.status === 'published' && row.purpose === 'movement')" :key="`movement-bind-${item.id}`" :value="Number(item.id)">{{ item.display_name || item.profile_code }} V{{ item.version }}</option></select></label>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -356,49 +356,35 @@
|
||||
<div class="switch-field"><span>{{ t('admin.shippingInventory.enabled') }}</span><button type="button" class="status-switch" :class="{ on: mapping.enabled }" role="switch" :aria-checked="mapping.enabled" @click="mapping.enabled = !mapping.enabled"><i></i><b>{{ mapping.enabled ? t('admin.shippingInventory.enabledState') : t('admin.shippingInventory.disabledState') }}</b></button></div>
|
||||
</template>
|
||||
|
||||
<section v-if="activeTab === 'sources' && selectedId" class="readiness-card full" :class="{ ready: source.enabled }">
|
||||
<div class="readiness-inline">
|
||||
<template v-if="source.enabled">
|
||||
<span class="readiness-marker is-passed" aria-hidden="true">✓</span>
|
||||
<div class="readiness-copy"><b>{{ t('admin.shippingInventory.activationReady') }}</b><small v-if="configurationTest?.completed_at">{{ t('admin.shippingInventory.readinessLastVerified', { time: formatDate(configurationTest.completed_at) }) }}</small></div>
|
||||
<button type="button" class="btn-danger btn-sm" @click="requestSourceDeactivation">{{ t('admin.shippingInventory.deactivateSource') }}</button>
|
||||
</template>
|
||||
<template v-else-if="firstBlockingCheck">
|
||||
<span class="readiness-marker" :class="`is-${firstBlockingCheck.status}`" aria-hidden="true">{{ readinessMarker(firstBlockingCheck.status) }}</span>
|
||||
<div class="readiness-copy"><b>{{ t('admin.shippingInventory.readinessBlockedBy', { requirement: t(`admin.shippingInventory.activationRequirement.${firstBlockingCheck.code}`) }) }}</b><small>{{ t('admin.shippingInventory.readinessAutoEnableHint') }}</small></div>
|
||||
<button v-if="readinessActionLabel(firstBlockingCheck)" type="button" class="readiness-action" :disabled="isReadinessActionBlocked(firstBlockingCheck)" :title="isReadinessActionBlocked(firstBlockingCheck) ? t('admin.shippingInventory.saveBeforeReadinessAction') : undefined" @click="runReadinessAction(firstBlockingCheck)">{{ readinessActionLabel(firstBlockingCheck) }}</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span class="readiness-marker is-passed" aria-hidden="true">✓</span>
|
||||
<div class="readiness-copy"><b>{{ t('admin.shippingInventory.activationCanEnable') }}</b></div>
|
||||
<button type="button" class="btn-primary btn-sm" :disabled="sourceDirty" :title="sourceDirty ? t('admin.shippingInventory.saveBeforeReadinessAction') : undefined" @click="requestSourceActivation">{{ t('admin.shippingInventory.activateSource') }}</button>
|
||||
</template>
|
||||
<div v-if="isEditableTab" class="form-actions full">
|
||||
<div
|
||||
v-if="activeTab === 'sources' && selectedId"
|
||||
class="source-enabled-footer"
|
||||
data-testid="source-enabled-row"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="status-switch"
|
||||
:class="{ on: source.enabled }"
|
||||
role="switch"
|
||||
:aria-checked="source.enabled"
|
||||
:disabled="sourceToggling || sourceDirty"
|
||||
:title="sourceDirty ? t('admin.shippingInventory.saveBeforeReadinessAction') : t('admin.shippingInventory.sourceEnabledToggleHint')"
|
||||
data-testid="source-enabled-switch"
|
||||
@click="onSourceEnabledToggle"
|
||||
>
|
||||
<i></i>
|
||||
</button>
|
||||
<span class="source-enabled-label">{{ t('admin.shippingInventory.enabled') }}</span>
|
||||
<small class="source-enabled-hint">{{
|
||||
sourceDirty
|
||||
? t('admin.shippingInventory.saveBeforeReadinessAction')
|
||||
: (!source.enabled && firstBlockingCheck
|
||||
? t('admin.shippingInventory.readinessBlockedBy', { requirement: t(`admin.shippingInventory.activationRequirement.${firstBlockingCheck.code}`) })
|
||||
: t('admin.shippingInventory.sourceEnabledToggleHint'))
|
||||
}}</small>
|
||||
</div>
|
||||
<details v-if="optionalReadinessChecks.length" class="readiness-optional">
|
||||
<summary><span>{{ t('admin.shippingInventory.activationOptionalTitle') }}</span><small>{{ t('admin.shippingInventory.readinessOptionalPending', { count: optionalReadinessPending }) }}</small></summary>
|
||||
<ol class="readiness-steps">
|
||||
<li v-for="check in optionalReadinessChecks" :key="check.code" :class="`is-${check.status}`">
|
||||
<span class="readiness-marker" aria-hidden="true">{{ readinessMarker(check.status) }}</span>
|
||||
<div class="readiness-copy"><b>{{ t(`admin.shippingInventory.activationRequirement.${check.code}`) }}</b><small>{{ readinessDetail(check) }}</small></div>
|
||||
</li>
|
||||
</ol>
|
||||
</details>
|
||||
<template v-if="configurationTest">
|
||||
<p v-if="configurationTest.status === 'failed'" class="readiness-run failed">{{ t(`admin.shippingInventory.configurationTestStage.${configurationTest.stage}`) }}</p>
|
||||
<p v-if="configurationTest.error_message" class="form-tip">{{ configurationTest.error_message }}</p>
|
||||
<p v-if="configurationTest.status === 'completed_empty'" class="form-tip">{{ t('admin.shippingInventory.configurationTestEmptyResult') }}</p>
|
||||
<details v-if="configurationTest.status !== 'failed'" class="readiness-audit">
|
||||
<summary>{{ t('admin.shippingInventory.configurationTestRunNo') }} {{ configurationTest.run_no }} · {{ t(`admin.shippingInventory.configurationTestStage.${configurationTest.stage}`) }}</summary>
|
||||
<dl><div><dt>{{ t('admin.shippingInventory.configurationTestConfigVersion') }}</dt><dd>{{ configurationTest.source_config_version }}</dd></div><div><dt>{{ t('admin.shippingInventory.configurationTestConnectionVersion') }}</dt><dd>{{ configurationTest.rpa_profile_config_version }}</dd></div><div><dt>{{ t('admin.shippingInventory.configurationTestUpdatedAt') }}</dt><dd>{{ formatDate(configurationTest.completed_at || configurationTest.created_at) }}</dd></div></dl>
|
||||
<section v-if="configurationTest.status === 'completed'" class="recommendation-list">
|
||||
<p v-if="configurationTest.result?.current_profile_verified" class="configuration-test-verified">{{ t(`admin.shippingInventory.currentProfileVerified.${configurationTest.result.profile_match_level || 'compatible'}`) }}</p>
|
||||
<article v-for="candidate in configurationTest.result?.analysis?.match_result?.candidates || []" :key="candidate.profile_id"><b>{{ candidate.display_name }} V{{ candidate.version }}</b><small>{{ t(`admin.shippingInventory.recommendationLevel.${candidate.level}`) }} · {{ t('admin.shippingInventory.configurationTestCandidateHint') }}</small></article>
|
||||
<p v-if="!configurationTest.result?.current_profile_verified && !(configurationTest.result?.analysis?.match_result?.candidates || []).length">{{ t('admin.shippingInventory.configurationTestNoRecommendation') }}</p>
|
||||
</section>
|
||||
</details>
|
||||
</template>
|
||||
</section>
|
||||
<div v-if="isEditableTab" class="form-actions full">
|
||||
<div class="form-actions-buttons">
|
||||
<button v-if="!parsingReadOnly" type="submit" class="btn-primary" :disabled="saving || ruleReadOnly || templateReadOnly || inventoryFieldReadOnly">{{ saving ? t('admin.shippingInventory.saving') : t('admin.save') }}</button>
|
||||
<button v-if="activeTab === 'rules' && selectedId && selectedRuleStatus === 'draft'" type="button" class="btn-secondary btn-sm" @click="publishCurrentRule">{{ t('admin.shippingInventory.publish') }}</button>
|
||||
<button v-if="activeTab === 'rules' && selectedId && selectedRuleStatus === 'published'" type="button" class="btn-secondary btn-sm" @click="retireCurrentRule">{{ t('admin.shippingInventory.retire') }}</button>
|
||||
@@ -412,6 +398,7 @@
|
||||
<button v-if="selectedId && canDeleteCurrent" type="button" class="btn-danger btn-sm" @click="deleteCurrent">{{ t('admin.delete') }}</button>
|
||||
<button type="button" class="btn-ghost btn-sm" @click="closeDrawer">{{ t('admin.cancel') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</aside>
|
||||
</div>
|
||||
@@ -445,7 +432,7 @@
|
||||
<section class="clone-template-dialog" role="dialog" aria-modal="true" aria-labelledby="bulk-parsing-binding-title">
|
||||
<header class="clone-template-header"><div><h3 id="bulk-parsing-binding-title">{{ t('admin.shippingInventory.bulkBindParsingProfile') }}</h3><p>{{ t('admin.shippingInventory.bulkBindParsingProfileHint') }}</p></div><button type="button" class="drawer-close" :aria-label="t('admin.close')" @click="closeBulkParsingBinding">×</button></header>
|
||||
<form class="clone-template-form" @submit.prevent="submitBulkParsingBinding">
|
||||
<label><span>{{ t('admin.shippingInventory.inventorySites') }}</span><select v-model="bulkBinding.sourceIds" class="select-field" multiple required><option v-for="item in sources.filter((row) => !row.enabled)" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.source_code }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.inventorySites') }}</span><select v-model="bulkBinding.sourceIds" class="select-field" multiple required><option v-for="item in sources" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.source_code }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.parsingProfiles') }}</span><select v-model.number="bulkBinding.profileId" class="select-field" required><option :value="0">{{ t('admin.shippingInventory.notConfigured') }}</option><option v-for="item in parsingProfiles.filter((row) => row.status === 'published' && row.purpose !== 'movement')" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.profile_code }} V{{ item.version }}</option></select></label>
|
||||
<div class="clone-template-actions"><button type="button" class="btn-ghost btn-sm" :disabled="bulkBinding.saving" @click="closeBulkParsingBinding">{{ t('admin.cancel') }}</button><button type="submit" class="btn-primary" :disabled="bulkBinding.saving">{{ bulkBinding.saving ? t('admin.shippingInventory.saving') : t('admin.shippingInventory.bulkBindParsingProfile') }}</button></div>
|
||||
</form>
|
||||
@@ -507,9 +494,6 @@ import {
|
||||
createShippingParsingDraftFromTemporarySession,
|
||||
adoptShippingInventoryParsingProfile,
|
||||
listShippingTemporaryInventorySessions,
|
||||
startShippingInventoryConfigurationTest,
|
||||
getShippingInventoryConfigurationTest,
|
||||
getLatestShippingInventoryConfigurationTest,
|
||||
startShippingInventoryValidationBatch,
|
||||
getShippingInventoryValidationBatch,
|
||||
getLatestActiveShippingInventoryValidationBatch,
|
||||
@@ -532,8 +516,7 @@ import {
|
||||
getShippingReceiptReportConfig,
|
||||
saveShippingReceiptReportConfig,
|
||||
} from '@/features/admin/api/admin.api';
|
||||
import type { ShippingInventoryConfigurationTest, ShippingInventoryReadinessCheck, ShippingInventoryValidationBatch } from '@/features/admin/api/admin.api';
|
||||
import { isConfigurationTestRunning, needsReadinessAction, readinessMarkerKind } from './shippingInventoryReadiness';
|
||||
import type { ShippingInventoryReadinessCheck, ShippingInventoryValidationBatch } from '@/features/admin/api/admin.api';
|
||||
import { normaliseInventoryReportPath } from './shippingInventorySourceForm';
|
||||
import { buildReceiptReportConfigPayload } from './receiptReportConfigForm';
|
||||
import { buildMovementFieldMapping } from './movementParsingProfileForm';
|
||||
@@ -559,7 +542,7 @@ const orderSchemaPublished = ref(false);
|
||||
const saving = ref(false);
|
||||
const confirmation = reactive({
|
||||
visible: false,
|
||||
action: '' as 'delete' | 'retireRule' | 'retireTemplate' | 'retireParsing' | 'retireInventoryField' | 'activateSource' | 'deactivateSource' | 'replaceInventorySample' | '',
|
||||
action: '' as 'delete' | 'retireRule' | 'retireTemplate' | 'retireParsing' | 'retireInventoryField' | 'deactivateSource' | 'replaceInventorySample' | '',
|
||||
title: '',
|
||||
message: '',
|
||||
confirmText: '',
|
||||
@@ -586,9 +569,7 @@ const temporaryInventorySessions = ref<Item[]>([]);
|
||||
const selectedTemporaryInventorySession = ref('');
|
||||
const analysisLoading = ref(false);
|
||||
const excelTemplates = ref<Item[]>([]);
|
||||
const configurationTest = ref<ShippingInventoryConfigurationTest | null>(null);
|
||||
const configurationTestLoading = ref(false);
|
||||
let configurationTestTimer: number | null = null;
|
||||
const sourceToggling = ref(false);
|
||||
const routingFields = ref<Array<{ field_id: string; field_code: string; display_name: string; description?: string; scope: 'header' | 'line' }>>([]);
|
||||
const templateSystemFacts = ref<string[]>([]);
|
||||
const templateSourceKinds = ref<Array<TemplateMapping['source_kind']>>([]);
|
||||
@@ -655,6 +636,7 @@ const templateClone = reactive({ visible: false, template_code: '', display_name
|
||||
const bulkBinding = reactive({ visible: false, sourceIds: [] as number[], profileId: 0, saving: false });
|
||||
const batchValidation = reactive({ visible: false, sourceIds: [] as number[], query: '', statusFilter: 'all' as 'all' | 'processing' | 'completed' | 'completed_empty' | 'failed', saving: false, result: null as ShippingInventoryValidationBatch | null });
|
||||
let batchValidationTimer: number | null = null;
|
||||
// snapshot_ttl_seconds:管理端不再展示;保存时透传存量值。运行时过期以全局 SHIPPING_NOTICE_INVENTORY_SNAPSHOT_TTL_HOURS 为准。
|
||||
const source = reactive({ source_code: '', display_name: '', connector_type: 'dbs', rpa_profile_id: 0, parsing_profile_id: 0, excel_template_id: 0, warehouse_resolution_mode: 'fixed', fixed_warehouse_id: '', snapshot_ttl_seconds: 86400, report_path_json: { program_group: '', program_label: '', report_group: 'Inventory', report_name: '' }, query_parameters_json: [] as Parameter[], enabled: false, activation: { ready: false, checks: [] as ShippingInventoryReadinessCheck[], missing_requirements: [] as string[] } as SourceActivation });
|
||||
const receiptConfig = reactive({ report_path_json: { program_group: '', program_label: '', report_group: 'Inbound', report_name: '' } as Record<string, string>, query_parameters_json: [] as Parameter[], parsing_profile_id: null as number | null });
|
||||
const receiptConfigExists = ref(false);
|
||||
@@ -678,15 +660,18 @@ const matchingOrderFields = computed(() => routingFields.value.filter((field) =>
|
||||
const canAddParsingMatchKey = computed(() => Boolean(
|
||||
structureAnalysis.value && unusedMatchingInventoryFields.value.length && unusedOrderMatchFields.value.length,
|
||||
));
|
||||
/** 库存报表配置徽标:DBS 看路径四段;Crane 无路径卡内容时看是否已绑库存解析。 */
|
||||
const inventoryReportConfigExists = computed(() => {
|
||||
if (source.connector_type !== 'dbs') return Number(source.parsing_profile_id) > 0;
|
||||
const path = source.report_path_json || {};
|
||||
return ['program_group', 'program_label', 'report_group', 'report_name']
|
||||
.every((key) => String((path as Record<string, string>)[key] || '').trim());
|
||||
});
|
||||
const sourceDirty = computed(() => Boolean(selectedId.value && (
|
||||
(sourceBaseline.value && sourceBaseline.value !== serialiseSourceInput())
|
||||
|| (receiptConfigExists.value && receiptBaseline.value && receiptBaseline.value !== serialiseReceiptInput())
|
||||
)));
|
||||
const readinessChecks = computed<ShippingInventoryReadinessCheck[]>(() => source.activation?.checks || []);
|
||||
const requiredReadinessChecks = computed(() => readinessChecks.value.filter((item) => item.blocking));
|
||||
const firstBlockingCheck = computed(() => requiredReadinessChecks.value.find((item) => item.status !== 'passed'));
|
||||
const optionalReadinessChecks = computed(() => readinessChecks.value.filter((item) => !item.blocking));
|
||||
const optionalReadinessPending = computed(() => optionalReadinessChecks.value.filter((item) => item.status !== 'passed').length);
|
||||
const firstBlockingCheck = computed(() => (source.activation?.checks || []).find((item) => item.blocking && item.status !== 'passed'));
|
||||
const sampleReplacementNotice = computed(() => {
|
||||
const difference = pendingSampleReplacement.value?.difference || {};
|
||||
const missing = Array.isArray(difference.missing_mapped_headers) ? difference.missing_mapped_headers : [];
|
||||
@@ -920,15 +905,6 @@ function toggleReceiptSection(): void {
|
||||
if (receiptSectionOpen.value) receiptSectionTouched.value = true;
|
||||
}
|
||||
|
||||
/** 切换管理对象时同步深链并清空选择,避免不同对象的数据残留在编辑器中。 */
|
||||
function selectTab(tab: TabKey): void {
|
||||
activeTab.value = tab;
|
||||
void router.replace({ query: { ...route.query, section: tab } });
|
||||
if (tab === 'snapshots') snapshotPage.value = 1;
|
||||
if (tab === 'exports') exportPage.value = 1;
|
||||
closeDrawer();
|
||||
}
|
||||
|
||||
/** 接收侧栏或书签中的 section 深链,仅允许打开工作台已注册区段。 */
|
||||
watch(
|
||||
() => route.query.section,
|
||||
@@ -970,7 +946,7 @@ function createNew(): void {
|
||||
templateSheetColumns.value = {};
|
||||
}
|
||||
if (activeTab.value === 'sources') {
|
||||
Object.assign(source, { source_code: '', display_name: '', connector_type: 'dbs', rpa_profile_id: 0, parsing_profile_id: 0, excel_template_id: 0, warehouse_resolution_mode: 'fixed', fixed_warehouse_id: '', snapshot_ttl_seconds: 86400, report_path_json: { program_group: '', program_label: '', report_group: 'Inventory', report_name: '' }, query_parameters_json: [], enabled: false, activation: { ready: false, checks: [], missing_requirements: ['configuration_test'] } });
|
||||
Object.assign(source, { source_code: '', display_name: '', connector_type: 'dbs', rpa_profile_id: 0, parsing_profile_id: 0, excel_template_id: 0, warehouse_resolution_mode: 'fixed', fixed_warehouse_id: '', snapshot_ttl_seconds: 86400, report_path_json: { program_group: '', program_label: '', report_group: 'Inventory', report_name: '' }, query_parameters_json: [], enabled: false, activation: { ready: false, checks: [], missing_requirements: ['parsing_profile', 'excel_template'] } });
|
||||
resetReceiptConfig('dbs');
|
||||
receiptConfigExists.value = false;
|
||||
receiptSectionTouched.value = false;
|
||||
@@ -1029,7 +1005,6 @@ function selectItem(item: Item): void {
|
||||
: item.report_path_json;
|
||||
Object.assign(source, { ...item, fixed_warehouse_id: item.fixed_warehouse_id || '', report_path_json: normaliseInventoryReportPath(item.connector_type, reportPath), query_parameters_json: (item.query_parameters_json || []).map((parameter: Parameter) => ({ ...parameter })) });
|
||||
sourceBaseline.value = serialiseSourceInput();
|
||||
void restoreConfigurationTest(Number(item.id));
|
||||
void loadReceiptConfig(Number(item.id), String(item.connector_type || ''));
|
||||
}
|
||||
if (activeTab.value === 'rules') Object.assign(rule, {
|
||||
@@ -1145,9 +1120,6 @@ async function loadTemplateLayout(templateId: number | null): Promise<void> {
|
||||
|
||||
/** 关闭抽屉并清除选择,确保切换配置对象时不会残留未保存数据。 */
|
||||
function closeDrawer(): void {
|
||||
if (configurationTestTimer !== null) window.clearTimeout(configurationTestTimer);
|
||||
configurationTestTimer = null;
|
||||
configurationTest.value = null;
|
||||
resetReceiptConfig(source.connector_type);
|
||||
sourceBaseline.value = '';
|
||||
drawerOpen.value = false;
|
||||
@@ -1317,12 +1289,11 @@ async function confirmPendingAction(): Promise<void> {
|
||||
if (action === 'retireTemplate') await retireShippingExcelTemplate(selectedId.value);
|
||||
if (action === 'retireParsing') await retireShippingInventoryParsingProfile(selectedId.value);
|
||||
if (action === 'retireInventoryField') await retireShippingInventoryField(selectedId.value);
|
||||
if (action === 'activateSource') {
|
||||
await activateShippingInventorySource(selectedId.value);
|
||||
if (action === 'deactivateSource') {
|
||||
await deactivateShippingInventorySource(selectedId.value);
|
||||
await refreshSelectedSource();
|
||||
return;
|
||||
}
|
||||
if (action === 'deactivateSource') await deactivateShippingInventorySource(selectedId.value);
|
||||
if (action === 'replaceInventorySample') { sampleReplacementConfirmed.value = true; await saveCurrent(); return; }
|
||||
if (action === 'delete' && activeTab.value === 'profiles') await deleteShippingRpaProfile(selectedId.value);
|
||||
if (action === 'delete' && activeTab.value === 'sources') await deleteShippingInventorySource(selectedId.value);
|
||||
@@ -1339,17 +1310,24 @@ async function confirmPendingAction(): Promise<void> {
|
||||
function clearConfirmation(): void { confirmation.visible = false; confirmation.action = ''; }
|
||||
|
||||
/**
|
||||
* 停用后条件仍满足时,经确认弹窗调用已有 activate API 再次启用。
|
||||
* 核心逻辑:未保存编辑一律阻断;服务端仍复用正式门禁,前端不放宽启用条件。
|
||||
* 库存站点启用开关:启用即时调用 activate API;停用经确认后 deactivate。
|
||||
* 核心逻辑:未保存编辑一律阻断;服务端硬门槛失败时保留停用态并提示。
|
||||
*/
|
||||
function requestSourceActivation(): void {
|
||||
if (!selectedId.value || sourceDirty.value || !source.activation?.ready) return;
|
||||
confirmation.visible = true;
|
||||
confirmation.action = 'activateSource';
|
||||
confirmation.title = t('admin.shippingInventory.activateSource');
|
||||
confirmation.message = t('admin.shippingInventory.activateSourceConfirm');
|
||||
confirmation.confirmText = t('admin.shippingInventory.activateSource');
|
||||
confirmation.tone = 'primary';
|
||||
async function onSourceEnabledToggle(): Promise<void> {
|
||||
if (!selectedId.value || sourceDirty.value || sourceToggling.value) {
|
||||
if (sourceDirty.value) message.warning(t('admin.shippingInventory.saveBeforeReadinessAction'));
|
||||
return;
|
||||
}
|
||||
if (source.enabled) {
|
||||
requestSourceDeactivation();
|
||||
return;
|
||||
}
|
||||
sourceToggling.value = true;
|
||||
try {
|
||||
await activateShippingInventorySource(selectedId.value);
|
||||
await refreshSelectedSource();
|
||||
} catch (cause) { showError(cause, 'saveFailed'); }
|
||||
finally { sourceToggling.value = false; }
|
||||
}
|
||||
|
||||
/** 停用动作使用平台确认弹窗,防止误将正在运行的库存站点下线。 */
|
||||
@@ -1362,44 +1340,7 @@ function requestSourceDeactivation(): void {
|
||||
confirmation.tone = 'danger';
|
||||
}
|
||||
|
||||
/** 发起停用库存站点的测试导出,并按后端状态轮询而不凭前端时间猜测结果。 */
|
||||
async function startConfigurationTest(): Promise<void> {
|
||||
if (!selectedId.value) return;
|
||||
configurationTestLoading.value = true;
|
||||
try {
|
||||
configurationTest.value = await startShippingInventoryConfigurationTest(selectedId.value);
|
||||
await pollConfigurationTest();
|
||||
} catch (cause) { showError(cause, 'configurationTestFailed'); }
|
||||
finally { configurationTestLoading.value = false; }
|
||||
}
|
||||
|
||||
/** 恢复当前配置对应的最近测试;只有服务端标记为运行中时才重新启动轮询。 */
|
||||
async function restoreConfigurationTest(sourceId: number): Promise<void> {
|
||||
try {
|
||||
const latest = await getLatestShippingInventoryConfigurationTest(sourceId);
|
||||
if (selectedId.value !== sourceId) return;
|
||||
configurationTest.value = latest;
|
||||
if (isConfigurationTestRunning(latest)) await pollConfigurationTest();
|
||||
} catch (cause) { showError(cause, 'configurationTestFailed'); }
|
||||
}
|
||||
|
||||
/** 读取测试运行的真实异步阶段;完成或失败后停止轮询。 */
|
||||
async function pollConfigurationTest(): Promise<void> {
|
||||
const sourceId = selectedId.value;
|
||||
const runNo = configurationTest.value?.run_no;
|
||||
if (!sourceId || !runNo) return;
|
||||
try {
|
||||
const updated = await getShippingInventoryConfigurationTest(sourceId, runNo);
|
||||
configurationTest.value = updated;
|
||||
if (isConfigurationTestRunning(updated)) {
|
||||
configurationTestTimer = window.setTimeout(() => { void pollConfigurationTest(); }, 2000);
|
||||
} else {
|
||||
await refreshSelectedSource();
|
||||
}
|
||||
} catch (cause) { showError(cause, 'configurationTestFailed'); }
|
||||
}
|
||||
|
||||
/** 测试结束后回读服务端的启用投影,避免抽屉继续展示测试前的过期门禁。 */
|
||||
/** 测试结束后回读服务端的启用投影,避免抽屉继续展示过期门禁。 */
|
||||
async function refreshSelectedSource(): Promise<void> {
|
||||
const sourceId = selectedId.value;
|
||||
if (!sourceId) return;
|
||||
@@ -1598,8 +1539,35 @@ async function onTemplateFile(event: Event): Promise<void> {
|
||||
message.error(t('admin.shippingInventory.templateLayoutReadFailed'));
|
||||
}
|
||||
}
|
||||
function rowTitle(item: Item): string { return String(item.display_name || item.rule_name || item.source_code || item.profile_code || item.external_warehouse_name || '-'); }
|
||||
/**
|
||||
* 列表卡 / 抽屉主标题。
|
||||
* 核心逻辑:mappings 展示「库存源 → 目标仓库名称」关系边;其它 Tab 按既有字段优先级取值。
|
||||
* @param item - 当前列表行对象
|
||||
* @returns 主标题文案
|
||||
*/
|
||||
function rowTitle(item: Item): string {
|
||||
// [STEP] mappings:关系本体是来源↔目标,只显示目标仓名无法扫清单
|
||||
if (activeTab.value === 'mappings') {
|
||||
const sourceId = Number(item.inventory_source_id || 0);
|
||||
const sourceLabel = sourceId ? sourceTitleById(sourceId) : '-';
|
||||
const targetName = String(item.external_warehouse_name || '-');
|
||||
return `${sourceLabel} → ${targetName}`;
|
||||
}
|
||||
return String(item.display_name || item.rule_name || item.source_code || item.profile_code || item.external_warehouse_name || '-');
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表卡副标题。
|
||||
* 核心逻辑:mappings 展示「在途仓编码 → 目标仓编码」;缺在途仓时退化为仅目标编码。
|
||||
* @param item - 当前列表行对象
|
||||
* @returns 副标题文案
|
||||
*/
|
||||
function rowMeta(item: Item): string {
|
||||
if (activeTab.value === 'mappings') {
|
||||
const targetCode = String(item.external_warehouse_code || '-');
|
||||
const inTransit = String(item.in_transit_warehouse_code || '').trim();
|
||||
return inTransit ? `${inTransit} → ${targetCode}` : targetCode;
|
||||
}
|
||||
if (activeTab.value === 'inventoryFields') return `${t(`admin.shippingInventory.inventoryFieldType.${item.value_type || 'text'}`)} · ${t(`admin.shippingInventory.inventoryFieldPurposeOption.${item.usage_type || 'general'}`)}`;
|
||||
if (item.connector_type) return String(item.display_name ? t(`admin.shippingInventory.platform.${item.connector_type}`) : item.connector_type);
|
||||
// 解析规则列表带出用途徽标文案,库存/异动两种规则在列表一眼可分。
|
||||
@@ -1640,51 +1608,6 @@ function serialiseReceiptInput(): string {
|
||||
});
|
||||
}
|
||||
|
||||
/** 返回状态轨道的简洁可视标记,文本状态仍由相邻内容提供,避免颜色成为唯一信息来源。 */
|
||||
function readinessMarker(status: ShippingInventoryReadinessCheck['status']): string {
|
||||
const marker = readinessMarkerKind(status);
|
||||
if (marker === 'complete') return '✓';
|
||||
if (marker === 'attention') return '!';
|
||||
return '•';
|
||||
}
|
||||
|
||||
/** 将服务端脱敏证据翻译为管理员可理解的当前步骤说明。 */
|
||||
function readinessDetail(check: ShippingInventoryReadinessCheck): string {
|
||||
if (check.status === 'passed') return t('admin.shippingInventory.readinessState.passed');
|
||||
if (check.status === 'stale') return t('admin.shippingInventory.readinessState.stale');
|
||||
if (check.status === 'failed') return t('admin.shippingInventory.readinessState.failed');
|
||||
if (check.status === 'empty') return t('admin.shippingInventory.readinessState.empty');
|
||||
return check.blocking ? t('admin.shippingInventory.readinessState.required') : t('admin.shippingInventory.readinessState.optional');
|
||||
}
|
||||
|
||||
/** 每项门禁只映射一个推荐动作;已经通过和依赖测试的辅助检查不额外制造操作入口。 */
|
||||
function readinessActionLabel(check: ShippingInventoryReadinessCheck): string {
|
||||
if (!check.blocking) return '';
|
||||
if (!needsReadinessAction(check)) return '';
|
||||
if (check.action === 'run_configuration_test') return configurationTestLoading.value
|
||||
? t('admin.shippingInventory.configurationTestRunning')
|
||||
: t('admin.shippingInventory.startConfigurationTest');
|
||||
return t(`admin.shippingInventory.readinessAction.${check.action}`);
|
||||
}
|
||||
|
||||
/** 未保存的 Source 编辑必须先提交到服务端,确保测试和启用都基于同一配置版本。 */
|
||||
function isReadinessActionBlocked(check: ShippingInventoryReadinessCheck): boolean {
|
||||
return sourceDirty.value || (check.action === 'run_configuration_test' && configurationTestLoading.value);
|
||||
}
|
||||
|
||||
/** 将阻断项引导到所属配置区域;测试动作仍停留在当前站点抽屉内执行。 */
|
||||
function runReadinessAction(check: ShippingInventoryReadinessCheck): void {
|
||||
if (isReadinessActionBlocked(check)) {
|
||||
message.warning(t('admin.shippingInventory.saveBeforeReadinessAction'));
|
||||
return;
|
||||
}
|
||||
if (check.action === 'run_configuration_test') { void startConfigurationTest(); return; }
|
||||
const target: Record<Exclude<ShippingInventoryReadinessCheck['action'], 'run_configuration_test'>, TabKey> = {
|
||||
configure_connection: 'profiles', configure_parsing_profile: 'parsing',
|
||||
configure_excel_template: 'templates', configure_warehouse_mapping: 'mappings',
|
||||
};
|
||||
selectTab(target[check.action]);
|
||||
}
|
||||
function connectionName(sourceCode: unknown): string { const sourceItem = sources.value.find((source) => source.source_code === sourceCode); const profileItem = profiles.value.find((profile) => Number(profile.id) === Number(sourceItem?.rpa_profile_id)); return profileItem?.profile_code || t('admin.shippingInventory.historyNotCaptured'); }
|
||||
function warehouseName(item: Item): string { return item.warehouse_id || (item.source_code === 'CRANE' ? t('admin.shippingInventory.dynamicWarehouse') : t('admin.shippingInventory.historyNotCaptured')); }
|
||||
function auditStatus(value: unknown): string { const key = String(value || 'unknown'); return t(`admin.shippingInventory.auditStatus.${key}`); }
|
||||
@@ -1804,7 +1727,11 @@ onMounted(load);
|
||||
.condition-empty { color: #8190a0; font-size: 12px; }
|
||||
.inline-check { flex-direction: row !important; align-items: center; gap: 4px !important; white-space: nowrap; font-size: 11px !important; }
|
||||
.switch-field { display: flex; flex-direction: column; gap: 6px; color: #64748b; font-size: 12px; font-weight: 500; }.status-switch { display: inline-flex; width: fit-content; align-items: center; gap: 7px; border: 0; background: transparent; padding: 2px 0; color: #94a3b8; font: inherit; font-size: 12px; cursor: pointer; }.status-switch i { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #cbd5e1; transition: background .18s; }.status-switch i::after { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(15 23 42 / 25%); content: ''; transition: transform .18s; }.status-switch.on { color: #15803d; }.status-switch.on i { background: #22c55e; }.status-switch.on i::after { transform: translateX(14px); }.status-switch b { font-weight: 500; }
|
||||
.form-actions { position: sticky; z-index: 2; bottom: 0; display: flex; flex-wrap: wrap; gap: 10px; grid-column: 1 / -1; margin: 6px -20px -20px; border-top: 1px solid #dce6ef; background: rgb(255 255 255 / 96%); box-shadow: 0 -8px 18px rgb(15 23 42 / 7%); padding: 14px 20px; backdrop-filter: blur(8px); }
|
||||
.form-actions { position: sticky; z-index: 2; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; grid-column: 1 / -1; margin: 6px -20px -20px; border-top: 1px solid #dce6ef; background: rgb(255 255 255 / 96%); box-shadow: 0 -8px 18px rgb(15 23 42 / 7%); padding: 14px 20px; backdrop-filter: blur(8px); }
|
||||
.source-enabled-footer { display: flex; margin-right: auto; min-width: 0; align-items: center; gap: 10px; }
|
||||
.source-enabled-label { flex: 0 0 auto; color: #475569; font-size: 13px; font-weight: 600; }
|
||||
.source-enabled-hint { overflow: hidden; color: #94a3b8; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.form-actions-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
|
||||
.audit-table-wrap { overflow-x: auto; border: 1px solid #dce6ef; border-radius: 10px; background: #fff; }
|
||||
.audit-table { table-layout: fixed; border-collapse: collapse; font-size: 12px; }
|
||||
.audit-table th { position: relative; overflow: hidden; padding: 11px 12px; background: #f8fafc; color: #64748b; font-weight: 600; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* features/admin/modules/shipping-inventory/receiptReportConfigForm.ts
|
||||
* 用途:构建独立收料报表配置的受限保存载荷。
|
||||
* 依赖:无外部依赖。
|
||||
* 逻辑:页面仅将收料路径与查询条件提交到收料配置 API,与库存同构(Warehouse 为条件之一),
|
||||
* 逻辑:页面仅将收料路径与查询条件提交到收料配置 API,与库存同构(查询条件可选,空=页面默认),
|
||||
* 隔离库存站点字段;收料无独立启停字段,是否运行统一由库存站点 enabled 决定。
|
||||
*/
|
||||
|
||||
|
||||
Reference in new issue
Block a user