fix(worker-platform): 优化工单号精准检索与跨状态流转展示,修复状态更新后工单消失问题
1. 后端查询重构:新增 isWorkOrderNoLookupKeyword 工单号前缀与忽略大小写精准索引匹配,优化后端 work-order-query-repo 的工单号检索路径; 2. 前端单号智能穿透:管理员输入 WO... 等精准单号查询时,自动放宽细粒度排他状态/阶段过滤,避免加好友/验收等状态流转后工单因旧状态筛选脱靶消失; 3. 搜索栏交互升级:输入框清空即时重置关键词与页码,支持回车/按钮/清除全方位无缝触发; 4. 详情抽屉与多面板联动:增加 ordersQuery 数据更新对 detailOrder 的自动同步,并将 refreshAll 广播范围覆盖至寄售仓库与统计指标。
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
SafetyCertificateOutlined,
|
||||
UserOutlined,
|
||||
} from '@ant-design/icons'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import {
|
||||
Alert,
|
||||
App,
|
||||
@@ -101,6 +101,8 @@ export default function WorkerConsignmentPage() {
|
||||
const priceFetchTimer = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
const lastPriceQueryKeyRef = useRef('')
|
||||
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
const profileQuery = useQuery({
|
||||
queryKey: ['worker-profile'],
|
||||
queryFn: () => fetchWorkerProfile(),
|
||||
@@ -114,6 +116,14 @@ export default function WorkerConsignmentPage() {
|
||||
queryFn: () => fetchWorkerConsignments(),
|
||||
})
|
||||
|
||||
// 切换标签页时自动刷新最新数据
|
||||
useEffect(() => {
|
||||
if (activeTab === 'records') {
|
||||
void queryClient.invalidateQueries({ queryKey: ['worker-my-consignments'] })
|
||||
}
|
||||
void queryClient.invalidateQueries({ queryKey: ['worker-profile'] })
|
||||
}, [activeTab, queryClient])
|
||||
|
||||
// 后端已按「一件货一行」聚合,前端不再合并提报单与库存
|
||||
const records = myConsignmentsQuery.data?.data.items || []
|
||||
const stageCounts = myConsignmentsQuery.data?.data.stageCounts || {}
|
||||
@@ -1104,10 +1114,37 @@ function ConsignmentRecordCard({
|
||||
</Space>
|
||||
) : null}
|
||||
{shots.length > 0 || giftShots.length > 0 ? (
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 10, marginTop: 8, alignItems: 'center' }}>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap',
|
||||
gap: 10,
|
||||
marginTop: 8,
|
||||
alignItems: 'center',
|
||||
}}
|
||||
>
|
||||
{shots.length > 0 ? (
|
||||
<div style={{ display: 'inline-flex', alignItems: 'center', gap: 8, background: '#f8fafc', padding: '4px 10px', borderRadius: 6, border: '1px solid #e2e8f0' }}>
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12, display: 'flex', alignItems: 'center', gap: 4, whiteSpace: 'nowrap' }}>
|
||||
<div
|
||||
style={{
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
gap: 8,
|
||||
background: '#f8fafc',
|
||||
padding: '4px 10px',
|
||||
borderRadius: 6,
|
||||
border: '1px solid #e2e8f0',
|
||||
}}
|
||||
>
|
||||
<Typography.Text
|
||||
type="secondary"
|
||||
style={{
|
||||
fontSize: 12,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 4,
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
<PictureOutlined />
|
||||
商品截图({shots.length})
|
||||
</Typography.Text>
|
||||
@@ -1127,8 +1164,28 @@ function ConsignmentRecordCard({
|
||||
</div>
|
||||
) : null}
|
||||
{giftShots.length > 0 ? (
|
||||
<div style={{ display: 'inline-flex', alignItems: 'center', gap: 8, background: '#f0fdf4', padding: '4px 10px', borderRadius: 6, border: '1px solid #bbf7d0' }}>
|
||||
<Typography.Text strong style={{ fontSize: 12, color: '#15803d', display: 'flex', alignItems: 'center', gap: 4, whiteSpace: 'nowrap' }}>
|
||||
<div
|
||||
style={{
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
gap: 8,
|
||||
background: '#f0fdf4',
|
||||
padding: '4px 10px',
|
||||
borderRadius: 6,
|
||||
border: '1px solid #bbf7d0',
|
||||
}}
|
||||
>
|
||||
<Typography.Text
|
||||
strong
|
||||
style={{
|
||||
fontSize: 12,
|
||||
color: '#15803d',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 4,
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
<CheckCircleOutlined />
|
||||
赠送凭证({giftShots.length})
|
||||
</Typography.Text>
|
||||
@@ -1146,7 +1203,11 @@ function ConsignmentRecordCard({
|
||||
</Space>
|
||||
</Image.PreviewGroup>
|
||||
{record.giftEvidenceNote ? (
|
||||
<Typography.Text type="secondary" style={{ fontSize: 11, color: '#4b5563', maxWidth: 160 }} ellipsis={{ tooltip: record.giftEvidenceNote }}>
|
||||
<Typography.Text
|
||||
type="secondary"
|
||||
style={{ fontSize: 11, color: '#4b5563', maxWidth: 160 }}
|
||||
ellipsis={{ tooltip: record.giftEvidenceNote }}
|
||||
>
|
||||
{record.giftEvidenceNote}
|
||||
</Typography.Text>
|
||||
) : null}
|
||||
|
||||
Reference in New Issue
Block a user