feat(ui): 工作台界面全部替换为element plus
This commit is contained in:
1 parent
26d213c05b
commit
d5f988a16c
38 files changed
+4501
-3087
No files matched your search
+13
-6
@@ -3,6 +3,7 @@
|
||||
* 用途:锁定人工上传确认弹窗无障碍与无凭据提交契约。
|
||||
* 依赖:vitest、@vue/test-utils、vue-i18n、shipping-tasks API mock。
|
||||
* 逻辑:打开时具备 dialog 角色;Escape 关闭;无需截图/PDF或回执即可确认;关闭后恢复先前焦点。
|
||||
* ElDialog 传送到 body,断言改查 document.body,业务结果不变。
|
||||
*/
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { mount, flushPromises } from '@vue/test-utils';
|
||||
@@ -59,9 +60,14 @@ describe('ManualUploadEvidenceDialog', () => {
|
||||
it('exposes dialog accessibility attributes when open', async () => {
|
||||
const wrapper = mountDialog(true);
|
||||
await nextTick();
|
||||
const dialog = wrapper.get('[data-testid="manual-upload-evidence-dialog"]');
|
||||
expect(dialog.attributes('role')).toBe('dialog');
|
||||
expect(dialog.attributes('aria-modal')).toBe('true');
|
||||
await flushPromises();
|
||||
const marked = document.body.querySelector('[data-testid="manual-upload-evidence-dialog"]');
|
||||
const dialog = marked?.getAttribute('role') === 'dialog'
|
||||
? marked
|
||||
: marked?.closest('[role="dialog"]') || document.body.querySelector('[role="dialog"]');
|
||||
expect(dialog?.getAttribute('role')).toBe('dialog');
|
||||
expect(dialog?.getAttribute('aria-modal')).toBe('true');
|
||||
expect(dialog?.textContent).toContain('登记人工上传');
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
@@ -92,10 +98,11 @@ describe('ManualUploadEvidenceDialog', () => {
|
||||
it('submits with business_no without file evidence or freight receipt', async () => {
|
||||
const wrapper = mountDialog(true);
|
||||
await nextTick();
|
||||
const submit = wrapper.findAll('button').find((btn) => btn.text().includes('确认已上传'));
|
||||
await flushPromises();
|
||||
const submit = Array.from(document.body.querySelectorAll('button')).find((btn) => btn.textContent?.includes('确认已上传'));
|
||||
expect(submit).toBeTruthy();
|
||||
expect(submit!.attributes('disabled')).toBeUndefined();
|
||||
await submit!.trigger('click');
|
||||
expect(submit!.hasAttribute('disabled')).toBe(false);
|
||||
submit!.click();
|
||||
await flushPromises();
|
||||
expect(wrapper.emitted('success')).toHaveLength(1);
|
||||
wrapper.unmount();
|
||||
|
||||
+39
-100
@@ -1,13 +1,14 @@
|
||||
/**
|
||||
* features/workspace/shipping-task-center/ManualUploadEvidenceDialog.vue
|
||||
* 用途:人工确认货代已上传当前发货通知 Excel 的对话框。
|
||||
* 依赖:workspace shipping-tasks.api、Vue watch/nextTick。
|
||||
* 逻辑:由 TaskTodoPanel 在 mark_manual_uploaded 动作时打开;不采集截图/PDF或回执号;
|
||||
* 对齐复核弹层无障碍:role=dialog、aria-modal、焦点陷阱、Escape、关闭后焦点恢复。
|
||||
* 依赖:workspace shipping-tasks.api、element-plus、Vue watch/nextTick。
|
||||
* 逻辑:由 TaskTodoPanel 在 mark_manual_uploaded 动作时打开;不采集截图/PDF或回执号。
|
||||
* 对话框语义、Escape 与焦点恢复交给 ElDialog;样式由任务中心页或对话页引入。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { nextTick, onBeforeUnmount, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElButton, ElDialog, ElText } from 'element-plus';
|
||||
import { markWorkspaceShippingManualUploaded } from '@/features/workspace/api/shipping-tasks.api';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -25,29 +26,10 @@ const emit = defineEmits<{
|
||||
const { t } = useI18n();
|
||||
const busy = ref(false);
|
||||
const error = ref('');
|
||||
const panelRef = ref<HTMLElement | null>(null);
|
||||
let previouslyFocused: HTMLElement | null = null;
|
||||
|
||||
const FOCUSABLE_SELECTOR = [
|
||||
'a[href]',
|
||||
'button:not([disabled])',
|
||||
'textarea:not([disabled])',
|
||||
'input:not([disabled])',
|
||||
'select:not([disabled])',
|
||||
'[tabindex]:not([tabindex="-1"])',
|
||||
].join(',');
|
||||
|
||||
/**
|
||||
* 收集弹窗内可聚焦控件,供 Tab 陷阱使用。
|
||||
*/
|
||||
function focusableNodes(): HTMLElement[] {
|
||||
if (!panelRef.value) return [];
|
||||
return Array.from(panelRef.value.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR))
|
||||
.filter((node) => !node.hasAttribute('disabled') && node.getAttribute('aria-hidden') !== 'true');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭对话框并清空本地表单。
|
||||
* 关闭对话框并清空错误。提交中不允许关。
|
||||
*/
|
||||
function close() {
|
||||
if (busy.value) return;
|
||||
@@ -56,38 +38,22 @@ function close() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape 关闭;Tab / Shift+Tab 在弹窗内循环。
|
||||
* ElDialog 关闭前拦截。提交中不调用 done,遮罩和 Escape 都留在弹窗里。
|
||||
* @param done - Element 提供的真正关闭回调
|
||||
*/
|
||||
function onBeforeClose(done: () => void) {
|
||||
if (busy.value) return;
|
||||
done();
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape 关闭。ElDialog 在 jsdom 里不一定收到测试派发的键盘事件,这里与它对齐。
|
||||
* @param event - 文档上的按键
|
||||
*/
|
||||
function onKeydown(event: KeyboardEvent) {
|
||||
if (!props.open) return;
|
||||
if (event.key === 'Escape') {
|
||||
if (busy.value) return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
close();
|
||||
return;
|
||||
}
|
||||
if (event.key !== 'Tab') return;
|
||||
const nodes = focusableNodes();
|
||||
const first = nodes[0];
|
||||
const last = nodes[nodes.length - 1];
|
||||
if (!first || !last) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
const active = document.activeElement as HTMLElement | null;
|
||||
const inside = Boolean(active && panelRef.value?.contains(active));
|
||||
if (event.shiftKey) {
|
||||
if (!inside || active === first) {
|
||||
event.preventDefault();
|
||||
last.focus();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!inside || active === last) {
|
||||
event.preventDefault();
|
||||
first.focus();
|
||||
}
|
||||
if (!props.open || event.key !== 'Escape' || busy.value) return;
|
||||
event.preventDefault();
|
||||
close();
|
||||
}
|
||||
|
||||
watch(
|
||||
@@ -99,8 +65,6 @@ watch(
|
||||
? document.activeElement
|
||||
: null;
|
||||
document.addEventListener('keydown', onKeydown, true);
|
||||
await nextTick();
|
||||
(focusableNodes()[0] || panelRef.value)?.focus();
|
||||
return;
|
||||
}
|
||||
if (!isOpen && wasOpen) {
|
||||
@@ -143,50 +107,25 @@ async function submit() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="open"
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4"
|
||||
@click.self="close"
|
||||
<ElDialog
|
||||
:model-value="open"
|
||||
:title="t('workspace.shippingNotice.manualUpload.title')"
|
||||
width="480px"
|
||||
align-center
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="!busy"
|
||||
:before-close="onBeforeClose"
|
||||
data-testid="manual-upload-evidence-dialog"
|
||||
@update:model-value="(value) => { if (!value) close(); }"
|
||||
>
|
||||
<div
|
||||
ref="panelRef"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
:aria-labelledby="'manual-upload-evidence-title'"
|
||||
tabindex="-1"
|
||||
class="w-full max-w-md rounded-2xl border border-default bg-surface p-5 shadow-xl outline-none"
|
||||
data-testid="manual-upload-evidence-dialog"
|
||||
>
|
||||
<h3
|
||||
id="manual-upload-evidence-title"
|
||||
class="text-base font-semibold text-primary"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.manualUpload.title') }}
|
||||
</h3>
|
||||
<p class="mt-1 text-sm text-muted">
|
||||
{{ $t('workspace.shippingNotice.manualUpload.hint') }}
|
||||
</p>
|
||||
|
||||
<p v-if="error" class="mt-3 text-sm text-rose-600" role="alert">{{ error }}</p>
|
||||
|
||||
<div class="mt-5 flex justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl border border-default px-3 py-1.5 text-sm"
|
||||
:disabled="busy"
|
||||
@click="close"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.manualUpload.cancel') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl bg-brand-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-brand-700 disabled:opacity-50"
|
||||
:disabled="busy || disabled"
|
||||
@click="submit"
|
||||
>
|
||||
{{ busy ? $t('workspace.shippingNotice.manualUpload.submitting') : $t('workspace.shippingNotice.manualUpload.submit') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ElText>{{ t('workspace.shippingNotice.manualUpload.hint') }}</ElText>
|
||||
<ElText v-if="error" type="danger">{{ error }}</ElText>
|
||||
<template #footer>
|
||||
<ElButton :disabled="busy" @click="close">{{ t('workspace.shippingNotice.manualUpload.cancel') }}</ElButton>
|
||||
<ElButton type="primary" :loading="busy" :disabled="busy || disabled" @click="submit">
|
||||
{{ busy ? t('workspace.shippingNotice.manualUpload.submitting') : t('workspace.shippingNotice.manualUpload.submit') }}
|
||||
</ElButton>
|
||||
</template>
|
||||
</ElDialog>
|
||||
</template>
|
||||
@@ -1,14 +1,15 @@
|
||||
<!--
|
||||
features/workspace/shipping-task-center/ShippingDoneLineReport.vue
|
||||
用途:已完成桶「通知完成」子视图——跨 OT 平铺的明细行报表(13 列 + 筛选 + 导出)。
|
||||
依赖:shipping-tasks.api 类型;导出下载由父级执行。
|
||||
依赖:shipping-tasks.api 类型、element-plus;导出下载由父级执行。
|
||||
逻辑:只读报表(无抽屉、无行操作);首列 OT/business 编号仅页面展示,
|
||||
导出为固定 12 列标准格式(后端裁决);分页按明细行计。
|
||||
导出为固定 12 列标准格式(后端裁决);分页按明细行计。样式由任务中心页引入。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { Download } from 'lucide-vue-next';
|
||||
import type { ShippingDoneLineItem } from '@/features/workspace/api/shipping-tasks.api';
|
||||
import type { ShippingDoneLineFilters } from '@/features/workspace/api/shipping-tasks.api';
|
||||
import { computed } from 'vue';
|
||||
import { Download } from '@element-plus/icons-vue';
|
||||
import { ElButton, ElDatePicker, ElInput, ElPagination, ElTable, ElTableColumn } from 'element-plus';
|
||||
import type { ShippingDoneLineFilters, ShippingDoneLineItem } from '@/features/workspace/api/shipping-tasks.api';
|
||||
|
||||
const props = defineProps<{
|
||||
items: ShippingDoneLineItem[];
|
||||
@@ -27,13 +28,26 @@ const emit = defineEmits<{
|
||||
(event: 'export'): void;
|
||||
}>();
|
||||
|
||||
const totalPages = () => Math.max(1, Math.ceil(props.total / props.pageSize));
|
||||
const totalPages = computed(() => Math.max(1, Math.ceil(props.total / props.pageSize)));
|
||||
|
||||
function setFilter(key: keyof ShippingDoneLineFilters, event: Event) {
|
||||
const value = String((event.target as HTMLInputElement).value || '');
|
||||
emit('update:filters', { ...props.filters, [key]: value });
|
||||
/**
|
||||
* 写回一条筛选草稿。日期清空写回空字符串,与原 input 空值一致。
|
||||
* @param key - 筛选字段
|
||||
* @param value - 输入值;日期清空为 undefined
|
||||
*/
|
||||
function setFilter(key: keyof ShippingDoneLineFilters, value: string | undefined) {
|
||||
emit('update:filters', { ...props.filters, [key]: value || '' });
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细行主键。
|
||||
* @param line - 完成明细
|
||||
*/
|
||||
function doneLineKey(line: ShippingDoneLineItem): string {
|
||||
return `${line.task_no}-${line.line_no}-${line.part_number || ''}`;
|
||||
}
|
||||
|
||||
/** 通知父级按当前筛选导出。 */
|
||||
function onExport(): void {
|
||||
emit('export');
|
||||
}
|
||||
@@ -42,140 +56,125 @@ function onExport(): void {
|
||||
<template>
|
||||
<div class="space-y-3">
|
||||
<div class="flex flex-wrap items-end gap-3 rounded-2xl border border-default bg-surface px-4 py-3">
|
||||
<label class="space-y-1">
|
||||
<span class="text-xs font-medium text-muted">{{ $t('workspace.shippingNotice.myTodos.doneReport.filters.customer') }}</span>
|
||||
<input
|
||||
type="text"
|
||||
class="input-field text-sm min-w-[10rem]"
|
||||
:value="filters?.customer || ''"
|
||||
<label class="done-filter">
|
||||
<span>{{ $t('workspace.shippingNotice.myTodos.doneReport.filters.customer') }}</span>
|
||||
<ElInput
|
||||
:model-value="filters?.customer || ''"
|
||||
:placeholder="$t('workspace.shippingNotice.myTodos.filters.customerPlaceholder')"
|
||||
data-testid="done-lines-filter-customer"
|
||||
@change="setFilter('customer', $event)"
|
||||
@update:model-value="setFilter('customer', $event)"
|
||||
@keyup.enter="emit('apply')"
|
||||
>
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1">
|
||||
<span class="text-xs font-medium text-muted">{{ $t('workspace.shippingNotice.myTodos.doneReport.filters.partNumber') }}</span>
|
||||
<input
|
||||
type="text"
|
||||
class="input-field text-sm min-w-[10rem]"
|
||||
:value="filters?.part_number || ''"
|
||||
<label class="done-filter">
|
||||
<span>{{ $t('workspace.shippingNotice.myTodos.doneReport.filters.partNumber') }}</span>
|
||||
<ElInput
|
||||
:model-value="filters?.part_number || ''"
|
||||
data-testid="done-lines-filter-part"
|
||||
@change="setFilter('part_number', $event)"
|
||||
@update:model-value="setFilter('part_number', $event)"
|
||||
@keyup.enter="emit('apply')"
|
||||
>
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1">
|
||||
<span class="text-xs font-medium text-muted">{{ $t('workspace.shippingNotice.myTodos.doneReport.filters.dateFrom') }}</span>
|
||||
<input
|
||||
<label class="done-filter">
|
||||
<span>{{ $t('workspace.shippingNotice.myTodos.doneReport.filters.dateFrom') }}</span>
|
||||
<ElDatePicker
|
||||
:model-value="filters?.notice_date_from || undefined"
|
||||
type="date"
|
||||
class="input-field text-sm"
|
||||
:value="filters?.notice_date_from || ''"
|
||||
value-format="YYYY-MM-DD"
|
||||
data-testid="done-lines-filter-date-from"
|
||||
@change="setFilter('notice_date_from', $event)"
|
||||
>
|
||||
@update:model-value="setFilter('notice_date_from', $event)"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1">
|
||||
<span class="text-xs font-medium text-muted">{{ $t('workspace.shippingNotice.myTodos.doneReport.filters.dateTo') }}</span>
|
||||
<input
|
||||
<label class="done-filter">
|
||||
<span>{{ $t('workspace.shippingNotice.myTodos.doneReport.filters.dateTo') }}</span>
|
||||
<ElDatePicker
|
||||
:model-value="filters?.notice_date_to || undefined"
|
||||
type="date"
|
||||
class="input-field text-sm"
|
||||
:value="filters?.notice_date_to || ''"
|
||||
value-format="YYYY-MM-DD"
|
||||
data-testid="done-lines-filter-date-to"
|
||||
@change="setFilter('notice_date_to', $event)"
|
||||
>
|
||||
@update:model-value="setFilter('notice_date_to', $event)"
|
||||
/>
|
||||
</label>
|
||||
<div class="flex gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl bg-brand-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-brand-700 disabled:opacity-50"
|
||||
:disabled="loading"
|
||||
@click="emit('apply')"
|
||||
>
|
||||
<ElButton type="primary" :loading="loading" @click="emit('apply')">
|
||||
{{ $t('workspace.shippingNotice.myTodos.filters.apply') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1.5 rounded-xl border border-brand-300 px-3 py-1.5 text-sm font-medium text-brand-700 hover:bg-brand-50 disabled:opacity-50"
|
||||
:disabled="exportBusy || loading || !total"
|
||||
</ElButton>
|
||||
<ElButton
|
||||
:icon="Download"
|
||||
:loading="exportBusy"
|
||||
:disabled="loading || !total"
|
||||
data-testid="done-lines-export"
|
||||
@click="onExport"
|
||||
>
|
||||
<Download class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.shippingNotice.myTodos.doneReport.export') }}
|
||||
</button>
|
||||
</ElButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="rounded-2xl border border-dashed border-default py-10 text-center text-sm text-muted">
|
||||
{{ $t('workspace.shippingNotice.loading') }}
|
||||
</div>
|
||||
<div v-else-if="!items.length" class="rounded-2xl border border-dashed border-default py-10 text-center text-sm text-muted">
|
||||
{{ $t('workspace.shippingNotice.myTodos.empty') }}
|
||||
</div>
|
||||
<div v-else class="overflow-x-auto rounded-2xl border border-default bg-surface">
|
||||
<table class="w-full min-w-[1200px] border-collapse text-[13px]" data-testid="done-lines-table">
|
||||
<thead>
|
||||
<tr class="border-b border-default bg-surface-soft/60 text-left text-xs text-muted">
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.doneReport.columns.taskNo') }}</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.doneReport.columns.customer') }}</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.doneReport.columns.customerCode') }}</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.doneReport.columns.orderDate') }}</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.doneReport.columns.lineNo') }}</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.doneReport.columns.partNumber') }}</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.doneReport.columns.qty') }}</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.doneReport.columns.requiredDate') }}</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.doneReport.columns.customerPo') }}</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.doneReport.columns.usedQty') }}</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.doneReport.columns.openQty') }}</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.doneReport.columns.sourceOrderNo') }}</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.doneReport.columns.unitPrice') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="line in items"
|
||||
:key="`${line.task_no}-${line.line_no}`"
|
||||
class="border-b border-[#f0f3f8]"
|
||||
>
|
||||
<td class="px-3 py-2 font-mono text-xs font-semibold text-primary">
|
||||
{{ line.business_no || line.task_no }}
|
||||
</td>
|
||||
<td class="px-3 py-2">{{ line.customer_name || '—' }}</td>
|
||||
<td class="px-3 py-2">{{ line.customer_code || '—' }}</td>
|
||||
<td class="px-3 py-2 tabular-nums">{{ line.order_date || '—' }}</td>
|
||||
<td class="px-3 py-2 tabular-nums">{{ line.line_no }}</td>
|
||||
<td class="px-3 py-2 font-mono">{{ line.part_number || '—' }}</td>
|
||||
<td class="px-3 py-2 tabular-nums">{{ line.qty ?? '' }}</td>
|
||||
<td class="px-3 py-2 tabular-nums">{{ line.required_date || '—' }}</td>
|
||||
<td class="px-3 py-2">{{ line.customer_po_number || '—' }}</td>
|
||||
<td class="px-3 py-2 tabular-nums">{{ line.used_qty ?? '' }}</td>
|
||||
<td class="px-3 py-2 tabular-nums">{{ line.open_qty ?? '' }}</td>
|
||||
<td class="px-3 py-2 font-mono">{{ line.source_order_number || '—' }}</td>
|
||||
<td class="px-3 py-2 tabular-nums">{{ line.unit_price ?? '' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div v-if="loading">{{ $t('workspace.shippingNotice.loading') }}</div>
|
||||
<div v-else-if="!items.length">{{ $t('workspace.shippingNotice.myTodos.empty') }}</div>
|
||||
<div v-else data-testid="done-lines-table">
|
||||
<ElTable :data="items" :row-key="doneLineKey">
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.myTodos.doneReport.columns.taskNo')" min-width="140">
|
||||
<template #default="{ row }">{{ (row as ShippingDoneLineItem).business_no || (row as ShippingDoneLineItem).task_no }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.myTodos.doneReport.columns.customer')" min-width="120">
|
||||
<template #default="{ row }">{{ (row as ShippingDoneLineItem).customer_name || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.myTodos.doneReport.columns.customerCode')" min-width="120">
|
||||
<template #default="{ row }">{{ (row as ShippingDoneLineItem).customer_code || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.myTodos.doneReport.columns.orderDate')" min-width="120">
|
||||
<template #default="{ row }">{{ (row as ShippingDoneLineItem).order_date || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.myTodos.doneReport.columns.lineNo')" min-width="80">
|
||||
<template #default="{ row }">{{ (row as ShippingDoneLineItem).line_no }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.myTodos.doneReport.columns.partNumber')" min-width="140">
|
||||
<template #default="{ row }">{{ (row as ShippingDoneLineItem).part_number || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.myTodos.doneReport.columns.qty')" min-width="80">
|
||||
<template #default="{ row }">{{ (row as ShippingDoneLineItem).qty ?? '' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.myTodos.doneReport.columns.requiredDate')" min-width="120">
|
||||
<template #default="{ row }">{{ (row as ShippingDoneLineItem).required_date || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.myTodos.doneReport.columns.customerPo')" min-width="120">
|
||||
<template #default="{ row }">{{ (row as ShippingDoneLineItem).customer_po_number || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.myTodos.doneReport.columns.usedQty')" min-width="100">
|
||||
<template #default="{ row }">{{ (row as ShippingDoneLineItem).used_qty ?? '' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.myTodos.doneReport.columns.openQty')" min-width="100">
|
||||
<template #default="{ row }">{{ (row as ShippingDoneLineItem).open_qty ?? '' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.myTodos.doneReport.columns.sourceOrderNo')" min-width="140">
|
||||
<template #default="{ row }">{{ (row as ShippingDoneLineItem).source_order_number || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.myTodos.doneReport.columns.unitPrice')" min-width="100">
|
||||
<template #default="{ row }">{{ (row as ShippingDoneLineItem).unit_price ?? '' }}</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
|
||||
<div v-if="totalPages() > 1" class="flex items-center justify-between gap-2 text-xs text-muted">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-2 py-1 disabled:opacity-50"
|
||||
:disabled="page <= 1 || loading"
|
||||
@click="emit('page-change', page - 1)"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.pagination.previous') }}
|
||||
</button>
|
||||
<span>{{ page }}/{{ totalPages() }}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-2 py-1 disabled:opacity-50"
|
||||
:disabled="page >= totalPages() || loading"
|
||||
@click="emit('page-change', page + 1)"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.pagination.next') }}
|
||||
</button>
|
||||
</div>
|
||||
<ElPagination
|
||||
v-if="totalPages > 1"
|
||||
:current-page="page"
|
||||
:page-size="pageSize"
|
||||
:total="total"
|
||||
layout="prev, pager, next"
|
||||
background
|
||||
:disabled="loading"
|
||||
@current-change="emit('page-change', $event)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.done-filter {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
width: 12rem;
|
||||
}
|
||||
</style>
|
||||
+166
-156
@@ -1,13 +1,25 @@
|
||||
/**
|
||||
* features/workspace/shipping-task-center/ShippingRunProgressTable.vue
|
||||
* 用途:任务中心「我的识别」续办表——展示用户自有抽取 Run 的阶段、耗时、取消态与续办动作。
|
||||
* 依赖:shipping.api 分页列表/取消/重试、vue-i18n、vue-router、orderExtractionProgressDisplay。
|
||||
* 逻辑:事实来自后端投影;打开会话/复核深链到 Chat;取消/重试复用工作台 API。
|
||||
* 依赖:shipping.api 分页列表/取消/重试、element-plus、vue-i18n、vue-router、orderExtractionProgressDisplay。
|
||||
* 逻辑:事实来自后端投影;打开会话/复核深链到 Chat;取消/重试复用工作台 API。样式由任务中心页引入。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import {
|
||||
ElButton,
|
||||
ElInput,
|
||||
ElLoading,
|
||||
ElOption,
|
||||
ElPagination,
|
||||
ElSelect,
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElTag,
|
||||
ElText,
|
||||
} from 'element-plus';
|
||||
import {
|
||||
cancelWorkspaceShippingOrderExtractionRun,
|
||||
listShippingChatAgents,
|
||||
@@ -18,6 +30,7 @@ import {
|
||||
import type { ShippingOrderExtractionRun } from '@/features/chat/types/shipping.api.types';
|
||||
import { formatOrderExtractionElapsed, resolveOrderExtractionRunStageKey } from '@/features/chat/shipping/orderExtractionProgressDisplay';
|
||||
|
||||
const vLoading = ElLoading.directive;
|
||||
const { t, te } = useI18n();
|
||||
const router = useRouter();
|
||||
|
||||
@@ -32,6 +45,7 @@ const total = ref(0);
|
||||
const rows = ref<ShippingOrderExtractionRun[]>([]);
|
||||
const chatAgentId = ref<number | null>(null);
|
||||
const error = ref('');
|
||||
const statusOptions = ['queued', 'processing', 'completed', 'partially_completed', 'review_required', 'failed', 'cancelled'];
|
||||
|
||||
/**
|
||||
* 解析货代 Chat Agent,供会话深链。
|
||||
@@ -70,6 +84,7 @@ async function load() {
|
||||
/**
|
||||
* 用户可见阶段文案;无投影时回退状态文案。
|
||||
* v2:key 构造改走共享 resolveOrderExtractionRunStageKey(输出不变,仅事实解析同源)。
|
||||
* @param run - 识别 Run
|
||||
*/
|
||||
function stageLabel(run: ShippingOrderExtractionRun): string {
|
||||
const stage = String(run.current_activity?.user_visible_stage || '').trim();
|
||||
@@ -83,6 +98,7 @@ function stageLabel(run: ShippingOrderExtractionRun): string {
|
||||
|
||||
/**
|
||||
* 打开所属会话;活动 Run 进入聊天进度面。
|
||||
* @param run - 识别 Run
|
||||
*/
|
||||
async function openInChat(run: ShippingOrderExtractionRun) {
|
||||
const agentId = Number(run.agent_id || chatAgentId.value || 0);
|
||||
@@ -97,7 +113,11 @@ async function openInChat(run: ShippingOrderExtractionRun) {
|
||||
await router.push({ path: `/chat/${agentId}`, query });
|
||||
}
|
||||
|
||||
/** 请求取消整批;排队立即取消,执行中进入正在取消。 */
|
||||
/**
|
||||
* 请求取消整批;排队立即取消,执行中进入正在取消。
|
||||
* @param run - 识别 Run
|
||||
* @param reason - 可选取消原因
|
||||
*/
|
||||
async function submitCancelRun(run: ShippingOrderExtractionRun, reason?: string | null) {
|
||||
if (actingRunNo.value) return;
|
||||
actingRunNo.value = run.run_no;
|
||||
@@ -117,6 +137,7 @@ async function submitCancelRun(run: ShippingOrderExtractionRun, reason?: string
|
||||
|
||||
/**
|
||||
* 展开/收起单行取消表单。
|
||||
* @param run - 识别 Run
|
||||
*/
|
||||
function beginCancelRun(run: ShippingOrderExtractionRun) {
|
||||
if (pendingCancelRunNo.value === run.run_no) {
|
||||
@@ -130,6 +151,7 @@ function beginCancelRun(run: ShippingOrderExtractionRun) {
|
||||
|
||||
/**
|
||||
* 重试失败附件。
|
||||
* @param run - 识别 Run
|
||||
*/
|
||||
async function retryRun(run: ShippingOrderExtractionRun) {
|
||||
if (actingRunNo.value) return;
|
||||
@@ -144,6 +166,23 @@ async function retryRun(run: ShippingOrderExtractionRun) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态筛选。清空写回空字符串,接口仍查全部状态。
|
||||
* @param value - 状态码;清空为 undefined
|
||||
*/
|
||||
function onStatusChange(value: string | undefined): void {
|
||||
status.value = value ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 翻页并重新加载。
|
||||
* @param nextPage - 1-based 页码
|
||||
*/
|
||||
function onPageChange(nextPage: number): void {
|
||||
page.value = nextPage;
|
||||
void load();
|
||||
}
|
||||
|
||||
watch(status, () => {
|
||||
page.value = 1;
|
||||
void load();
|
||||
@@ -161,166 +200,137 @@ defineExpose({ reload: load });
|
||||
<section class="space-y-3" data-testid="shipping-run-progress-table">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<div>
|
||||
<h3 class="text-base font-semibold text-primary">{{ t('workspace.shippingNotice.myRuns.title') }}</h3>
|
||||
<p class="text-xs text-muted">{{ t('workspace.shippingNotice.myRuns.subtitle') }}</p>
|
||||
<h3>{{ t('workspace.shippingNotice.myRuns.title') }}</h3>
|
||||
<ElText type="info" size="small">{{ t('workspace.shippingNotice.myRuns.subtitle') }}</ElText>
|
||||
</div>
|
||||
<label class="flex items-center gap-2 text-sm text-secondary">
|
||||
{{ t('workspace.shippingNotice.myRuns.status') }}
|
||||
<select v-model="status" class="input-field py-1.5 text-sm">
|
||||
<option value="">{{ t('workspace.shippingNotice.myRuns.allStatuses') }}</option>
|
||||
<option
|
||||
v-for="value in ['queued', 'processing', 'completed', 'partially_completed', 'review_required', 'failed', 'cancelled']"
|
||||
:key="value"
|
||||
:value="value"
|
||||
>
|
||||
{{ t(`chat.shippingOrderExtractionCardTitle.${value}`) }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<ElSelect
|
||||
class="run-status-select"
|
||||
:model-value="status || undefined"
|
||||
clearable
|
||||
:placeholder="t('workspace.shippingNotice.myRuns.allStatuses')"
|
||||
:aria-label="t('workspace.shippingNotice.myRuns.status')"
|
||||
@update:model-value="onStatusChange"
|
||||
>
|
||||
<ElOption
|
||||
v-for="value in statusOptions"
|
||||
:key="value"
|
||||
:value="value"
|
||||
:label="t(`chat.shippingOrderExtractionCardTitle.${value}`)"
|
||||
/>
|
||||
</ElSelect>
|
||||
</div>
|
||||
|
||||
<p v-if="error" class="rounded-lg border border-rose-200 bg-rose-50 p-3 text-sm text-rose-700">{{ error }}</p>
|
||||
<ElText v-if="error" type="danger">{{ error }}</ElText>
|
||||
|
||||
<div class="overflow-x-auto rounded-xl border border-default bg-surface">
|
||||
<table class="min-w-[860px] w-full text-left text-sm">
|
||||
<thead class="border-b border-default bg-surface-soft text-xs text-muted">
|
||||
<tr>
|
||||
<th class="px-3 py-2">{{ t('workspace.shippingNotice.myRuns.runNo') }}</th>
|
||||
<th class="px-3 py-2">{{ t('workspace.shippingNotice.myRuns.status') }}</th>
|
||||
<th class="px-3 py-2">{{ t('workspace.shippingNotice.myRuns.stage') }}</th>
|
||||
<th class="px-3 py-2">{{ t('workspace.shippingNotice.myRuns.summary') }}</th>
|
||||
<th class="px-3 py-2">{{ t('workspace.shippingNotice.myRuns.elapsed') }}</th>
|
||||
<th class="px-3 py-2">{{ t('workspace.shippingNotice.myRuns.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="loading">
|
||||
<td colspan="6" class="px-3 py-8 text-center text-muted">{{ t('workspace.shippingNotice.myRuns.loading') }}</td>
|
||||
</tr>
|
||||
<tr v-else-if="!rows.length">
|
||||
<td colspan="6" class="px-3 py-8 text-center text-muted">{{ t('workspace.shippingNotice.myRuns.empty') }}</td>
|
||||
</tr>
|
||||
<tr
|
||||
v-for="run in rows"
|
||||
:key="run.run_no"
|
||||
class="border-b border-default last:border-0"
|
||||
<ElTable
|
||||
v-loading="loading"
|
||||
:data="rows"
|
||||
row-key="run_no"
|
||||
:empty-text="t('workspace.shippingNotice.myRuns.empty')"
|
||||
>
|
||||
<ElTableColumn prop="run_no" :label="t('workspace.shippingNotice.myRuns.runNo')" min-width="160" />
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myRuns.status')" min-width="160">
|
||||
<template #default="{ row }">
|
||||
{{ t(`chat.shippingOrderExtractionCardTitle.${(row as ShippingOrderExtractionRun).status}`) }}
|
||||
<ElTag
|
||||
v-if="(row as ShippingOrderExtractionRun).cancellation?.requested && !(row as ShippingOrderExtractionRun).cancellation?.completed_at"
|
||||
type="warning"
|
||||
effect="light"
|
||||
>
|
||||
<td class="px-3 py-2 font-mono text-xs">{{ run.run_no }}</td>
|
||||
<td class="px-3 py-2">
|
||||
{{ t(`chat.shippingOrderExtractionCardTitle.${run.status}`) }}
|
||||
<span
|
||||
v-if="run.cancellation?.requested && !run.cancellation?.completed_at"
|
||||
class="ml-1 rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] text-amber-800"
|
||||
{{ t('chat.shippingOrderExtractionUserStage.cancellation_requested') }}
|
||||
</ElTag>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myRuns.stage')" min-width="160">
|
||||
<template #default="{ row }">
|
||||
<div>{{ stageLabel(row as ShippingOrderExtractionRun) }}</div>
|
||||
<ElText v-if="(row as ShippingOrderExtractionRun).current_activity?.file_name" type="info" size="small">
|
||||
{{ (row as ShippingOrderExtractionRun).current_activity?.file_name }}
|
||||
</ElText>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myRuns.summary')" min-width="220">
|
||||
<template #default="{ row }">
|
||||
{{ t('workspace.shippingNotice.myRuns.summaryCounts', {
|
||||
total: (row as ShippingOrderExtractionRun).summary?.total_documents || 0,
|
||||
done: (row as ShippingOrderExtractionRun).summary?.completed_documents || 0,
|
||||
review: (row as ShippingOrderExtractionRun).summary?.review_required_documents || 0,
|
||||
failed: (row as ShippingOrderExtractionRun).summary?.failed_documents || 0,
|
||||
cancelled: (row as ShippingOrderExtractionRun).summary?.cancelled_documents || 0,
|
||||
}) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myRuns.elapsed')" min-width="100">
|
||||
<template #default="{ row }">
|
||||
{{ formatOrderExtractionElapsed((row as ShippingOrderExtractionRun).current_activity?.elapsed_seconds) || '—' }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myRuns.actions')" min-width="220" align="right">
|
||||
<template #default="{ row }">
|
||||
<ElButton link type="primary" @click="openInChat(row as ShippingOrderExtractionRun)">
|
||||
{{ t('workspace.shippingNotice.myRuns.openChat') }}
|
||||
</ElButton>
|
||||
<template v-if="((row as ShippingOrderExtractionRun).available_actions || []).includes('cancel_run')">
|
||||
<div v-if="pendingCancelRunNo === (row as ShippingOrderExtractionRun).run_no">
|
||||
<div>{{ t('chat.shippingOrderExtractionCancel.reasonOptional') }}</div>
|
||||
<ElInput v-model="cancelReason" type="textarea" :rows="2" />
|
||||
<ElButton
|
||||
link
|
||||
type="danger"
|
||||
:loading="actingRunNo === (row as ShippingOrderExtractionRun).run_no"
|
||||
@click="submitCancelRun(row as ShippingOrderExtractionRun, cancelReason)"
|
||||
>
|
||||
{{ t('chat.shippingOrderExtractionUserStage.cancellation_requested') }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-3 py-2">
|
||||
<div>{{ stageLabel(run) }}</div>
|
||||
<div v-if="run.current_activity?.file_name" class="text-[11px] text-muted">
|
||||
{{ run.current_activity.file_name }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-3 py-2 text-xs text-secondary">
|
||||
{{ t('workspace.shippingNotice.myRuns.summaryCounts', {
|
||||
total: run.summary?.total_documents || 0,
|
||||
done: run.summary?.completed_documents || 0,
|
||||
review: run.summary?.review_required_documents || 0,
|
||||
failed: run.summary?.failed_documents || 0,
|
||||
cancelled: run.summary?.cancelled_documents || 0,
|
||||
}) }}
|
||||
</td>
|
||||
<td class="px-3 py-2 text-xs">
|
||||
{{ formatOrderExtractionElapsed(run.current_activity?.elapsed_seconds) || '—' }}
|
||||
</td>
|
||||
<td class="px-3 py-2">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="text-xs font-medium text-brand-700 hover:underline"
|
||||
@click="openInChat(run)"
|
||||
>
|
||||
{{ t('workspace.shippingNotice.myRuns.openChat') }}
|
||||
</button>
|
||||
<template v-if="(run.available_actions || []).includes('cancel_run')">
|
||||
<div
|
||||
v-if="pendingCancelRunNo === run.run_no"
|
||||
class="w-full min-w-[220px] space-y-1.5 rounded-md border border-rose-200 bg-rose-50/60 p-2 dark:border-rose-900/40 dark:bg-rose-950/20"
|
||||
>
|
||||
<label class="block text-[11px] text-secondary">
|
||||
{{ t('chat.shippingOrderExtractionCancel.reasonOptional') }}
|
||||
</label>
|
||||
<textarea
|
||||
v-model="cancelReason"
|
||||
rows="2"
|
||||
class="input-field w-full py-1 text-xs"
|
||||
/>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="text-xs font-medium text-rose-700 hover:underline"
|
||||
:disabled="actingRunNo === run.run_no"
|
||||
@click="submitCancelRun(run, cancelReason)"
|
||||
>
|
||||
{{ actingRunNo === run.run_no
|
||||
? t('chat.shippingOrderExtractionCancel.submitting')
|
||||
: t('chat.shippingOrderExtractionAction.cancel_run') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="text-xs text-muted hover:underline"
|
||||
:disabled="actingRunNo === run.run_no"
|
||||
@click="pendingCancelRunNo = ''; cancelReason = ''"
|
||||
>
|
||||
{{ t('chat.shippingOrderExtractionCancel.dismiss') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
v-else
|
||||
type="button"
|
||||
class="text-xs font-medium text-rose-700 hover:underline"
|
||||
:disabled="actingRunNo === run.run_no"
|
||||
@click="beginCancelRun(run)"
|
||||
>
|
||||
{{ t('chat.shippingOrderExtractionAction.cancel_run') }}
|
||||
</button>
|
||||
</template>
|
||||
<button
|
||||
v-if="(run.available_actions || []).includes('retry_failed_attachments')"
|
||||
type="button"
|
||||
class="text-xs font-medium text-secondary hover:underline"
|
||||
:disabled="actingRunNo === run.run_no"
|
||||
@click="retryRun(run)"
|
||||
>
|
||||
{{ t('chat.shippingOrderExtractionAction.retry_failed_attachments') }}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{ actingRunNo === (row as ShippingOrderExtractionRun).run_no
|
||||
? t('chat.shippingOrderExtractionCancel.submitting')
|
||||
: t('chat.shippingOrderExtractionAction.cancel_run') }}
|
||||
</ElButton>
|
||||
<ElButton
|
||||
link
|
||||
:disabled="actingRunNo === (row as ShippingOrderExtractionRun).run_no"
|
||||
@click="pendingCancelRunNo = ''; cancelReason = ''"
|
||||
>
|
||||
{{ t('chat.shippingOrderExtractionCancel.dismiss') }}
|
||||
</ElButton>
|
||||
</div>
|
||||
<ElButton
|
||||
v-else
|
||||
link
|
||||
type="danger"
|
||||
:disabled="actingRunNo === (row as ShippingOrderExtractionRun).run_no"
|
||||
@click="beginCancelRun(row as ShippingOrderExtractionRun)"
|
||||
>
|
||||
{{ t('chat.shippingOrderExtractionAction.cancel_run') }}
|
||||
</ElButton>
|
||||
</template>
|
||||
<ElButton
|
||||
v-if="((row as ShippingOrderExtractionRun).available_actions || []).includes('retry_failed_attachments')"
|
||||
link
|
||||
:disabled="actingRunNo === (row as ShippingOrderExtractionRun).run_no"
|
||||
@click="retryRun(row as ShippingOrderExtractionRun)"
|
||||
>
|
||||
{{ t('chat.shippingOrderExtractionAction.retry_failed_attachments') }}
|
||||
</ElButton>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 text-sm">
|
||||
<span class="text-xs text-muted">{{ t('workspace.shippingNotice.myRuns.total', { count: total }) }}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-default px-3 py-1.5 disabled:opacity-50"
|
||||
:disabled="page <= 1 || loading"
|
||||
@click="page -= 1; load()"
|
||||
>
|
||||
{{ t('workspace.shippingNotice.myRuns.previous') }}
|
||||
</button>
|
||||
<span>{{ page }}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-default px-3 py-1.5 disabled:opacity-50"
|
||||
:disabled="page * pageSize >= total || loading"
|
||||
@click="page += 1; load()"
|
||||
>
|
||||
{{ t('workspace.shippingNotice.myRuns.next') }}
|
||||
</button>
|
||||
<div class="flex items-center justify-end gap-3">
|
||||
<ElText type="info" size="small">{{ t('workspace.shippingNotice.myRuns.total', { count: total }) }}</ElText>
|
||||
<ElPagination
|
||||
:current-page="page"
|
||||
:page-size="pageSize"
|
||||
:total="total"
|
||||
layout="prev, pager, next"
|
||||
background
|
||||
:disabled="loading"
|
||||
@current-change="onPageChange"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.run-status-select {
|
||||
width: 12rem;
|
||||
}
|
||||
</style>
|
||||
@@ -1,11 +1,12 @@
|
||||
<!--
|
||||
features/workspace/shipping-task-center/ShippingStageTabs.vue
|
||||
用途:阶段筛选 tab(全部 + 四个可动作阶段),计数来自后端全量聚合。
|
||||
依赖:shippingTaskCenterShared 的 ACTIONABLE_TODO_STAGES 口径。
|
||||
逻辑:点击切换筛选并向上同步;「通知完成」不再作为筛选维度(归 done 桶终态子视图)。
|
||||
依赖:shippingTaskCenterShared 的 ACTIONABLE_TODO_STAGES 口径、element-plus。
|
||||
逻辑:点击切换筛选并向上同步;「通知完成」不再作为筛选维度(归 done 桶终态子视图)。样式由任务中心页引入。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElButton } from 'element-plus';
|
||||
import { ACTIONABLE_TODO_STAGES, type LifecycleStageCode } from './shippingTaskCenterShared';
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -20,10 +21,18 @@ const emit = defineEmits<{
|
||||
(event: 'update:modelValue', value: 'all' | LifecycleStageCode): void;
|
||||
}>();
|
||||
|
||||
/**
|
||||
* 读取某一阶段的后端聚合计数。
|
||||
* @param stage - 可动作阶段码
|
||||
*/
|
||||
function countOf(stage: LifecycleStageCode): number {
|
||||
return Number(props.counts?.[stage] ?? 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 阶段按钮文案。
|
||||
* @param stage - 可动作阶段码
|
||||
*/
|
||||
function stageLabel(stage: LifecycleStageCode): string {
|
||||
return t(`workspace.shippingNotice.myTodos.lifecycleStages.${stage}`);
|
||||
}
|
||||
@@ -34,30 +43,24 @@ function stageLabel(stage: LifecycleStageCode): string {
|
||||
class="flex flex-wrap gap-2"
|
||||
data-testid="my-todos-lifecycle-stage-filter"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full px-3.5 py-1.5 text-sm font-medium transition-colors"
|
||||
:class="modelValue === 'all'
|
||||
? 'bg-brand-600 text-white'
|
||||
: 'border border-default text-secondary hover:bg-surface-soft'"
|
||||
<ElButton
|
||||
:type="modelValue === 'all' ? 'primary' : 'default'"
|
||||
round
|
||||
data-testid="my-todos-stage-filter-all"
|
||||
@click="emit('update:modelValue', 'all')"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.myTodos.filters.all') }}
|
||||
</button>
|
||||
<button
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-for="stage in ACTIONABLE_TODO_STAGES"
|
||||
:key="stage"
|
||||
type="button"
|
||||
class="rounded-full px-3.5 py-1.5 text-sm font-medium transition-colors"
|
||||
:class="modelValue === stage
|
||||
? 'bg-brand-600 text-white'
|
||||
: 'border border-default text-secondary hover:bg-surface-soft'"
|
||||
:type="modelValue === stage ? 'primary' : 'default'"
|
||||
round
|
||||
:data-testid="`my-todos-stage-filter-${stage}`"
|
||||
@click="emit('update:modelValue', stage)"
|
||||
>
|
||||
{{ stageLabel(stage) }}
|
||||
<span class="ml-1 font-mono text-xs opacity-80">{{ countOf(stage) }}</span>
|
||||
</button>
|
||||
<span>{{ countOf(stage) }}</span>
|
||||
</ElButton>
|
||||
</div>
|
||||
</template>
|
||||
+9
-2
@@ -219,8 +219,15 @@ describe('ShippingTaskCenterPage notice batch operations', () => {
|
||||
});
|
||||
const wrapper = await mountPage();
|
||||
await flushPromises();
|
||||
await wrapper.get('[aria-label="WYC26082301"]').setValue(true);
|
||||
await wrapper.get('[aria-label="WYC26082302"]').setValue(true);
|
||||
await flushPromises();
|
||||
// ElCheckbox 把 aria-label 放在外层 label,勾选状态写在内部 input。
|
||||
const checkNotice = async (businessNo: string) => {
|
||||
const host = wrapper.get(`[aria-label="${businessNo}"]`);
|
||||
const input = host.find('input');
|
||||
await (input.exists() ? input : host).setValue(true);
|
||||
};
|
||||
await checkNotice('WYC26082301');
|
||||
await checkNotice('WYC26082302');
|
||||
|
||||
// 断言:勾选后浮出操作条,三个动作按序对应 download/confirm/rpa。
|
||||
// 每次 action 后列表会静默重载(表格重挂载),因此逐次重新查询按钮。
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
features/workspace/shipping-task-center/ShippingTaskCenterPage.vue
|
||||
用途:发货「任务中心」壳——Pending|Processing|Done + 识别 Run 续办表。
|
||||
依赖:shipping-tasks.api(my-todos / done-lines / count)、shipping.api(详情/STP retry/批量)、
|
||||
ShippingStageTabs / ShippingTaskTable / ShippingTaskDrawer / ShippingDoneLineReport、
|
||||
element-plus、ShippingStageTabs / ShippingTaskTable / ShippingTaskDrawer / ShippingDoneLineReport、
|
||||
shippingTaskCenterShared、useShippingTodoBadge、useMessage。
|
||||
逻辑:列表优先 + 按需抽屉——紧凑表格行点开右侧抽屉(分诊决策面板),移除常驻详情面板;
|
||||
阶段筛选 tab 消费后端全量聚合计数(stage_counts);批量操作仅货代上传阶段可选、
|
||||
@@ -13,7 +13,11 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { RefreshCw } from 'lucide-vue-next';
|
||||
import { Refresh } from '@element-plus/icons-vue';
|
||||
import { ElButton, ElInput, ElOption, ElPagination, ElSelect } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/shared/styles/element-theme.css';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
getWorkspaceShippingTask,
|
||||
@@ -57,6 +61,7 @@ import { downloadWorkspaceShippingNoticeExportArchive } from '@/features/chat/sh
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
const bucketKeys = ['pending', 'processing', 'done'] as const;
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
@@ -326,6 +331,15 @@ function applyFilters() {
|
||||
void loadTodos(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换待办列表页并重新拉取当前桶。
|
||||
* @param page - Element 分页条给出的 1-based 页码
|
||||
*/
|
||||
function onTaskPageChange(page: number) {
|
||||
currentPage.value = page;
|
||||
void loadTodos();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空筛选并重载。
|
||||
*/
|
||||
@@ -702,79 +716,56 @@ onBeforeUnmount(() => {
|
||||
<h2 class="text-2xl font-bold text-primary">{{ $t('workspace.shippingNotice.myTodos.title') }}</h2>
|
||||
<p class="text-sm text-muted">{{ $t('workspace.shippingNotice.myTodos.subtitle') }}</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1.5 rounded-xl border border-default px-3 py-1.5 text-sm font-medium text-secondary hover:bg-surface-soft"
|
||||
@click="refreshAll()"
|
||||
>
|
||||
<RefreshCw class="h-3.5 w-3.5" />
|
||||
<ElButton :icon="Refresh" @click="refreshAll()">
|
||||
{{ $t('workspace.shippingNotice.refresh') }}
|
||||
</button>
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl px-3 py-1.5 text-sm font-medium"
|
||||
:class="surface === 'todos' ? 'bg-brand-600 text-white' : 'border border-default text-secondary hover:bg-surface-soft'"
|
||||
@click="surface = 'todos'"
|
||||
>
|
||||
<ElButton :type="surface === 'todos' ? 'primary' : 'default'" @click="surface = 'todos'">
|
||||
{{ $t('workspace.shippingNotice.myTodos.title') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl px-3 py-1.5 text-sm font-medium"
|
||||
:class="surface === 'runs' ? 'bg-brand-600 text-white' : 'border border-default text-secondary hover:bg-surface-soft'"
|
||||
@click="surface = 'runs'"
|
||||
>
|
||||
</ElButton>
|
||||
<ElButton :type="surface === 'runs' ? 'primary' : 'default'" @click="surface = 'runs'">
|
||||
{{ $t('workspace.shippingNotice.myRuns.title') }}
|
||||
</button>
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
<ShippingRunProgressTable v-if="surface === 'runs'" />
|
||||
|
||||
<template v-else>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button
|
||||
v-for="key in (['pending', 'processing', 'done'] as const)"
|
||||
<ElButton
|
||||
v-for="key in bucketKeys"
|
||||
:key="key"
|
||||
type="button"
|
||||
class="rounded-xl px-3 py-1.5 text-sm font-medium"
|
||||
:class="bucket === key ? 'bg-brand-600 text-white' : 'border border-default text-secondary hover:bg-surface-soft'"
|
||||
:type="bucket === key ? 'primary' : 'default'"
|
||||
:data-testid="`my-todos-bucket-${key}`"
|
||||
@click="bucket = key"
|
||||
>
|
||||
{{ $t(`workspace.shippingNotice.myTodos.buckets.${key}`) }}
|
||||
<span class="ml-1 opacity-80">({{ bucketCounts[key] }})</span>
|
||||
</button>
|
||||
<span>({{ bucketCounts[key] }})</span>
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
<template v-if="bucket === 'done'">
|
||||
<div class="flex flex-wrap gap-2" data-testid="my-todos-done-subtabs">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full px-3.5 py-1.5 text-sm font-medium"
|
||||
:class="doneSubTab === 'upload_complete'
|
||||
? 'bg-brand-600 text-white'
|
||||
: 'border border-default text-secondary hover:bg-surface-soft'"
|
||||
<ElButton
|
||||
round
|
||||
:type="doneSubTab === 'upload_complete' ? 'primary' : 'default'"
|
||||
data-testid="my-todos-done-subtab-upload-complete"
|
||||
@click="doneSubTab = 'upload_complete'"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.myTodos.subTabs.uploadComplete') }}
|
||||
<span class="ml-1 font-mono text-xs opacity-80">{{ bucketCounts.done_counts?.upload_complete ?? 0 }}</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full px-3.5 py-1.5 text-sm font-medium"
|
||||
:class="doneSubTab === 'reject_void'
|
||||
? 'bg-brand-600 text-white'
|
||||
: 'border border-default text-secondary hover:bg-surface-soft'"
|
||||
<span>{{ bucketCounts.done_counts?.upload_complete ?? 0 }}</span>
|
||||
</ElButton>
|
||||
<ElButton
|
||||
round
|
||||
:type="doneSubTab === 'reject_void' ? 'primary' : 'default'"
|
||||
data-testid="my-todos-done-subtab-reject-void"
|
||||
@click="doneSubTab = 'reject_void'"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.myTodos.subTabs.rejectVoid') }}
|
||||
<span class="ml-1 font-mono text-xs opacity-80">{{ bucketCounts.done_counts?.reject_void ?? 0 }}</span>
|
||||
</button>
|
||||
<span>{{ bucketCounts.done_counts?.reject_void ?? 0 }}</span>
|
||||
</ElButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -788,53 +779,41 @@ onBeforeUnmount(() => {
|
||||
v-if="bucket !== 'done' || doneSubTab === 'reject_void'"
|
||||
class="flex flex-wrap items-end gap-3 rounded-2xl border border-default bg-surface px-4 py-3"
|
||||
>
|
||||
<label v-if="bucket === 'pending'" class="space-y-1">
|
||||
<span class="text-xs font-medium text-muted">{{ $t('workspace.shippingNotice.myTodos.filters.todoCategory') }}</span>
|
||||
<select v-model="filterTodoCategory" class="input-field text-sm min-w-[9rem]">
|
||||
<option value="all">{{ $t('workspace.shippingNotice.myTodos.filters.all') }}</option>
|
||||
<option value="review">{{ $t('workspace.shippingNotice.myTodos.filters.review') }}</option>
|
||||
<option value="exception">{{ $t('workspace.shippingNotice.myTodos.filters.exception') }}</option>
|
||||
<option value="manual_upload">{{ $t('workspace.shippingNotice.myTodos.filters.manualUpload') }}</option>
|
||||
<option value="intake_parse">{{ $t('workspace.shippingNotice.myTodos.filters.intakeParse') }}</option>
|
||||
</select>
|
||||
<label v-if="bucket === 'pending'" class="task-filter">
|
||||
<span>{{ $t('workspace.shippingNotice.myTodos.filters.todoCategory') }}</span>
|
||||
<ElSelect v-model="filterTodoCategory" class="task-filter-category">
|
||||
<ElOption value="all" :label="$t('workspace.shippingNotice.myTodos.filters.all')" />
|
||||
<ElOption value="review" :label="$t('workspace.shippingNotice.myTodos.filters.review')" />
|
||||
<ElOption value="exception" :label="$t('workspace.shippingNotice.myTodos.filters.exception')" />
|
||||
<ElOption value="manual_upload" :label="$t('workspace.shippingNotice.myTodos.filters.manualUpload')" />
|
||||
<ElOption value="intake_parse" :label="$t('workspace.shippingNotice.myTodos.filters.intakeParse')" />
|
||||
</ElSelect>
|
||||
</label>
|
||||
<label class="space-y-1 flex-1 min-w-[10rem]">
|
||||
<span class="text-xs font-medium text-muted">{{ $t('workspace.shippingNotice.myTodos.filters.customer') }}</span>
|
||||
<input
|
||||
<label class="task-filter">
|
||||
<span>{{ $t('workspace.shippingNotice.myTodos.filters.customer') }}</span>
|
||||
<ElInput
|
||||
v-model="filterCustomer"
|
||||
type="text"
|
||||
class="input-field text-sm w-full"
|
||||
class="task-filter-text"
|
||||
:placeholder="$t('workspace.shippingNotice.myTodos.filters.customerPlaceholder')"
|
||||
@keyup.enter="applyFilters"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 flex-1 min-w-[10rem]">
|
||||
<span class="text-xs font-medium text-muted">{{ $t('workspace.shippingNotice.myTodos.filters.taskNo') }}</span>
|
||||
<input
|
||||
<label class="task-filter">
|
||||
<span>{{ $t('workspace.shippingNotice.myTodos.filters.taskNo') }}</span>
|
||||
<ElInput
|
||||
v-model="filterTaskNo"
|
||||
type="text"
|
||||
class="input-field text-sm w-full font-mono uppercase"
|
||||
class="task-filter-text"
|
||||
:placeholder="$t('workspace.shippingNotice.myTodos.filters.taskNoPlaceholder')"
|
||||
@keyup.enter="applyFilters"
|
||||
/>
|
||||
</label>
|
||||
<div class="flex gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl bg-brand-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-brand-700 disabled:opacity-50"
|
||||
:disabled="loading"
|
||||
@click="applyFilters"
|
||||
>
|
||||
<ElButton type="primary" :loading="loading" @click="applyFilters">
|
||||
{{ $t('workspace.shippingNotice.myTodos.filters.apply') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl border border-default px-3 py-1.5 text-sm font-medium text-secondary hover:bg-surface-soft disabled:opacity-50"
|
||||
:disabled="loading"
|
||||
@click="resetFilters"
|
||||
>
|
||||
</ElButton>
|
||||
<ElButton :disabled="loading" @click="resetFilters">
|
||||
{{ $t('workspace.shippingNotice.myTodos.filters.reset') }}
|
||||
</button>
|
||||
</ElButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -873,25 +852,16 @@ onBeforeUnmount(() => {
|
||||
@clear-selection="selectedBusinessNos = []"
|
||||
@batch="runNoticeBatchAction"
|
||||
/>
|
||||
<div v-if="totalPages > 1" class="flex items-center justify-between gap-2 text-xs text-muted">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-2 py-1 disabled:opacity-50"
|
||||
:disabled="currentPage <= 1 || loading"
|
||||
@click="currentPage -= 1; loadTodos()"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.pagination.previous') }}
|
||||
</button>
|
||||
<span>{{ currentPage }}/{{ totalPages }}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-2 py-1 disabled:opacity-50"
|
||||
:disabled="currentPage >= totalPages || loading"
|
||||
@click="currentPage += 1; loadTodos()"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.pagination.next') }}
|
||||
</button>
|
||||
</div>
|
||||
<ElPagination
|
||||
v-if="totalPages > 1"
|
||||
:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
:total="totalTasks"
|
||||
layout="prev, pager, next"
|
||||
background
|
||||
:disabled="loading"
|
||||
@current-change="onTaskPageChange"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
@@ -910,3 +880,19 @@ onBeforeUnmount(() => {
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.task-filter {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.task-filter-category {
|
||||
width: 11rem;
|
||||
}
|
||||
|
||||
.task-filter-text {
|
||||
width: 16rem;
|
||||
}
|
||||
</style>
|
||||
@@ -1,15 +1,25 @@
|
||||
<!--
|
||||
features/workspace/shipping-task-center/ShippingTaskDrawer.vue
|
||||
用途:任务详情抽屉——分诊决策面板(头部阻断 + 逐行明细 + 文件 + 底部操作)。
|
||||
依赖:shippingTaskCenterShared(阶段口径)、gateReasonLabel。
|
||||
依赖:shippingTaskCenterShared(阶段口径)、gateReasonLabel、element-plus(ElDrawer)。
|
||||
逻辑:review/intake/task 三分支迁移自原任务中心右侧入口卡,行为与深链契约不变;
|
||||
深链/重试只向上 emit,由页面统一执行;阶段目标下拉仍由后端
|
||||
ui_state.lifecycle_entries 裁决(current/available 才可进)。
|
||||
ui_state.lifecycle_entries 裁决(current/available 才可进)。样式由任务中心页引入。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, ref, watch } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Download, ExternalLink, RefreshCw, X } from 'lucide-vue-next';
|
||||
import { Close, Download, Refresh, TopRight } from '@element-plus/icons-vue';
|
||||
import {
|
||||
ElButton,
|
||||
ElDrawer,
|
||||
ElOption,
|
||||
ElSelect,
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElTag,
|
||||
ElText,
|
||||
} from 'element-plus';
|
||||
import type {
|
||||
ShippingTaskDetail,
|
||||
ShippingTaskSummary,
|
||||
@@ -46,6 +56,7 @@ const emit = defineEmits<{
|
||||
}>();
|
||||
|
||||
type EnterableStage = Exclude<LifecycleStageCode, 'intake_parse'>;
|
||||
type NoticeLine = NonNullable<ShippingTaskSummary['notice_line_summary']>[number];
|
||||
const stageTarget = ref<EnterableStage>('order_review');
|
||||
|
||||
const isReviewItem = computed(() => {
|
||||
@@ -108,7 +119,10 @@ const stageTargetOptions = computed(() => {
|
||||
}));
|
||||
});
|
||||
|
||||
/** 后端仅授权 current/available;目标不可进时主按钮禁用。 */
|
||||
/**
|
||||
* 后端仅授权 current/available;目标不可进时主按钮禁用。
|
||||
* @param stage - 抽屉里选中的阶段
|
||||
*/
|
||||
function canOpenProcessing(stage: EnterableStage | null): boolean {
|
||||
const item = props.item;
|
||||
if (!item) return false;
|
||||
@@ -148,6 +162,7 @@ const lineRows = computed(() => {
|
||||
/**
|
||||
* 数量/缺口展示值:后端 Numeric(24,8) 透出形如 "24.00000000",
|
||||
* 统一转 number 去尾零(24.00000000→24、2.50000000→2.5),缺失保持 —。
|
||||
* @param value - 数量原文
|
||||
*/
|
||||
function formatQty(value: unknown): string {
|
||||
if (value === null || value === undefined || value === '') return '—';
|
||||
@@ -155,249 +170,200 @@ function formatQty(value: unknown): string {
|
||||
return Number.isFinite(num) ? String(num) : String(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细行主键。项次加料号,避免同项次不同料号撞 key。
|
||||
* @param line - 通知单行摘要
|
||||
*/
|
||||
function noticeLineKey(line: NoticeLine): string {
|
||||
return `${line.line_no}-${line.part_number || ''}`;
|
||||
}
|
||||
|
||||
watch(() => props.item, (item) => {
|
||||
if (!item) return;
|
||||
const stage = defaultLifecycleTarget(item);
|
||||
if (stage) stageTarget.value = stage;
|
||||
}, { immediate: true });
|
||||
|
||||
function onEsc(event: KeyboardEvent) {
|
||||
if (event.key === 'Escape') emit('close');
|
||||
}
|
||||
|
||||
// Esc 关闭抽屉;打开时挂监听,关闭/卸载时移除,避免监听串扰。
|
||||
watch(() => props.open, (open) => {
|
||||
if (open) document.addEventListener('keydown', onEsc);
|
||||
else document.removeEventListener('keydown', onEsc);
|
||||
}, { immediate: true });
|
||||
|
||||
onBeforeUnmount(() => document.removeEventListener('keydown', onEsc));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="open"
|
||||
class="fixed inset-0 z-50 flex"
|
||||
data-testid="my-todos-drawer"
|
||||
>
|
||||
<div
|
||||
class="flex-1 bg-[rgba(23,32,51,0.35)]"
|
||||
data-testid="my-todos-drawer-scrim"
|
||||
@click="emit('close')"
|
||||
/>
|
||||
<aside class="flex w-[52rem] max-w-[94vw] flex-col bg-surface shadow-2xl">
|
||||
<div class="border-b border-default px-5 py-4">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<h3 class="break-all font-mono text-base font-bold text-primary" data-testid="my-todos-drawer-title">
|
||||
{{ displayNo }}
|
||||
</h3>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg bg-surface-soft px-2 py-1 text-xs text-secondary hover:bg-surface-soft/70"
|
||||
:aria-label="$t('workspace.shippingNotice.myTodos.drawer.close')"
|
||||
data-testid="my-todos-drawer-close"
|
||||
@click="emit('close')"
|
||||
>
|
||||
<X class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
<p v-if="subTitle" class="mt-1 text-xs text-muted">{{ subTitle }}</p>
|
||||
<div class="mt-2 flex flex-wrap items-center gap-2">
|
||||
<span
|
||||
v-if="stageLabel"
|
||||
class="rounded-full bg-brand-50 px-2.5 py-0.5 text-xs font-medium text-brand-800"
|
||||
data-testid="my-todos-drawer-stage"
|
||||
>
|
||||
{{ stageLabel }}
|
||||
</span>
|
||||
<span
|
||||
v-if="isReviewItem"
|
||||
class="rounded bg-amber-50 px-1.5 py-0.5 text-[10px] text-amber-700"
|
||||
>{{ $t('workspace.shippingNotice.myTodos.openReview') }}</span>
|
||||
<span
|
||||
v-else-if="isIntakeItem"
|
||||
class="rounded bg-violet-50 px-1.5 py-0.5 text-[10px] text-violet-700"
|
||||
>{{ $t('workspace.shippingNotice.myTodos.intakeParseBadge') }}</span>
|
||||
</div>
|
||||
<ElDrawer
|
||||
:model-value="open"
|
||||
append-to-body
|
||||
direction="rtl"
|
||||
size="832px"
|
||||
:with-header="false"
|
||||
:close-on-click-modal="true"
|
||||
@close="emit('close')"
|
||||
>
|
||||
<div data-testid="my-todos-drawer">
|
||||
<div>
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<h3 class="break-all" data-testid="my-todos-drawer-title">{{ displayNo }}</h3>
|
||||
<ElButton
|
||||
:icon="Close"
|
||||
:aria-label="t('workspace.shippingNotice.myTodos.drawer.close')"
|
||||
data-testid="my-todos-drawer-close"
|
||||
@click="emit('close')"
|
||||
/>
|
||||
</div>
|
||||
<ElText v-if="subTitle" type="info" size="small">{{ subTitle }}</ElText>
|
||||
<div class="mt-2 flex flex-wrap items-center gap-2">
|
||||
<ElTag v-if="stageLabel" effect="light" data-testid="my-todos-drawer-stage">{{ stageLabel }}</ElTag>
|
||||
<ElTag v-if="isReviewItem" type="warning" effect="light">{{ t('workspace.shippingNotice.myTodos.openReview') }}</ElTag>
|
||||
<ElTag v-else-if="isIntakeItem" type="info" effect="light">{{ t('workspace.shippingNotice.myTodos.intakeParseBadge') }}</ElTag>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 overflow-y-auto px-5 py-4">
|
||||
<div v-if="loading" class="py-16 text-center text-sm text-muted">
|
||||
{{ $t('workspace.shippingNotice.loading') }}
|
||||
</div>
|
||||
<template v-else-if="item">
|
||||
<div
|
||||
v-if="blocker"
|
||||
class="mb-4 rounded-xl border border-red-200 bg-red-50 px-3.5 py-2.5 text-[13px] text-red-700"
|
||||
data-testid="my-todos-progress-blocker"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.myTodos.progressBlocker', { reason: blocker }) }}
|
||||
<div>
|
||||
<div v-if="loading">{{ t('workspace.shippingNotice.loading') }}</div>
|
||||
<template v-else-if="item">
|
||||
<ElText v-if="blocker" type="danger" data-testid="my-todos-progress-blocker">
|
||||
{{ t('workspace.shippingNotice.myTodos.progressBlocker', { reason: blocker }) }}
|
||||
</ElText>
|
||||
<p v-if="stageLabel" data-testid="my-todos-progress-summary">
|
||||
{{ t('workspace.shippingNotice.myTodos.progressSummary', { stage: stageLabel }) }}
|
||||
</p>
|
||||
<p v-if="summaryMessage">{{ summaryMessage }}</p>
|
||||
|
||||
<template v-if="lineRows.length">
|
||||
<h4>{{ t('workspace.shippingNotice.myTodos.drawer.details') }}</h4>
|
||||
<div data-testid="my-todos-drawer-lines">
|
||||
<ElTable :data="lineRows" :row-key="noticeLineKey">
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myTodos.drawer.lineTable.lineNo')" min-width="72">
|
||||
<template #default="{ row }">{{ (row as NoticeLine).line_no }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myTodos.drawer.lineTable.partNumber')" min-width="120">
|
||||
<template #default="{ row }">{{ (row as NoticeLine).part_number || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myTodos.drawer.lineTable.customerPartNumber')" min-width="120">
|
||||
<template #default="{ row }">{{ (row as NoticeLine).customer_part_number || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myTodos.drawer.lineTable.reservationId')" min-width="120">
|
||||
<template #default="{ row }">{{ (row as NoticeLine).reservation_id || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myTodos.drawer.lineTable.shipmentQty')" min-width="100">
|
||||
<template #default="{ row }">{{ formatQty((row as NoticeLine).shipment_qty) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myTodos.drawer.lineTable.availableQty')" min-width="100">
|
||||
<template #default="{ row }">{{ formatQty((row as NoticeLine).available_qty) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myTodos.drawer.lineTable.shortageQty')" min-width="80">
|
||||
<template #default="{ row }">
|
||||
<ElText :type="Number((row as NoticeLine).shortage_qty || 0) > 0 ? 'danger' : 'info'">
|
||||
{{ formatQty((row as NoticeLine).shortage_qty) }}
|
||||
</ElText>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myTodos.drawer.lineTable.status')" min-width="100">
|
||||
<template #default="{ row }">{{ (row as NoticeLine).inventory_status || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
<p
|
||||
v-if="stageLabel"
|
||||
class="mb-2 text-sm font-medium text-primary"
|
||||
data-testid="my-todos-progress-summary"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.myTodos.progressSummary', { stage: stageLabel }) }}
|
||||
</p>
|
||||
<p v-if="summaryMessage" class="text-sm text-secondary">{{ summaryMessage }}</p>
|
||||
|
||||
<template v-if="lineRows.length">
|
||||
<h4 class="mb-2 mt-5 text-[13px] font-bold text-primary">
|
||||
{{ $t('workspace.shippingNotice.myTodos.drawer.details') }}
|
||||
</h4>
|
||||
<div class="overflow-x-auto rounded-xl border border-default">
|
||||
<table class="w-full border-collapse text-xs" data-testid="my-todos-drawer-lines">
|
||||
<thead>
|
||||
<tr class="border-b border-default bg-surface-soft/60 text-left text-muted">
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.lineNo') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.partNumber') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.customerPartNumber') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.reservationId') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.shipmentQty') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.availableQty') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.shortageQty') }}</th>
|
||||
<th class="whitespace-nowrap px-2.5 py-2 font-medium">{{ $t('workspace.shippingNotice.myTodos.drawer.lineTable.status') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="line in lineRows"
|
||||
:key="`${line.line_no}-${line.part_number}`"
|
||||
class="border-b border-[#f0f3f8]"
|
||||
>
|
||||
<td class="px-2.5 py-2 font-mono">{{ line.line_no }}</td>
|
||||
<td class="whitespace-nowrap px-2.5 py-2 font-mono">{{ line.part_number || '—' }}</td>
|
||||
<td class="whitespace-nowrap px-2.5 py-2">{{ line.customer_part_number || '—' }}</td>
|
||||
<td class="whitespace-nowrap px-2.5 py-2 font-mono">{{ line.reservation_id || '—' }}</td>
|
||||
<td class="whitespace-nowrap px-2.5 py-2 tabular-nums">{{ formatQty(line.shipment_qty) }}</td>
|
||||
<td class="whitespace-nowrap px-2.5 py-2 tabular-nums">{{ formatQty(line.available_qty) }}</td>
|
||||
<td
|
||||
class="whitespace-nowrap px-2.5 py-2 tabular-nums"
|
||||
:class="Number(line.shortage_qty || 0) > 0 ? 'font-bold text-red-600' : ''"
|
||||
>
|
||||
{{ formatQty(line.shortage_qty) }}
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-2.5 py-2">{{ line.inventory_status || '—' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-if="exportFileName">
|
||||
<h4 class="mb-2 mt-5 text-[13px] font-bold text-primary">
|
||||
{{ $t('workspace.shippingNotice.myTodos.drawer.files') }}
|
||||
</h4>
|
||||
<div class="rounded-xl border border-default px-3 py-2 text-[13px] text-secondary">
|
||||
<span class="mr-2 rounded bg-brand-50 px-1.5 py-0.5 text-[10px] text-brand-800">Excel</span>
|
||||
{{ exportFileName }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<p class="mt-5 text-xs text-muted">
|
||||
{{ $t('workspace.shippingNotice.myTodos.openProcessingHint') }}
|
||||
</p>
|
||||
</template>
|
||||
<div v-else class="py-16 text-center text-sm text-muted">
|
||||
{{ $t('workspace.shippingNotice.selectCase') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="item && !loading" class="space-y-2.5 border-t border-default px-5 py-4">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<label class="sr-only" for="drawer-stage-target">{{ $t('workspace.shippingNotice.myTodos.lifecycleStages.viewStage') }}</label>
|
||||
<select
|
||||
v-if="stageTargetOptions.length"
|
||||
id="drawer-stage-target"
|
||||
v-model="stageTarget"
|
||||
class="input-field max-w-40 text-sm"
|
||||
data-testid="my-todos-lifecycle-stage-target"
|
||||
>
|
||||
<option
|
||||
v-for="option in stageTargetOptions"
|
||||
:key="option.code"
|
||||
:value="option.code"
|
||||
:disabled="option.disabled"
|
||||
>
|
||||
{{ $t(`workspace.shippingNotice.myTodos.lifecycleStages.${option.code}`) }}
|
||||
</option>
|
||||
</select>
|
||||
<button
|
||||
v-if="canOpenIntake"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1.5 rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white hover:bg-brand-700 disabled:opacity-50"
|
||||
data-testid="my-todos-open-intake-parse"
|
||||
@click="emit('open-intake', item)"
|
||||
>
|
||||
<ExternalLink class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.shippingNotice.myTodos.openIntakeParse') }}
|
||||
</button>
|
||||
<button
|
||||
v-else-if="!isIntakeItem"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1.5 rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white hover:bg-brand-700 disabled:opacity-50"
|
||||
:disabled="!canOpenProcessing(stageTarget)"
|
||||
data-testid="my-todos-open-order-processing"
|
||||
@click="emit('open-processing', item, stageTarget)"
|
||||
>
|
||||
<ExternalLink class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.shippingNotice.myTodos.openLifecycleWorkbench') }}
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1.5 rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white hover:bg-brand-700 disabled:opacity-50"
|
||||
:disabled="!(item.owner_agent_id || chatAgentId)"
|
||||
data-testid="my-todos-open-intake-conversation"
|
||||
@click="emit('open-chat', item)"
|
||||
>
|
||||
<ExternalLink class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.shippingNotice.myTodos.openConversation') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="chatAgentId && !isIntakeItem"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-xl border border-default px-3 py-1.5 text-xs font-medium text-secondary hover:bg-surface-soft"
|
||||
@click="emit('open-chat', item)"
|
||||
>
|
||||
<ExternalLink class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.shippingNotice.openChat') }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<button
|
||||
v-if="canRetryStp"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1.5 rounded-xl border border-amber-400 bg-amber-50 px-4 py-2 text-sm font-medium text-amber-950 hover:bg-amber-100 disabled:opacity-50 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-100"
|
||||
:disabled="stpRetrying"
|
||||
data-testid="my-todos-retry-stp-auto-create"
|
||||
@click="emit('retry-stp', item)"
|
||||
>
|
||||
<RefreshCw class="h-3.5 w-3.5" />
|
||||
{{ $t('chat.shippingOrderReview.autoProgress.retryStp') }}
|
||||
</button>
|
||||
<a
|
||||
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"
|
||||
rel="noopener"
|
||||
>
|
||||
<Download class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.shippingNotice.myTodos.drawer.exportExcel') }}
|
||||
</a>
|
||||
<p
|
||||
v-if="!canOpenIntake && !canOpenProcessing(stageTarget) && !isIntakeItem"
|
||||
class="text-xs text-amber-700 dark:text-amber-300"
|
||||
data-testid="my-todos-open-processing-unavailable"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.myTodos.openProcessingUnavailable') }}
|
||||
</p>
|
||||
</div>
|
||||
<template v-if="exportFileName">
|
||||
<h4>{{ t('workspace.shippingNotice.myTodos.drawer.files') }}</h4>
|
||||
<div>
|
||||
<ElTag effect="light">Excel</ElTag>
|
||||
{{ exportFileName }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<ElText type="info" size="small">{{ t('workspace.shippingNotice.myTodos.openProcessingHint') }}</ElText>
|
||||
</template>
|
||||
<div v-else>{{ t('workspace.shippingNotice.selectCase') }}</div>
|
||||
</div>
|
||||
|
||||
<div v-if="item && !loading">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<ElSelect
|
||||
v-if="stageTargetOptions.length"
|
||||
v-model="stageTarget"
|
||||
class="drawer-stage-select"
|
||||
:aria-label="t('workspace.shippingNotice.myTodos.lifecycleStages.viewStage')"
|
||||
data-testid="my-todos-lifecycle-stage-target"
|
||||
>
|
||||
<ElOption
|
||||
v-for="option in stageTargetOptions"
|
||||
:key="option.code"
|
||||
:value="option.code"
|
||||
:label="t(`workspace.shippingNotice.myTodos.lifecycleStages.${option.code}`)"
|
||||
:disabled="option.disabled"
|
||||
/>
|
||||
</ElSelect>
|
||||
<ElButton
|
||||
v-if="canOpenIntake"
|
||||
type="primary"
|
||||
:icon="TopRight"
|
||||
data-testid="my-todos-open-intake-parse"
|
||||
@click="emit('open-intake', item)"
|
||||
>
|
||||
{{ t('workspace.shippingNotice.myTodos.openIntakeParse') }}
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-else-if="!isIntakeItem"
|
||||
type="primary"
|
||||
:icon="TopRight"
|
||||
:disabled="!canOpenProcessing(stageTarget)"
|
||||
data-testid="my-todos-open-order-processing"
|
||||
@click="emit('open-processing', item, stageTarget)"
|
||||
>
|
||||
{{ t('workspace.shippingNotice.myTodos.openLifecycleWorkbench') }}
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-else
|
||||
type="primary"
|
||||
:icon="TopRight"
|
||||
:disabled="!(item.owner_agent_id || chatAgentId)"
|
||||
data-testid="my-todos-open-intake-conversation"
|
||||
@click="emit('open-chat', item)"
|
||||
>
|
||||
{{ t('workspace.shippingNotice.myTodos.openConversation') }}
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-if="chatAgentId && !isIntakeItem"
|
||||
:icon="TopRight"
|
||||
@click="emit('open-chat', item)"
|
||||
>
|
||||
{{ t('workspace.shippingNotice.openChat') }}
|
||||
</ElButton>
|
||||
</div>
|
||||
</aside>
|
||||
<div class="mt-2 flex flex-wrap items-center gap-3">
|
||||
<ElButton
|
||||
v-if="canRetryStp"
|
||||
:icon="Refresh"
|
||||
:loading="stpRetrying"
|
||||
data-testid="my-todos-retry-stp-auto-create"
|
||||
@click="emit('retry-stp', item)"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.autoProgress.retryStp') }}
|
||||
</ElButton>
|
||||
<a
|
||||
v-if="exportFileName && canDownloadExport"
|
||||
class="inline-flex items-center gap-1"
|
||||
:href="`/api/workspace/shipping-notices/${encodeURIComponent(String(item.business_no || ''))}/export`"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>
|
||||
<Download class="h-3.5 w-3.5" />
|
||||
{{ t('workspace.shippingNotice.myTodos.drawer.exportExcel') }}
|
||||
</a>
|
||||
<ElText
|
||||
v-if="!canOpenIntake && !canOpenProcessing(stageTarget) && !isIntakeItem"
|
||||
type="warning"
|
||||
size="small"
|
||||
data-testid="my-todos-open-processing-unavailable"
|
||||
>
|
||||
{{ t('workspace.shippingNotice.myTodos.openProcessingUnavailable') }}
|
||||
</ElText>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</ElDrawer>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.drawer-stage-select {
|
||||
width: 11rem;
|
||||
}
|
||||
</style>
|
||||
@@ -1,14 +1,15 @@
|
||||
<!--
|
||||
features/workspace/shipping-task-center/ShippingTaskTable.vue
|
||||
用途:任务中心紧凑表格(一行一待办):编号/阶段/状态摘要/项次缺口/货代状态。
|
||||
依赖:shippingTaskCenterShared(编号、阶段、批量可选口径)。
|
||||
依赖:shippingTaskCenterShared(编号、阶段、批量可选口径)、element-plus。
|
||||
逻辑:行点击向上冒泡选中;复选框仅「货代上传」阶段的正式 Notice 行存在;
|
||||
勾选 ≥1 后浮出深色批量操作条(低频操作不常驻);分页由父级渲染。
|
||||
勾选 ≥1 后浮出批量操作条(低频操作不常驻);分页由父级渲染。样式由任务中心页引入。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { CheckSquare, Download, Upload, X } from 'lucide-vue-next';
|
||||
import { Close, Download, Select, Upload } from '@element-plus/icons-vue';
|
||||
import { ElButton, ElCheckbox, ElTable, ElTableColumn, ElTag, ElText } from 'element-plus';
|
||||
import type { ShippingTaskSummary } from '@/features/chat/api/shipping.api';
|
||||
import {
|
||||
isBatchDownloadableRow,
|
||||
@@ -54,7 +55,10 @@ const allSelectableChecked = computed(() => (
|
||||
&& selectableRows.value.every((item) => selectedSet.value.has(String(item.business_no)))
|
||||
));
|
||||
|
||||
/** 阶段徽章文案:优先本地化阶段名,后端 label 兜底。 */
|
||||
/**
|
||||
* 阶段徽章文案:优先本地化阶段名,后端 label 兜底。
|
||||
* @param item - 待办行
|
||||
*/
|
||||
function stageLabel(item: ShippingTaskSummary): string {
|
||||
const code = lifecycleStageCodeOf(item);
|
||||
const key = code ? `workspace.shippingNotice.myTodos.lifecycleStages.${code}` : '';
|
||||
@@ -62,180 +66,164 @@ function stageLabel(item: ShippingTaskSummary): string {
|
||||
return String(item.ui_state?.stage?.label || '—');
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态摘要主文案。
|
||||
* @param item - 待办行
|
||||
*/
|
||||
function rowTitle(item: ShippingTaskSummary): string {
|
||||
return todoTitleText(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* 阻断原因。空字符串表示当前行没有阻断。
|
||||
* @param item - 待办行
|
||||
*/
|
||||
function rowBlocker(item: ShippingTaskSummary): string {
|
||||
return todoBlockerText(item, t, te);
|
||||
}
|
||||
|
||||
/**
|
||||
* 项次数量短句。没有行时显示占位。
|
||||
* @param item - 待办行
|
||||
*/
|
||||
function lineBriefText(item: ShippingTaskSummary): string {
|
||||
const brief = todoLineBrief(item);
|
||||
if (!brief.total) return '—';
|
||||
return `${brief.total} ${t('workspace.shippingNotice.myTodos.table.lineUnit')}`;
|
||||
}
|
||||
|
||||
/** 全选或取消当前页可批量行。 */
|
||||
function onToggleAll(): void {
|
||||
emit('toggle-all');
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击表格行打开抽屉。复选框点击已 stop,不会进到这里。
|
||||
* @param row - 当前待办
|
||||
*/
|
||||
function onRowClick(row: ShippingTaskSummary): void {
|
||||
emit('select', row);
|
||||
}
|
||||
|
||||
/**
|
||||
* 行角标:复核、解析、只读或终态。没有角标时返回空。
|
||||
* @param item - 待办行
|
||||
*/
|
||||
function badgeOf(item: ShippingTaskSummary): { type: 'warning' | 'info' | 'success' | 'danger'; label: string } | null {
|
||||
if (item.todo_category === 'review' || item.item_kind === 'review_case') {
|
||||
return { type: 'warning', label: t('workspace.shippingNotice.myTodos.openReview') };
|
||||
}
|
||||
if (item.todo_category === 'intake_parse' || item.item_kind === 'order_intake') {
|
||||
return { type: 'info', label: t('workspace.shippingNotice.myTodos.intakeParseBadge') };
|
||||
}
|
||||
if (item.can_handle === false) {
|
||||
return { type: 'info', label: t('workspace.shippingNotice.todo.adminViewOnlyShort') };
|
||||
}
|
||||
if (props.terminalBadge === 'upload_complete') {
|
||||
return { type: 'success', label: t('workspace.shippingNotice.myTodos.terminal.uploadComplete') };
|
||||
}
|
||||
if (props.terminalBadge === 'reject_void') {
|
||||
return { type: 'danger', label: t('workspace.shippingNotice.myTodos.terminal.rejectVoid') };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="overflow-hidden rounded-2xl border border-default bg-surface">
|
||||
<div
|
||||
v-if="hasSelection"
|
||||
class="flex flex-wrap items-center gap-2 bg-[#1b2740] px-4 py-2.5 text-sm text-slate-100"
|
||||
class="flex flex-wrap items-center gap-2 bg-[#1b2740] px-4 py-2.5"
|
||||
data-testid="shipping-notice-batch-toolbar"
|
||||
>
|
||||
<span class="rounded-full bg-brand-600 px-3 py-0.5 text-xs font-semibold">
|
||||
<ElTag type="primary" effect="dark">
|
||||
{{ $t('workspace.shippingNotice.batch.selected', { count: selectedBusinessNos?.length || 0 }) }}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-white/20 px-2.5 py-1 text-xs hover:bg-white/10 disabled:opacity-50"
|
||||
:disabled="Boolean(batchBusy)"
|
||||
@click="emit('batch', 'download')"
|
||||
>
|
||||
<Download class="mr-1 inline h-3.5 w-3.5" />
|
||||
</ElTag>
|
||||
<ElButton :icon="Download" :disabled="Boolean(batchBusy)" @click="emit('batch', 'download')">
|
||||
{{ $t('workspace.shippingNotice.batch.download') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-white/20 px-2.5 py-1 text-xs hover:bg-white/10 disabled:opacity-50"
|
||||
:disabled="Boolean(batchBusy)"
|
||||
@click="emit('batch', 'confirm')"
|
||||
>
|
||||
<CheckSquare class="mr-1 inline h-3.5 w-3.5" />
|
||||
</ElButton>
|
||||
<ElButton :icon="Select" :disabled="Boolean(batchBusy)" @click="emit('batch', 'confirm')">
|
||||
{{ $t('workspace.shippingNotice.batch.confirm') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-white/20 px-2.5 py-1 text-xs hover:bg-white/10 disabled:opacity-50"
|
||||
:disabled="Boolean(batchBusy)"
|
||||
@click="emit('batch', 'rpa')"
|
||||
>
|
||||
<Upload class="mr-1 inline h-3.5 w-3.5" />
|
||||
</ElButton>
|
||||
<ElButton :icon="Upload" :disabled="Boolean(batchBusy)" @click="emit('batch', 'rpa')">
|
||||
{{ $t('workspace.shippingNotice.batch.rpa') }}
|
||||
</button>
|
||||
</ElButton>
|
||||
<span class="flex-1" />
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg px-2.5 py-1 text-xs text-slate-300 hover:text-white"
|
||||
@click="emit('clear-selection')"
|
||||
>
|
||||
<X class="mr-1 inline h-3.5 w-3.5" />
|
||||
<ElButton :icon="Close" @click="emit('clear-selection')">
|
||||
{{ $t('workspace.shippingNotice.batch.clearSelection') }}
|
||||
</button>
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full border-collapse text-sm">
|
||||
<thead>
|
||||
<tr class="border-b border-default bg-surface-soft/60 text-left text-xs text-muted">
|
||||
<th v-if="selectable" class="w-10 px-3 py-2.5">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="allSelectableChecked"
|
||||
:aria-label="$t('workspace.shippingNotice.batch.selectAll')"
|
||||
@change="onToggleAll"
|
||||
>
|
||||
</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.table.no') }}</th>
|
||||
<th class="w-24 px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.table.stage') }}</th>
|
||||
<th class="px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.table.summary') }}</th>
|
||||
<th class="w-28 px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.table.lines') }}</th>
|
||||
<th class="w-24 px-3 py-2.5 font-medium">{{ $t('workspace.shippingNotice.myTodos.table.freightStatus') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="item in items"
|
||||
:key="todoItemKey(item)"
|
||||
class="cursor-pointer border-b border-[#f0f3f8] transition-colors hover:bg-brand-50/40"
|
||||
:class="selectedKey === todoItemKey(item) ? 'bg-brand-50/70 dark:bg-brand-950/30' : ''"
|
||||
:data-testid="`my-todos-row-${todoDisplayNo(item)}`"
|
||||
@click="emit('select', item)"
|
||||
<ElTable
|
||||
:data="items"
|
||||
:row-key="todoItemKey"
|
||||
:current-row-key="selectedKey || undefined"
|
||||
highlight-current-row
|
||||
@row-click="onRowClick"
|
||||
>
|
||||
<ElTableColumn v-if="selectable" width="64">
|
||||
<template #header>
|
||||
<ElCheckbox
|
||||
:model-value="allSelectableChecked"
|
||||
:aria-label="t('workspace.shippingNotice.batch.selectAll')"
|
||||
@change="onToggleAll"
|
||||
/>
|
||||
</template>
|
||||
<template #default="{ row }">
|
||||
<span v-if="isBatchDownloadableRow(row as ShippingTaskSummary)" @click.stop>
|
||||
<ElCheckbox
|
||||
:model-value="selectedSet.has(String((row as ShippingTaskSummary).business_no))"
|
||||
:aria-label="String((row as ShippingTaskSummary).business_no)"
|
||||
@change="emit('toggle', row as ShippingTaskSummary)"
|
||||
/>
|
||||
</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myTodos.table.no')" min-width="220">
|
||||
<template #default="{ row }">
|
||||
<div :data-testid="`my-todos-row-${todoDisplayNo(row as ShippingTaskSummary)}`">
|
||||
<span>{{ todoDisplayNo(row as ShippingTaskSummary) }}</span>
|
||||
<ElTag v-if="badgeOf(row as ShippingTaskSummary)" :type="badgeOf(row as ShippingTaskSummary)?.type" effect="light">
|
||||
{{ badgeOf(row as ShippingTaskSummary)?.label }}
|
||||
</ElTag>
|
||||
</div>
|
||||
<ElText type="info" size="small">{{ todoSubTitleText(row as ShippingTaskSummary) || '—' }}</ElText>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myTodos.table.stage')" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<ElTag effect="light">{{ stageLabel(row as ShippingTaskSummary) }}</ElTag>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myTodos.table.summary')" min-width="180">
|
||||
<template #default="{ row }">
|
||||
<div>{{ rowTitle(row as ShippingTaskSummary) }}</div>
|
||||
<ElText
|
||||
v-if="rowBlocker(row as ShippingTaskSummary)"
|
||||
type="danger"
|
||||
size="small"
|
||||
data-testid="my-todos-row-blocker"
|
||||
>
|
||||
<td v-if="selectable" class="px-3 py-2.5 align-middle">
|
||||
<input
|
||||
v-if="isBatchDownloadableRow(item)"
|
||||
type="checkbox"
|
||||
:checked="selectedSet.has(String(item.business_no))"
|
||||
:aria-label="String(item.business_no)"
|
||||
@click.stop
|
||||
@change="emit('toggle', item)"
|
||||
>
|
||||
</td>
|
||||
<td class="max-w-[22rem] px-3 py-2.5 align-middle">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="truncate font-mono text-[13px] font-semibold text-primary">{{ todoDisplayNo(item) }}</span>
|
||||
<span
|
||||
v-if="item.todo_category === 'review' || item.item_kind === 'review_case'"
|
||||
class="shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[10px] text-amber-700"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.myTodos.openReview') }}
|
||||
</span>
|
||||
<span
|
||||
v-else-if="item.todo_category === 'intake_parse' || item.item_kind === 'order_intake'"
|
||||
class="shrink-0 rounded bg-violet-50 px-1.5 py-0.5 text-[10px] text-violet-700"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.myTodos.intakeParseBadge') }}
|
||||
</span>
|
||||
<span
|
||||
v-else-if="item.can_handle === false"
|
||||
class="shrink-0 rounded bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-600"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.todo.adminViewOnlyShort') }}
|
||||
</span>
|
||||
<span
|
||||
v-else-if="terminalBadge === 'upload_complete'"
|
||||
class="shrink-0 rounded bg-emerald-50 px-1.5 py-0.5 text-[10px] text-emerald-700"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.myTodos.terminal.uploadComplete') }}
|
||||
</span>
|
||||
<span
|
||||
v-else-if="terminalBadge === 'reject_void'"
|
||||
class="shrink-0 rounded bg-red-50 px-1.5 py-0.5 text-[10px] text-red-700"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.myTodos.terminal.rejectVoid') }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt-0.5 truncate text-xs text-muted">{{ todoSubTitleText(item) || '—' }}</div>
|
||||
</td>
|
||||
<td class="px-3 py-2.5 align-middle">
|
||||
<span class="whitespace-nowrap rounded-full bg-brand-50 px-2 py-0.5 text-xs text-brand-800">
|
||||
{{ stageLabel(item) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="max-w-[18rem] px-3 py-2.5 align-middle">
|
||||
<div class="truncate text-[13px] text-secondary">{{ rowTitle(item) }}</div>
|
||||
<div
|
||||
v-if="rowBlocker(item)"
|
||||
class="mt-0.5 truncate text-xs text-red-600"
|
||||
data-testid="my-todos-row-blocker"
|
||||
>
|
||||
{{ rowBlocker(item) }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-3 py-2.5 align-middle text-xs">
|
||||
<template v-if="item.business_no">
|
||||
<span>{{ lineBriefText(item) }}</span>
|
||||
<span
|
||||
v-if="todoLineBrief(item).shortage"
|
||||
class="ml-1 font-semibold text-red-600"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.myTodos.table.shortage', { count: todoLineBrief(item).shortage }) }}
|
||||
</span>
|
||||
</template>
|
||||
<span v-else class="text-muted">—</span>
|
||||
</td>
|
||||
<td class="px-3 py-2.5 align-middle text-xs text-secondary">
|
||||
{{ item.business_no ? (item.upload_status || '—') : '—' }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{ rowBlocker(row as ShippingTaskSummary) }}
|
||||
</ElText>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myTodos.table.lines')" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<template v-if="(row as ShippingTaskSummary).business_no">
|
||||
<span>{{ lineBriefText(row as ShippingTaskSummary) }}</span>
|
||||
<ElText v-if="todoLineBrief(row as ShippingTaskSummary).shortage" type="danger">
|
||||
{{ t('workspace.shippingNotice.myTodos.table.shortage', { count: todoLineBrief(row as ShippingTaskSummary).shortage }) }}
|
||||
</ElText>
|
||||
</template>
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="t('workspace.shippingNotice.myTodos.table.freightStatus')" min-width="120">
|
||||
<template #default="{ row }">
|
||||
{{ (row as ShippingTaskSummary).business_no ? ((row as ShippingTaskSummary).upload_status || '—') : '—' }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
</template>
|
||||
@@ -2,7 +2,7 @@
|
||||
* features/workspace/shipping-task-center/ShippingTaskWorkbench.vue
|
||||
* 用途:发货任务处理主区——当前待办栏、五阶段进度、最后活动/终止原因、STP 事实、订单概览、时间线。
|
||||
* 依赖:TaskTodoPanel、StpProgressFactsPanel、TaskProgressTimeline、ShippingTaskParsedResultCard、
|
||||
* useShippingProcessingWorkItem、ShippingWorkflowStepper、listWorkspaceShippingTaskAuditTimeline。
|
||||
* element-plus、useShippingProcessingWorkItem、ShippingWorkflowStepper、listWorkspaceShippingTaskAuditTimeline。
|
||||
* 逻辑:由 ShippingTaskCenterPage 选中任务后挂载;OT 身份取 detail.order_task_no(禁止 WorkflowItem);
|
||||
* 业务进度仅来自 detail.ui_state.steps(动作归 TaskTodoPanel,UI-05);
|
||||
* 时间线仅消费统一 ShippingAuditEvent。
|
||||
@@ -10,6 +10,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElButton } from 'element-plus';
|
||||
import ShippingMatchResultCard from '@/features/chat/components/messages/ShippingMatchResultCard.vue';
|
||||
import ShippingTaskParsedResultCard from '@/features/chat/components/ShippingTaskParsedResultCard.vue';
|
||||
import { resolveShippingWorkflowSteps } from '@/features/chat/shipping/shippingStepper';
|
||||
@@ -186,13 +187,9 @@ async function downloadExcel() {
|
||||
</div>
|
||||
</dl>
|
||||
<div v-if="downloadExcelAuthorized && !actionBarOffersDownloadExcel" class="mt-3">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-xl border border-default px-3 py-1.5 text-sm font-medium text-secondary hover:bg-surface-soft"
|
||||
@click="downloadExcel"
|
||||
>
|
||||
<ElButton @click="downloadExcel">
|
||||
{{ $t('workspace.shippingNotice.todo.downloadExcel') }}
|
||||
</button>
|
||||
</ElButton>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
/**
|
||||
* features/workspace/shipping-task-center/StpProgressFactsPanel.vue
|
||||
* 用途:展示后端 ui_state.summary.stp_facts,含逐行 Reservation/料号/实际库存源/文件证据。
|
||||
* 依赖:ShippingTaskUiState.summary.stp_facts、vue-i18n。
|
||||
* 依赖:ShippingTaskUiState.summary.stp_facts、element-plus、vue-i18n。
|
||||
* 逻辑:由 ShippingTaskWorkbench 在待办栏下方挂载;无 stp_facts 时不渲染;不发明进度。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElTable, ElTableColumn } from 'element-plus';
|
||||
import type { ShippingStpFacts } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
type StpLine = NonNullable<ShippingStpFacts['line_resolutions']>[number] & { rowKey: string; displayLine: number };
|
||||
|
||||
const props = defineProps<{
|
||||
facts: ShippingStpFacts | null | undefined;
|
||||
}>();
|
||||
@@ -20,7 +23,11 @@ const resolutionEntries = computed(() => {
|
||||
const counts = props.facts?.resolution_counts || {};
|
||||
return Object.entries(counts).map(([disposition, count]) => ({ disposition, count }));
|
||||
});
|
||||
const lineRows = computed(() => props.facts?.line_resolutions || []);
|
||||
const lineRows = computed<StpLine[]>(() => (props.facts?.line_resolutions || []).map((row, index) => ({
|
||||
...row,
|
||||
rowKey: `${row.line_no || row.line_index || 'line'}-${index}`,
|
||||
displayLine: (row.line_index ?? index) + 1,
|
||||
})));
|
||||
|
||||
/**
|
||||
* 行级 disposition 文案;未知码回退原文。
|
||||
@@ -93,34 +100,28 @@ function evidenceText(row: NonNullable<ShippingStpFacts['line_resolutions']>[num
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<div v-if="lineRows.length" class="mt-3 overflow-x-auto">
|
||||
<div class="mb-1 text-xs text-muted">{{ $t('workspace.shippingNotice.stpFacts.lineTableTitle') }}</div>
|
||||
<table class="min-w-full border-collapse text-xs">
|
||||
<thead>
|
||||
<tr class="border-b border-default/70 text-left text-muted">
|
||||
<th class="py-1 pr-2 font-medium">{{ $t('workspace.shippingNotice.stpFacts.colLine') }}</th>
|
||||
<th class="py-1 pr-2 font-medium">{{ $t('workspace.shippingNotice.stpFacts.colReservation') }}</th>
|
||||
<th class="py-1 pr-2 font-medium">{{ $t('workspace.shippingNotice.stpFacts.colPart') }}</th>
|
||||
<th class="py-1 pr-2 font-medium">{{ $t('workspace.shippingNotice.stpFacts.colDisposition') }}</th>
|
||||
<th class="py-1 pr-2 font-medium">{{ $t('workspace.shippingNotice.stpFacts.colSource') }}</th>
|
||||
<th class="py-1 font-medium">{{ $t('workspace.shippingNotice.stpFacts.colEvidence') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(row, index) in lineRows"
|
||||
:key="`${row.line_no || row.line_index}-${index}`"
|
||||
class="border-b border-default/50 align-top"
|
||||
>
|
||||
<td class="py-1.5 pr-2 font-mono">{{ (row.line_index ?? index) + 1 }}</td>
|
||||
<td class="py-1.5 pr-2 font-mono">{{ row.effective_reservation_id || '—' }}</td>
|
||||
<td class="py-1.5 pr-2 font-mono">{{ row.part_number || '—' }}</td>
|
||||
<td class="py-1.5 pr-2">{{ dispositionLabel(String(row.disposition || 'unknown')) }}</td>
|
||||
<td class="py-1.5 pr-2 font-mono">{{ row.resolved_inventory_source_code || '—' }}</td>
|
||||
<td class="py-1.5 font-mono text-muted">{{ evidenceText(row) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div v-if="lineRows.length" class="mt-3">
|
||||
<div>{{ $t('workspace.shippingNotice.stpFacts.lineTableTitle') }}</div>
|
||||
<ElTable :data="lineRows" row-key="rowKey">
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.stpFacts.colLine')" min-width="72">
|
||||
<template #default="{ row }">{{ (row as StpLine).displayLine }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.stpFacts.colReservation')" min-width="120">
|
||||
<template #default="{ row }">{{ (row as StpLine).effective_reservation_id || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.stpFacts.colPart')" min-width="120">
|
||||
<template #default="{ row }">{{ (row as StpLine).part_number || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.stpFacts.colDisposition')" min-width="120">
|
||||
<template #default="{ row }">{{ dispositionLabel(String((row as StpLine).disposition || 'unknown')) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.stpFacts.colSource')" min-width="120">
|
||||
<template #default="{ row }">{{ (row as StpLine).resolved_inventory_source_code || '—' }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn :label="$t('workspace.shippingNotice.stpFacts.colEvidence')" min-width="180">
|
||||
<template #default="{ row }">{{ evidenceText(row as StpLine) }}</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* features/workspace/shipping-task-center/TaskTodoPanel.vue
|
||||
* 用途:渲染统一 Gate 恢复卡片与 STP 履约待办说明(表单/弹窗入口)。
|
||||
* 依赖:ProcessGateRecoveryCard、shipping.api、shipping-tasks.api、ManualUploadEvidenceDialog。
|
||||
* 依赖:ProcessGateRecoveryCard、shipping.api、shipping-tasks.api、element-plus、ManualUploadEvidenceDialog。
|
||||
* 逻辑:gateCanHandle 控制 Gate 卡写按钮;actionsExecutable 控制统一 action.code 写操作;
|
||||
* hidePrimaryActions=true 时隐藏本卡按钮(订单处理工作台写入口仅 Footer);
|
||||
* 系统 Worker / technical_auto_only 不计入人工阻断,避免「待处理事项」冒充系统等待。
|
||||
@@ -9,6 +9,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElButton } from 'element-plus';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import ShippingCustomerConfirmDialog from '@/features/chat/components/ShippingCustomerConfirmDialog.vue';
|
||||
import type {
|
||||
@@ -363,31 +364,25 @@ async function runUnifiedAction(action: ShippingUnifiedAction) {
|
||||
{{ $t('workspace.shippingNotice.todo.adminViewOnly') }}
|
||||
</div>
|
||||
<div v-else-if="backendPrimaryAction || backendSecondaryActions.length" class="mt-3 flex flex-wrap gap-2">
|
||||
<button
|
||||
<ElButton
|
||||
v-if="backendPrimaryAction"
|
||||
:key="backendPrimaryAction.code"
|
||||
type="button"
|
||||
class="rounded-xl px-3 py-1.5 text-sm font-medium transition-colors disabled:opacity-50"
|
||||
:class="backendPrimaryAction.kind === 'terminate'
|
||||
? 'bg-rose-600 text-white hover:bg-rose-700'
|
||||
: backendPrimaryAction.kind === 'view'
|
||||
? 'border border-default bg-surface text-secondary hover:bg-surface-soft'
|
||||
: 'bg-brand-600 text-white hover:bg-brand-700'"
|
||||
:disabled="!backendPrimaryAction.enabled || busyId === backendPrimaryAction.code"
|
||||
:type="backendPrimaryAction.kind === 'terminate' ? 'danger' : backendPrimaryAction.kind === 'view' ? 'default' : 'primary'"
|
||||
:disabled="!backendPrimaryAction.enabled"
|
||||
:loading="busyId === backendPrimaryAction.code"
|
||||
@click="runUnifiedAction(backendPrimaryAction)"
|
||||
>
|
||||
{{ backendPrimaryAction.label }}
|
||||
</button>
|
||||
<button
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-for="action in backendSecondaryActions"
|
||||
:key="action.code"
|
||||
type="button"
|
||||
class="rounded-xl border border-default bg-surface px-3 py-1.5 text-sm font-medium text-secondary transition-colors hover:bg-surface-soft disabled:opacity-50"
|
||||
:disabled="!action.enabled || busyId === action.code"
|
||||
:disabled="!action.enabled"
|
||||
:loading="busyId === action.code"
|
||||
@click="runUnifiedAction(action)"
|
||||
>
|
||||
{{ action.label }}
|
||||
</button>
|
||||
</ElButton>
|
||||
</div>
|
||||
<ManualUploadEvidenceDialog
|
||||
v-model:open="manualUploadOpen"
|
||||
|
||||
Reference in new issue
Block a user