Commit 72aef730 by wusiyi

feat: 操作单号查询需支持二维码扫描识别出来的单号 #1010763

parent 291580cc
...@@ -63,18 +63,50 @@ export function useOrderSearchForm( ...@@ -63,18 +63,50 @@ export function useOrderSearchForm(
searchForm.value.shipmentType = '' searchForm.value.shipmentType = ''
} }
/** 扫码枪扫完一单后追加英文逗号,便于连续扫多个操作单号 */
const handleOperationNoScanEnter = (event: KeyboardEvent) => {
event.preventDefault()
const val = (searchForm.value.operationNo || '').trim()
if (!val || val.endsWith(',')) return
searchForm.value.operationNo = `${val},`
}
const getQueryPayload = () => { const getQueryPayload = () => {
const { productMarkList: rawProductMarks, tagsIdArr, ...rest } = const {
searchForm.value productMarkList: rawProductMarks,
tagsIdArr,
operationNo,
...rest
} = searchForm.value
const markQuery = normalizeProductMarkListForQuery(rawProductMarks) const markQuery = normalizeProductMarkListForQuery(rawProductMarks)
const tagsId = const tagsId =
Array.isArray(tagsIdArr) && tagsIdArr.length > 0 Array.isArray(tagsIdArr) && tagsIdArr.length > 0
? tagsIdArr.join(',') ? tagsIdArr.join(',')
: undefined : undefined
const processedOperationNo = (() => {
const originalValue = operationNo || ''
if (!originalValue) return ''
const values = originalValue.split(/[,,;;]/).filter((v) => v.trim())
const processedValues = values.map((value) => {
const trimmedValue = value.trim()
const underscoreCount = (trimmedValue.match(/_/g) || []).length
if (underscoreCount >= 3) {
const parts = trimmedValue.split('_')
return parts[3]
}
return trimmedValue
})
return processedValues.join(',')
})()
const raw: Record<string, unknown> = { const raw: Record<string, unknown> = {
...rest, ...rest,
...markQuery, ...markQuery,
...(tagsId !== undefined ? { tagsId } : {}), ...(tagsId !== undefined ? { tagsId } : {}),
operationNo: processedOperationNo,
startTime: dateRange.value?.[0] || null, startTime: dateRange.value?.[0] || null,
endTime: dateRange.value?.[1] || null, endTime: dateRange.value?.[1] || null,
} }
...@@ -99,6 +131,7 @@ export function useOrderSearchForm( ...@@ -99,6 +131,7 @@ export function useOrderSearchForm(
toggleMulti, toggleMulti,
changeReplaceShipment, changeReplaceShipment,
getQueryPayload, getQueryPayload,
handleOperationNoScanEnter,
reset, reset,
} }
} }
...@@ -165,6 +165,7 @@ ...@@ -165,6 +165,7 @@
placeholder="多个操作单号,分隔" placeholder="多个操作单号,分隔"
clearable clearable
style="width: 140px" style="width: 140px"
@keydown.enter.prevent="handleOperationNoScanEnter"
/> />
</ElFormItem> </ElFormItem>
...@@ -1394,6 +1395,7 @@ const { ...@@ -1394,6 +1395,7 @@ const {
toggleMulti, toggleMulti,
changeReplaceShipment, changeReplaceShipment,
getQueryPayload, getQueryPayload,
handleOperationNoScanEnter,
reset, reset,
} = useOrderSearchForm( } = useOrderSearchForm(
() => refreshCurrentViewProxy.value(), () => refreshCurrentViewProxy.value(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment