feat(consignment): 寄售仓库新增对接客服多选筛选
This commit is contained in:
@@ -391,6 +391,24 @@ export function mapConsignmentSubmission(row: ConsignmentSubmissionRow) {
|
||||
}
|
||||
}
|
||||
|
||||
/** 对接客服多选:兼容逗号字符串与数组,过滤 0/重复/非法 id。 */
|
||||
function normalizeContactSupporterIds(value: unknown): number[] | undefined {
|
||||
const source = Array.isArray(value) ? value : String(value ?? '').split(',')
|
||||
const ids = Array.from(
|
||||
new Set(source.map((item) => Number(item)).filter((id) => Number.isInteger(id) && id > 0)),
|
||||
)
|
||||
return ids.length > 0 ? ids : undefined
|
||||
}
|
||||
|
||||
function readQueryBoolean(value: unknown): boolean {
|
||||
return (
|
||||
value === true ||
|
||||
String(value ?? '')
|
||||
.trim()
|
||||
.toLowerCase() === 'true'
|
||||
)
|
||||
}
|
||||
|
||||
export async function fetchAdminConsignmentInventories(query: JsonObject = {}) {
|
||||
const status = query.status ? String(query.status).trim() : undefined
|
||||
const buyerName = query.buyerName ? String(query.buyerName).trim() : undefined
|
||||
@@ -405,6 +423,8 @@ export async function fetchAdminConsignmentInventories(query: JsonObject = {}) {
|
||||
const diamondLevel = query.diamondLevel !== undefined ? Number(query.diamondLevel) : undefined
|
||||
const allowMatching =
|
||||
query.allowMatching !== undefined ? String(query.allowMatching) === 'true' : undefined
|
||||
const contactSupporterIds = normalizeContactSupporterIds(query.contactSupporterIds)
|
||||
const includeUnassignedContactSupporter = readQueryBoolean(query.contactSupporterUnassigned)
|
||||
const keyword = query.keyword ? String(query.keyword).trim() : undefined
|
||||
const dateFrom = normalizeInventoryDate(query.dateFrom)
|
||||
const dateTo = normalizeInventoryDate(query.dateTo)
|
||||
@@ -423,6 +443,8 @@ export async function fetchAdminConsignmentInventories(query: JsonObject = {}) {
|
||||
series,
|
||||
diamondLevel,
|
||||
allowMatching,
|
||||
contactSupporterIds,
|
||||
includeUnassignedContactSupporter,
|
||||
specFilters,
|
||||
keyword,
|
||||
dateFrom,
|
||||
|
||||
Reference in New Issue
Block a user