适配来源消息只读任务展示

This commit is contained in:
andy
2026-07-10 19:38:13 +08:00
parent bbd4ea22df
commit 1efa819599
11 changed files with 324 additions and 14 deletions

View File

@@ -66,6 +66,35 @@ function createTaskDetail(overrides: Partial<ReservationTaskDetailResult> = {}):
}
}
function createSourceMessageOnlyTaskDetail(
overrides: Partial<ReservationTaskDetailResult> = {},
): ReservationTaskDetailResult {
return createTaskDetail({
system_task_type: 'SOURCE_MESSAGE_ONLY',
task_card_type: 'SOURCE_MESSAGE_ONLY',
task_status: 'COMPLETED',
fields: [],
opera_operations: [],
availability: {
blocked: false,
read_only: true,
editable: false,
confirmable: false,
executable: false,
blocked_by_task_id: null,
blocked_reason: null,
},
source_message_only_result: {
entry_result_code: 'S000',
entry_result_meaning: 'PURE_INFORMATION',
entry_result_description: '纯信息类邮件',
entry_result_source_message_id: '30001',
raw_answer: 'S000,30001',
},
...overrides,
})
}
function createMutationResult(taskStatus = 'PENDING_CONFIRM'): ReservationTaskPayloadMutationResult {
return {
task_id: '10001',
@@ -428,6 +457,29 @@ describe('ReservationTaskDetailPanel', () => {
expect(wrapper.text()).not.toContain('接口待补')
})
it('renders source-message-only entry result without editable or OPERA actions', async () => {
vi.mocked(service.fetchReservationTaskDetail).mockResolvedValue(createSourceMessageOnlyTaskDetail())
const wrapper = await mountPanel()
expect(wrapper.text()).toContain('来源消息只读')
expect(wrapper.text()).toContain('来源消息入口结果')
expect(wrapper.text()).toContain('该任务仅用于展示来源消息入口结果')
expect(wrapper.text()).toContain('S000')
expect(wrapper.text()).toContain('PURE_INFORMATION')
expect(wrapper.text()).toContain('纯信息类邮件')
expect(wrapper.text()).toContain('S000,30001')
expect(wrapper.text()).toContain('查看邮件会话')
expect(wrapper.text()).not.toContain('查看订单')
expect(wrapper.text()).not.toContain('保存草稿')
expect(wrapper.text()).not.toContain('确认任务')
expect(wrapper.text()).not.toContain('人工转换')
expect(wrapper.text()).not.toContain('OPERA 模拟操作')
expect(wrapper.text()).not.toContain('确认任务后生成 OPERA 模拟操作')
expect(wrapper.find('button[title="执行"]').exists()).toBe(false)
expect(wrapper.find('button[title="重试"]').exists()).toBe(false)
})
it('converts a manual review task to a new booking without a target order', async () => {
vi.mocked(service.fetchReservationTaskDetail)
.mockResolvedValueOnce(

View File

@@ -93,6 +93,41 @@ function createTaskListResult(
}
}
function createSourceMessageOnlyTaskListResult(taskSubtype: 'S000' | 'S999' = 'S000') {
return {
items: [
{
task_id: taskSubtype === 'S000' ? '19990' : '19999',
order_id: taskSubtype === 'S000' ? '29990' : '29999',
hotel_id: 'HOTEL-TEST',
display_order_key: null,
temporary_order_no: null,
task_type: 'SOURCE_MESSAGE_ONLY',
task_subtype: taskSubtype,
task_status: 'COMPLETED',
card_name: 'SOURCE_MESSAGE_ONLY',
queue_sequence: null,
queue_participation: false,
can_process: false,
readonly_reason_code: 'QUEUE_EXCLUDED',
source_message_id: taskSubtype === 'S000' ? '39990' : '39999',
source_subject: taskSubtype === 'S000' ? 'FYI only' : 'Unclear email',
source_sender_summary: 'guest@example.test',
source_received_at: '2026-07-08T03:00:00Z',
external_conversation_id: 'thread-source-only',
conversation_message_count: 1,
created_at: '2026-07-08T03:00:00Z',
updated_at: '2026-07-08T03:10:00Z',
},
],
page: {
page_num: 1,
page_size: 20,
total: 1,
},
}
}
function createOrderDetailResult(displayName = 'GRP-001') {
return {
order: {
@@ -440,6 +475,46 @@ describe('reservation P0 views', () => {
expect(wrapper.text()).not.toContain('NEW_BOOKING / NEW_BOOKING')
})
it('filters source-message-only tasks with S000 and S999 subtypes', async () => {
vi.mocked(service.fetchReservationTaskList).mockResolvedValue(createSourceMessageOnlyTaskListResult('S000'))
const wrapper = await mountWithPlugins(ReservationTaskListView)
await vi.dynamicImportSettled()
expect(wrapper.find('select[name="task_type"]').text()).toContain('来源消息只读')
expect(wrapper.find('select[name="task_type"]').text()).toContain('历史 Message Notification')
expect(wrapper.find('select[name="task_subtype"]').text()).toContain('纯信息类邮件')
expect(wrapper.find('select[name="task_subtype"]').text()).toContain('无法形成业务素材包')
await wrapper.find('select[name="task_type"]').setValue('SOURCE_MESSAGE_ONLY')
await vi.dynamicImportSettled()
await wrapper.find('select[name="task_subtype"]').setValue('S999')
await vi.dynamicImportSettled()
expect(service.fetchReservationTaskList).toHaveBeenLastCalledWith(
expect.objectContaining({
task_type: 'SOURCE_MESSAGE_ONLY',
task_subtype: 'S999',
page_num: 1,
}),
)
})
it('renders source-message-only task rows without a visible order action', async () => {
vi.mocked(service.fetchReservationTaskList).mockResolvedValue(createSourceMessageOnlyTaskListResult('S000'))
const wrapper = await mountWithPlugins(ReservationTaskListView)
await vi.dynamicImportSettled()
expect(wrapper.text()).toContain('来源消息只读')
expect(wrapper.text()).toContain('纯信息类邮件')
expect(wrapper.text()).toContain('FYI only')
expect(wrapper.text()).toContain('查看任务')
expect(wrapper.text()).toContain('查看邮件会话')
expect(wrapper.text()).not.toContain('查看订单')
expect(wrapper.text()).not.toContain('29990')
})
it('filters and paginates task list with supported backend fields', async () => {
vi.mocked(service.fetchReservationTaskList)
.mockResolvedValueOnce(createTaskListResult('GRP-001', 'Booking Request', { page_num: 1, page_size: 20, total: 45 }))