fix(qc): 科研捐赠协议状态空选不限制,mine 请求带上过滤
空协议状态改为不限制而非无结果,避免搜索像失效;我的质检任务 mine 接口与前端请求补传 protocolStatus,与质检工单列表语义对齐。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
95b07639e8
commit
2bc20e695f
10 files changed
+36
-21
No files matched your search
@@ -170,6 +170,8 @@ export function fetchMyQcTaskList(params?: {
|
||||
qcBizType?: string
|
||||
receptionSource?: string
|
||||
bizType?: string
|
||||
/** 科研捐赠:协议/捐赠状态,多个逗号分隔;空串=不限制 */
|
||||
protocolStatus?: string
|
||||
}) {
|
||||
return request.get<PageList<QcTask>>({
|
||||
url: '/web/admin/qc-tasks/mine',
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('donation protocol status filter helpers', () => {
|
||||
|
||||
it('matchesProtocolStatusFilter semantics', () => {
|
||||
assert.equal(matchesProtocolStatusFilter('yzf', undefined), true)
|
||||
assert.equal(matchesProtocolStatusFilter('yzf', []), false)
|
||||
assert.equal(matchesProtocolStatusFilter('yzf', []), true)
|
||||
assert.equal(matchesProtocolStatusFilter('sxz', ['dsx', 'sxz']), true)
|
||||
assert.equal(matchesProtocolStatusFilter('yzf', ['dsx', 'sxz']), false)
|
||||
assert.equal(matchesProtocolStatusFilter('', ['dsx']), false)
|
||||
|
||||
@@ -18,7 +18,7 @@ export const DEFAULT_DONATION_PROTOCOL_STATUS_FILTER = ['dsx', 'sxz']
|
||||
/**
|
||||
* 拼协议状态查询参数。
|
||||
* - 有选中:逗号串
|
||||
* - 空数组:返回 ''(显式空;勿当 undefined)
|
||||
* - 空数组:返回 ''(显式空=不限制;勿当 undefined,undefined 会走后端默认勾选)
|
||||
*/
|
||||
export function joinProtocolStatusFilter(statuses: string[]): string {
|
||||
return statuses.map((s) => s.trim()).filter(Boolean).join(',')
|
||||
@@ -27,13 +27,12 @@ export function joinProtocolStatusFilter(statuses: string[]): string {
|
||||
/**
|
||||
* 协议状态是否命中筛选。
|
||||
* - filter === undefined:不限制
|
||||
* - filter 为空数组:无匹配
|
||||
* - filter 为空数组:不限制(显式清空)
|
||||
*/
|
||||
export function matchesProtocolStatusFilter(
|
||||
status: string,
|
||||
filter: string[] | undefined
|
||||
): boolean {
|
||||
if (filter === undefined) return true
|
||||
if (!filter.length) return false
|
||||
if (filter === undefined || !filter.length) return true
|
||||
return filter.includes((status || '').trim())
|
||||
}
|
||||
@@ -27,13 +27,15 @@ export type QcTaskMineFilters = {
|
||||
keyword?: string
|
||||
taskType?: string
|
||||
taskStatus?: string
|
||||
/** 科研捐赠:协议状态逗号串;''=不限制;缺省不传 */
|
||||
protocolStatus?: string
|
||||
tabKey: QcWorkOrderTabKey
|
||||
}
|
||||
|
||||
export type MineWorkOrderSearchFilters = {
|
||||
keyword?: string
|
||||
workOrderStatus?: string | string[]
|
||||
/** 科研捐赠 Tab:协议/捐赠状态多选;undefined=不限制;[]=无匹配 */
|
||||
/** 科研捐赠 Tab:协议/捐赠状态多选;undefined/[]=不限制 */
|
||||
protocolStatus?: string[]
|
||||
triggerSource?: string
|
||||
qcCategory?: string
|
||||
@@ -145,6 +147,8 @@ export async function fetchAllMineTasks(filters: QcTaskMineFilters): Promise<QcT
|
||||
let page = 1
|
||||
const all: QcTask[] = []
|
||||
let total = 0
|
||||
const protocolStatusParam =
|
||||
filters.tabKey === 'inbound_research_donation' ? (filters.protocolStatus ?? '') : undefined
|
||||
while (true) {
|
||||
const res = await fetchMyQcTaskList({
|
||||
page,
|
||||
@@ -154,7 +158,8 @@ export async function fetchAllMineTasks(filters: QcTaskMineFilters): Promise<QcT
|
||||
taskStatus: filters.taskStatus || undefined,
|
||||
qcBizType: listQuery.workOrderType,
|
||||
receptionSource: listQuery.receptionSource,
|
||||
bizType: listQuery.bizType
|
||||
bizType: listQuery.bizType,
|
||||
...(protocolStatusParam !== undefined ? { protocolStatus: protocolStatusParam } : {})
|
||||
})
|
||||
const list = res.list || []
|
||||
all.push(...list)
|
||||
|
||||
+4
-6
@@ -153,6 +153,10 @@ export function useQcWorkOrderTabPage(
|
||||
keyword: searchForm.keyword || undefined,
|
||||
taskStatus: searchForm.taskStatus || undefined,
|
||||
taskType: searchForm.taskType || undefined,
|
||||
protocolStatus:
|
||||
tabKey.value === 'inbound_research_donation'
|
||||
? joinProtocolStatusFilter(searchForm.protocolStatus)
|
||||
: undefined,
|
||||
tabKey: tabKey.value
|
||||
})
|
||||
let entries = groupMineTasksByWorkOrder(tasks)
|
||||
@@ -172,12 +176,6 @@ export function useQcWorkOrderTabPage(
|
||||
}
|
||||
|
||||
const tab = tabConfig.value
|
||||
if (tabKey.value === 'inbound_research_donation' && !searchForm.protocolStatus.length) {
|
||||
tableData.value = []
|
||||
presetBatchesByWorkOrderId.value = undefined
|
||||
pagination.total = 0
|
||||
return
|
||||
}
|
||||
const timeParams =
|
||||
isAllQcWorkOrderTab(tabKey.value) || !tabUsesInfusionTimeFilter(tab)
|
||||
? {
|
||||
|
||||
Reference in new issue
Block a user