fix(worker-platform): 优化工单号精准检索与跨状态流转展示,修复状态更新后工单消失问题
1. 后端查询重构:新增 isWorkOrderNoLookupKeyword 工单号前缀与忽略大小写精准索引匹配,优化后端 work-order-query-repo 的工单号检索路径; 2. 前端单号智能穿透:管理员输入 WO... 等精准单号查询时,自动放宽细粒度排他状态/阶段过滤,避免加好友/验收等状态流转后工单因旧状态筛选脱靶消失; 3. 搜索栏交互升级:输入框清空即时重置关键词与页码,支持回车/按钮/清除全方位无缝触发; 4. 详情抽屉与多面板联动:增加 ordersQuery 数据更新对 detailOrder 的自动同步,并将 refreshAll 广播范围覆盖至寄售仓库与统计指标。
This commit is contained in:
@@ -110,6 +110,8 @@ function mapConsignmentEvidence(source: {
|
||||
gift_evidence_json?: string | Record<string, unknown> | null
|
||||
gift_work_order_no?: string | null
|
||||
gift_work_order_status?: string | null
|
||||
gift_phase?: string | null
|
||||
gift_friend_added_at?: string | null
|
||||
}) {
|
||||
const acceptance = toRecord(source.gift_evidence_json)
|
||||
const files = Array.isArray(acceptance?.files) ? (acceptance.files as unknown[]) : []
|
||||
@@ -146,6 +148,8 @@ function mapConsignmentEvidence(source: {
|
||||
giftEvidenceSubmittedAt: String(acceptance?.submittedAt || ''),
|
||||
giftWorkOrderNo: source.gift_work_order_no || '',
|
||||
giftWorkOrderStatus: workOrderStatus,
|
||||
giftPhase: source.gift_phase || '',
|
||||
giftFriendAddedAt: source.gift_friend_added_at || '',
|
||||
/** none=还没交 / pending=交了待客服验收 / accepted=客服已验收 / submitted=其他在途状态 */
|
||||
giftEvidenceReviewStatus: reviewStatus,
|
||||
}
|
||||
|
||||
@@ -1635,6 +1635,25 @@ test('好友赠送待打手提交资料筛选排除待抢单订单', () => {
|
||||
assert.match(whereClause, /wo\.status IN \('in_progress', 'problem'\)/)
|
||||
})
|
||||
|
||||
test('工单筛选支持内部寄售匹配与打手好友赠送隔离,且赠送冷却中排除已验收已取消工单', () => {
|
||||
const internalQuery = buildWorkOrderWhere({ acceptanceMode: 'internal_consignment' })
|
||||
assert.match(internalQuery.whereClause, /wo\.material_json->'consignment'->>'inventoryId' IS NOT NULL/)
|
||||
assert.match(internalQuery.whereClause, /wo\.assigned_worker_id IS NULL OR wo\.assigned_worker_id = 0/)
|
||||
|
||||
const friendGiftQuery = buildWorkOrderWhere({ acceptanceMode: 'friend_gift' })
|
||||
assert.match(friendGiftQuery.whereClause, /wo\.acceptance_mode = 'friend_gift'/)
|
||||
assert.match(friendGiftQuery.whereClause, /NOT \(/)
|
||||
|
||||
const countdownQuery = buildWorkOrderWhere({ giftPhase: 'friend_countdown' })
|
||||
assert.match(countdownQuery.whereClause, /wo\.gift_phase = 'friend_countdown'/)
|
||||
assert.match(countdownQuery.whereClause, /wo\.gift_available_at > NOW\(\)/)
|
||||
assert.match(countdownQuery.whereClause, /wo\.status NOT IN \('accepted', 'cancelled'\)/)
|
||||
|
||||
const readyQuery = buildWorkOrderWhere({ giftPhase: 'gift_ready' })
|
||||
assert.match(readyQuery.whereClause, /wo\.gift_available_at <= NOW\(\)/)
|
||||
assert.match(readyQuery.whereClause, /wo\.status NOT IN \('accepted', 'cancelled'\)/)
|
||||
})
|
||||
|
||||
test('好友赠送冷却中才允许客服手动结束冷却', () => {
|
||||
const cooling = mapWorkOrderAdmin(
|
||||
buildWorkOrderRow({
|
||||
|
||||
Reference in New Issue
Block a user