feat(shipping-notice): 增强订单文档 Profile 管理功能,新增复核与草稿管理

- 添加订单复核相关模型及 API,支持复核案例的创建、更新和确认
- 实现复核草稿的管理功能,允许用户对复核内容进行编辑和保存
- 引入复核事件审计,确保复核过程的可追溯性
- 更新数据库模型以支持复核和草稿的关系管理
- 完善相关服务逻辑,确保复核与草稿的状态管理和数据一致性
- 增强文档模板的管理能力,支持更复杂的业务场景
This commit is contained in:
hugo committed 2026-07-29 09:50:25 +08:00
1 parent 61ac6403c4
commit b7307fc573
147 files changed
+15108 -1522

No files matched your search

@@ -8,6 +8,7 @@ import { nextTick } from 'vue';
import { mount } from '@vue/test-utils';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { createI18n } from 'vue-i18n';
import { createMemoryHistory, createRouter } from 'vue-router';
import chatZhCn from '@/locales/zh-CN/chat.json';
import ShippingOrderDocumentResultItem from './ShippingOrderDocumentResultItem.vue';
import ShippingOrderExtractionCard from './ShippingOrderExtractionCard.vue';
@@ -43,6 +44,14 @@ const flushUi = async () => {
await nextTick();
};
const makeRouter = () => createRouter({
history: createMemoryHistory(),
routes: [
{ path: '/chat/:agentId', name: 'Chat', component: { template: '<div />' } },
{ path: '/chat/:agentId/order-review/:runNo', name: 'ShippingOrderReview', component: { template: '<div />' } },
],
});
const buildState = (patch: Partial<ShippingOrderExtractionState> = {}): ShippingOrderExtractionState => ({
status: 'processing',
summary: {
@@ -116,7 +125,7 @@ describe('ShippingOrderExtractionCard', () => {
document.body.innerHTML = '';
});
it('loads documents once when opening details from server actions', async () => {
it('refreshes documents whenever the details drawer is opened', async () => {
api.listDocuments.mockResolvedValue({ items: [buildDocument()] });
api.listProgressEvents.mockResolvedValue({ items: [buildProgressEvent()] });
const wrapper = mount(ShippingOrderExtractionCard, {
@@ -189,21 +198,24 @@ describe('ShippingOrderExtractionCard', () => {
await detailButton!.trigger('click');
await flushUi();
expect(api.listDocuments).toHaveBeenCalledTimes(1);
expect(api.listProgressEvents).toHaveBeenCalledTimes(1);
expect(api.listDocuments).toHaveBeenCalledTimes(2);
expect(api.listProgressEvents).toHaveBeenCalledTimes(2);
});
it('emits manual review directly when attachments are already available', async () => {
it('routes manual review directly to the dedicated workspace', async () => {
const router = makeRouter();
await router.push({ name: 'Chat', params: { agentId: 'agent-1' } });
await router.isReady();
const pushSpy = vi.spyOn(router, 'push');
const wrapper = mount(ShippingOrderExtractionCard, {
props: {
state: buildState({
availableActions: ['enter_manual_review'],
}),
runNo: 'SNER-002',
hasReviewAttachments: true,
},
global: {
plugins: [i18n],
plugins: [i18n, router],
stubs: {
teleport: true,
},
@@ -215,10 +227,37 @@ describe('ShippingOrderExtractionCard', () => {
await reviewButton!.trigger('click');
expect(wrapper.emitted('enterManualReview')).toHaveLength(1);
await vi.waitFor(() => expect(pushSpy).toHaveBeenCalled());
expect(pushSpy).toHaveBeenCalledWith({
name: 'Chat',
params: { agentId: 'agent-1' },
query: { mode: 'order-review', run_no: 'SNER-002' },
});
expect(api.listDocuments).not.toHaveBeenCalled();
});
it('preserves the originating conversation when entering manual review', async () => {
const router = makeRouter();
await router.push({ name: 'Chat', params: { agentId: 'agent-1' }, query: { conversation_id: 'conv-123' } });
await router.isReady();
const pushSpy = vi.spyOn(router, 'push');
const wrapper = mount(ShippingOrderExtractionCard, {
props: { state: buildState({ availableActions: ['enter_manual_review'] }), runNo: 'SNER-003' },
global: { plugins: [i18n, router], stubs: { teleport: true } },
});
const reviewButton = wrapper.findAll('button').find((item) => item.text().includes('进入人工复核'));
expect(reviewButton).toBeTruthy();
await reviewButton!.trigger('click');
await vi.waitFor(() => expect(pushSpy).toHaveBeenCalled());
expect(pushSpy).toHaveBeenCalledWith({
name: 'Chat',
params: { agentId: 'agent-1' },
query: { conversation_id: 'conv-123', mode: 'order-review', run_no: 'SNER-003' },
});
});
it('emits retry for failed attachments without mutating state locally', async () => {
const wrapper = mount(ShippingOrderExtractionCard, {
props: {
@@ -305,7 +344,6 @@ describe('ShippingOrderExtractionDetailsDrawer', () => {
loadFailed: false,
progressLoading: false,
progressLoadFailed: false,
hasReviewAttachments: true,
},
global: {
plugins: [i18n],
@@ -369,7 +407,6 @@ describe('ShippingOrderDocumentResultItem', () => {
},
available_actions: ['view_evidence', 'manual_review'],
}),
hasReviewAttachments: true,
},
global: {
plugins: [i18n],