fix(web-admin): 隐藏生产/质检中试服务 Tab 并从「所有」排除 (#160)
客户已下线中试业务:侧栏不再展示中试 Tab,前端在「所有」列表过滤出库中试数据(含 bizType 缺省)。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
85fe63fa9f
commit
8349b0ce73
8 files changed
+115
-18
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
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
})
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user