feat(波次拣货): 拣货任务列表增加波次号/操作人/拣货人/领料人/复核人筛选,操作符经 where 下发后端;contains/in/notin 的 value 按全站约定以数组传递,like 等为字符串
This commit is contained in:
parent
9b6be17119
commit
7e380d6c54
@ -28,6 +28,7 @@ export type WavePickTaskListParams = {
|
||||
keyword?: string
|
||||
start_time_start?: string
|
||||
start_time_end?: string
|
||||
/** 人员名称(operator_name 操作人/pick_user_name/review_user_name/claim_operator)与关联波次号 wave_no 通过 where 传 { operator, value },由后端按 operator 处理(默认模糊 like) */
|
||||
where?: Record<string, any>
|
||||
strategy_id?: number
|
||||
}
|
||||
|
||||
@ -480,6 +480,36 @@ function toPositiveId(value: unknown): number | undefined {
|
||||
return Math.trunc(num)
|
||||
}
|
||||
|
||||
/** 读取 ScanBox 条件中指定字段的操作符(如 eq/like);未选择时默认模糊(like) */
|
||||
function resolveScanConditionOperator(
|
||||
rawConditions: Record<string, any>,
|
||||
key: string,
|
||||
fallback = 'like'
|
||||
): string {
|
||||
const root = unwrapScanBoxConditionMap(rawConditions)
|
||||
const condition = root[key]
|
||||
if (condition && typeof condition === 'object' && !Array.isArray(condition)) {
|
||||
const op = condition.operator
|
||||
if (typeof op === 'string' && op) return op
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
|
||||
/** where 文本条件 value 归一化:contains/in/notin 与全站列表页约定一致,以数组下发(逗号/换行分隔,单值也包成数组);其余操作符以字符串下发 */
|
||||
function toWhereTextValue(raw: unknown, operator: string): string | string[] | undefined {
|
||||
if (raw === undefined || raw === null) return undefined
|
||||
const text = (Array.isArray(raw) ? raw.join(',') : String(raw)).trim()
|
||||
if (!text) return undefined
|
||||
if (['contains', 'in', 'notin'].includes(operator)) {
|
||||
const values = text
|
||||
.split(',')
|
||||
.map((v) => v.trim())
|
||||
.filter(Boolean)
|
||||
return values.length ? values : undefined
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
/** 有输入即透传:纯数字转 number,其余按字符串传递(避免被过滤成空) */
|
||||
function toIdFilterValue(value: unknown): number | string | undefined {
|
||||
if (value === undefined || value === null) return undefined
|
||||
@ -712,6 +742,18 @@ async function loadData() {
|
||||
const reviewUserId = toIdFilterValue(resolveScanFilterValue(flat, ['review_user_id', 'recheck_user_id'], rawConditions))
|
||||
const cartId = toIdFilterValue(resolveScanFilterValue(flat, ['cart_id', 'pick_car_id'], rawConditions))
|
||||
const startRange = Array.isArray(flat.start_time_range) ? flat.start_time_range : []
|
||||
const operatorNameOp = resolveScanConditionOperator(rawConditions, 'operator_name')
|
||||
const pickUserNameOp = resolveScanConditionOperator(rawConditions, 'pick_user_name')
|
||||
const claimOperatorNameOp = resolveScanConditionOperator(rawConditions, 'claim_operator')
|
||||
const reviewUserNameOp = resolveScanConditionOperator(rawConditions, 'review_user_name')
|
||||
const waveNoOp = resolveScanConditionOperator(rawConditions, 'wave_no')
|
||||
/** 人员名称筛选:操作人 / 拣货人 / 领料人 / 复核人;操作符交由后端处理;contains/in/notin 的 value 与全站列表页一致以数组下发(单值也包成数组),其余为字符串 */
|
||||
const operatorName = toWhereTextValue(resolveScanFilterValue(flat, ['operator_name', 'creator_name', 'creator'], rawConditions), operatorNameOp)
|
||||
const pickUserName = toWhereTextValue(resolveScanFilterValue(flat, ['pick_user_name', 'picker_name'], rawConditions), pickUserNameOp)
|
||||
const claimOperatorName = toWhereTextValue(resolveScanFilterValue(flat, ['claim_operator', 'claim_operator_name'], rawConditions), claimOperatorNameOp)
|
||||
const reviewUserName = toWhereTextValue(resolveScanFilterValue(flat, ['review_user_name', 'recheck_user_name'], rawConditions), reviewUserNameOp)
|
||||
/** 波次号:固定仅模糊查询(like),value 为字符串 */
|
||||
const waveNo = toWhereTextValue(resolveScanFilterValue(flat, ['wave_no'], rawConditions), waveNoOp)
|
||||
const res = await orderWaveWavePickTaskList({
|
||||
warehouse_id: wid,
|
||||
page_no: pagination.currentPage,
|
||||
@ -728,11 +770,16 @@ async function loadData() {
|
||||
keyword: String(flat.keyword || '').trim() || undefined,
|
||||
start_time_start: startRange[0] || undefined,
|
||||
start_time_end: startRange[1] || undefined,
|
||||
// 兼容接口历史 where 解析逻辑;顶层参数仍为主路径
|
||||
// 人员名称(操作人/拣货人/领料人/复核人)与关联波次号仅通过 where 传 { operator, value },由后端按 operator 决定匹配语义(默认模糊 like)
|
||||
where: {
|
||||
pick_user_id: pickUserId,
|
||||
review_user_id: reviewUserId,
|
||||
cart_id: cartId
|
||||
cart_id: cartId,
|
||||
operator_name: operatorName ? { operator: operatorNameOp, value: operatorName } : undefined,
|
||||
pick_user_name: pickUserName ? { operator: pickUserNameOp, value: pickUserName } : undefined,
|
||||
review_user_name: reviewUserName ? { operator: reviewUserNameOp, value: reviewUserName } : undefined,
|
||||
claim_operator: claimOperatorName ? { operator: claimOperatorNameOp, value: claimOperatorName } : undefined,
|
||||
wave_no: waveNo ? { operator: waveNoOp, value: waveNo } : undefined
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -1045,6 +1045,13 @@ export const pickTaskStatusFilterOptions = [
|
||||
export const pickTaskWaveAvailableFields = [
|
||||
// ===== 任务信息 =====
|
||||
pickTaskScanBasicField({ label: '任务编号', value: 'task_no', type: 'text' }),
|
||||
// 波次号:固定仅模糊查询(like,隐藏操作符下拉)
|
||||
pickTaskScanBasicField({ label: '波次号', value: 'wave_no', type: 'text', hideOperator: true, operators: ['like'], defaultOperator: 'like' }),
|
||||
// 人员名字按模糊/包含搜索:左侧操作符下拉可选「模糊匹配/包含/模糊排除」,默认「模糊匹配」
|
||||
pickTaskScanBasicField({ label: '操作人', value: 'operator_name', type: 'text', operators: ['like', 'contains', 'notlike'], defaultOperator: 'like' }),
|
||||
pickTaskScanBasicField({ label: '拣货人', value: 'pick_user_name', type: 'text', operators: ['like', 'contains', 'notlike'], defaultOperator: 'like' }),
|
||||
pickTaskScanBasicField({ label: '领料人', value: 'claim_operator', type: 'text', operators: ['like', 'contains', 'notlike'], defaultOperator: 'like' }),
|
||||
pickTaskScanBasicField({ label: '复核人', value: 'review_user_name', type: 'text', operators: ['like', 'contains', 'notlike'], defaultOperator: 'like' }),
|
||||
pickTaskScanBasicField({ label: '开始时间', value: 'start_time_range', type: 'daterange' }),
|
||||
|
||||
// ===== 流程状态(合并为一组,对齐波次列表 ScanBox) =====
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user