Compare commits

...
Author SHA1 Message Date
zlwuandCursor 8349b0ce73 fix(web-admin): 隐藏生产/质检中试服务 Tab 并从「所有」排除 (#160)
客户已下线中试业务:侧栏不再展示中试 Tab,前端在「所有」列表过滤出库中试数据(含 bizType 缺省)。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-20 14:48:58 +08:00
cykj 85fe63fa9f fix(web-admin): 下线市场侧栏中试服务菜单 (#158)
fix(web-admin): 下线市场侧栏中试服务菜单 (#158)

Merge pull request #159
2026-11-20 06:35:05 +00:00
8 changed files with 115 additions and 18 deletions

No files matched your search

@@ -6,7 +6,8 @@ import {
resolveTabKeyFromWorkOrder,
getProductionWorkOrderTab,
toWorkOrderListQuery,
isAllProductionWorkOrderTab
isAllProductionWorkOrderTab,
workOrderMatchesTab
} from '@/utils/production-work-order-tabs'
import { toAllTabListQuery, workOrderMatchesCategory } from '@/utils/production-work-order-category'
import { matchesWorkOrderStatusFilter } from '@/utils/status-tag-registry'
@@ -231,9 +232,7 @@ export function filterMineEntriesByWorkOrderSearch(
const tabKey = filters.tabKey
return entries.filter((entry) => {
const row = entry.workOrder
if (!isAllProductionWorkOrderTab(tabKey) && resolveTabKeyFromWorkOrder(row) !== tabKey) {
return false
}
if (!workOrderMatchesTab(row, tabKey)) return false
if (
isAllProductionWorkOrderTab(tabKey) &&
!workOrderMatchesCategory(row, filters.productionCategory || '')
@@ -0,0 +1,32 @@
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import {
PRODUCTION_WORK_ORDER_VISIBLE_TABS,
parseProductionWorkOrderTabKey,
workOrderMatchesTab,
isPilotServiceOutboundWorkOrder
} from './production-work-order-tabs'
import { PRODUCTION_WORK_ORDER_CATEGORY_OPTIONS } from './production-work-order-category'
describe('production work order tabs — hide pilot service', () => {
it('visible tabs exclude outbound_pilot_service', () => {
assert.ok(!PRODUCTION_WORK_ORDER_VISIBLE_TABS.some((t) => t.key === 'outbound_pilot_service'))
assert.ok(!PRODUCTION_WORK_ORDER_CATEGORY_OPTIONS.some((o) => o.key === 'outbound_pilot_service'))
})
it('parse: hidden pilot key and outbound alias fall back safely', () => {
assert.equal(parseProductionWorkOrderTabKey('outbound_pilot_service'), 'all')
assert.equal(parseProductionWorkOrderTabKey('outbound'), 'outbound_basic_experiment')
})
it('「所有」excludes pilot outbound (incl. default bizType)', () => {
const pilot = { workOrderType: 'outbound', bizType: 'pilot_service' }
const defaultPilot = { workOrderType: 'outbound' }
const basic = { workOrderType: 'outbound', bizType: 'basic_experiment' }
assert.equal(isPilotServiceOutboundWorkOrder(pilot), true)
assert.equal(isPilotServiceOutboundWorkOrder(defaultPilot), true)
assert.equal(workOrderMatchesTab(pilot as any, 'all'), false)
assert.equal(workOrderMatchesTab(defaultPilot as any, 'all'), false)
assert.equal(workOrderMatchesTab(basic as any, 'all'), true)
})
})
@@ -53,7 +53,9 @@ export const PRODUCTION_WORK_ORDER_TABS: ProductionWorkOrderTabConfig[] = [
group: 'outbound',
workOrderType: 'outbound',
bizType: 'pilot_service',
listLayout: 'standalone'
listLayout: 'standalone',
/** 客户已下线中试业务:侧栏不展示,路由 key 保留供历史解析 */
hidden: true
},
{
key: 'outbound_basic_experiment',
@@ -97,7 +99,7 @@ export function parseProductionWorkOrderTabKey(raw?: string | null): ProductionW
const tab = getProductionWorkOrderTab(k)
if (tab && !tab.hidden) return tab.key
if (k === 'inbound') return 'inbound_cell_storage'
if (k === 'outbound') return 'outbound_pilot_service'
if (k === 'outbound') return 'outbound_basic_experiment'
if (k === 'temporary') return 'temporary'
return DEFAULT_PRODUCTION_WORK_ORDER_TAB
}
@@ -145,11 +147,19 @@ export function keywordPlaceholderForTab(tab: ProductionWorkOrderTabConfig): str
return '工单号/样本编码/入库编码'
}
/** 出库中试服务(含 bizType 缺省落成中试) */
export function isPilotServiceOutboundWorkOrder(row: {
workOrderType?: string
bizType?: string
}): boolean {
return resolveTabKeyFromWorkOrder(row) === 'outbound_pilot_service'
}
export function workOrderMatchesTab(
row: ProductionWorkOrderItem,
tabKey: ProductionWorkOrderTabKey
): boolean {
if (tabKey === 'all') return true
if (tabKey === 'all') return !isPilotServiceOutboundWorkOrder(row)
return resolveTabKeyFromWorkOrder(row) === tabKey
}
+3 -4
View File
@@ -10,7 +10,8 @@ import {
tabUsesInfusionTimeFilter,
getQcWorkOrderTab,
toWorkOrderListQuery,
isAllQcWorkOrderTab
isAllQcWorkOrderTab,
workOrderMatchesTab
} from '@/utils/qc-work-order-tabs'
import {
matchesAllTabTriggerSource,
@@ -101,9 +102,7 @@ export function filterMineEntriesByWorkOrderSearch(
const tab = getQcWorkOrderTab(tabKey)!
return entries.filter((entry) => {
const row = entry.workOrder
if (!isAllQcWorkOrderTab(tabKey) && resolveTabKeyFromWorkOrder(row) !== tabKey) {
return false
}
if (!workOrderMatchesTab(row, tabKey)) return false
if (isAllQcWorkOrderTab(tabKey) && !workOrderMatchesCategory(row, filters.qcCategory || '')) {
return false
}
@@ -0,0 +1,33 @@
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import {
QC_WORK_ORDER_VISIBLE_TABS,
parseQcWorkOrderTabKey,
workOrderMatchesTab,
isPilotServiceOutboundWorkOrder
} from './qc-work-order-tabs'
import { QC_WORK_ORDER_CATEGORY_OPTIONS } from './qc-work-order-category'
describe('qc work order tabs — hide pilot service', () => {
it('visible tabs exclude outbound_pilot_service', () => {
assert.ok(!QC_WORK_ORDER_VISIBLE_TABS.some((t) => t.key === 'outbound_pilot_service'))
assert.ok(!QC_WORK_ORDER_CATEGORY_OPTIONS.some((o) => o.key === 'outbound_pilot_service'))
})
it('parse: hidden pilot key and outbound alias fall back safely', () => {
// 质检默认 Tab 为细胞存储(「所有」本身也是 hidden)
assert.equal(parseQcWorkOrderTabKey('outbound_pilot_service'), 'inbound_cell_storage')
assert.equal(parseQcWorkOrderTabKey('outbound'), 'outbound_basic_experiment')
})
it('「所有」excludes pilot outbound (incl. default bizType)', () => {
const pilot = { workOrderType: 'outbound', bizType: 'pilot_service' }
const defaultPilot = { workOrderType: 'outbound' }
const basic = { workOrderType: 'outbound', bizType: 'basic_experiment' }
assert.equal(isPilotServiceOutboundWorkOrder(pilot), true)
assert.equal(isPilotServiceOutboundWorkOrder(defaultPilot), true)
assert.equal(workOrderMatchesTab(pilot as any, 'all'), false)
assert.equal(workOrderMatchesTab(defaultPilot as any, 'all'), false)
assert.equal(workOrderMatchesTab(basic as any, 'all'), true)
})
})
+13 -3
View File
@@ -53,7 +53,9 @@ export const QC_WORK_ORDER_TABS: QcWorkOrderTabConfig[] = [
group: 'outbound',
workOrderType: 'outbound',
bizType: 'pilot_service',
listLayout: 'outbound-grouped'
listLayout: 'outbound-grouped',
/** 客户已下线中试业务:侧栏不展示,路由 key 保留供历史解析 */
hidden: true
},
{
key: 'outbound_basic_experiment',
@@ -95,7 +97,7 @@ export function parseQcWorkOrderTabKey(raw?: string | null): QcWorkOrderTabKey {
const tab = getQcWorkOrderTab(k)
if (tab && !tab.hidden) return tab.key
if (k === 'inbound') return 'inbound_cell_storage'
if (k === 'outbound') return 'outbound_pilot_service'
if (k === 'outbound') return 'outbound_basic_experiment'
if (k === 'temporary') return 'temporary'
return DEFAULT_QC_WORK_ORDER_TAB
}
@@ -160,8 +162,16 @@ export function filterTimeLabelForTab(tab: QcWorkOrderTabConfig): string {
return '创建时间'
}
/** 出库中试服务(含 bizType 缺省落成中试) */
export function isPilotServiceOutboundWorkOrder(row: {
workOrderType?: string
bizType?: string
}): boolean {
return resolveTabKeyFromWorkOrder(row) === 'outbound_pilot_service'
}
export function workOrderMatchesTab(row: QcWorkOrder, tabKey: QcWorkOrderTabKey): boolean {
if (tabKey === 'all') return true
if (tabKey === 'all') return !isPilotServiceOutboundWorkOrder(row)
return resolveTabKeyFromWorkOrder(row) === tabKey
}
@@ -22,6 +22,7 @@ import {
isAllProductionWorkOrderTab,
tabSupportsInactiveProtocolFilter,
resolveTabKeyFromWorkOrder,
workOrderMatchesTab,
type ProductionWorkOrderTabKey
} from '@/utils/production-work-order-tabs'
import { toAllTabListQuery } from '@/utils/production-work-order-category'
@@ -164,8 +165,16 @@ export function useProductionWorkOrderTabPage(
...listQuery,
...buildPlannedStartTimeParams()
})
tableData.value = res.list || []
pagination.total = res.total ?? 0
const rawList = res.list || []
const list = isAllProductionWorkOrderTab(tabKey.value)
? rawList.filter((row) => workOrderMatchesTab(row, 'all'))
: rawList
tableData.value = list
// 「所有」前端排除中试时,按本页剔除量修正 total(后端未改)
pagination.total = Math.max(
0,
(res.total ?? 0) - (rawList.length - list.length)
)
selectedRows.value = selectedRows.value.filter((row) =>
tableData.value.some((item) => item.id === row.id)
)
@@ -20,6 +20,7 @@ import {
isAllQcWorkOrderTab,
isInboundSampleQcTab,
resolveTabKeyFromWorkOrder,
workOrderMatchesTab,
type QcWorkOrderTabKey
} from '@/utils/qc-work-order-tabs'
import { toAllTabListQuery } from '@/utils/qc-work-order-category'
@@ -210,7 +211,10 @@ export function useQcWorkOrderTabPage(
...listQuery,
...timeParams
})
const list = res.list || []
const rawList = res.list || []
const list = isAllQcWorkOrderTab(tabKey.value)
? rawList.filter((row) => workOrderMatchesTab(row, 'all'))
: rawList
const ids = list.map((row) => row.id).filter(Boolean)
const batchMap = ids.length
? (await fetchQcInspectionBatchesBatch(ids).catch(() => ({}))) || {}
@@ -218,7 +222,8 @@ export function useQcWorkOrderTabPage(
// 先写入批次摘要,再渲染卡片,避免子组件在 preset 未就绪时逐条请求 inspection-batches
presetBatchesByWorkOrderId.value = batchMap
tableData.value = list
pagination.total = res.total ?? 0
// 「所有」前端排除中试时,按本页剔除量修正 total(后端未改)
pagination.total = Math.max(0, (res.total ?? 0) - (rawList.length - list.length))
} finally {
loading.value = false
}