feat(web-admin): add arranged tab to transport plan list filters
Insert「已安排」after「待安排」in PL_PLAN_LIST_TABS and map it to followStatus=arranged. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
87374f3976
commit
01946dde8e
2 files changed
+61
-4
No files matched your search
@@ -352,8 +352,8 @@ export function canPrintSlipCommand(
|
||||
|
||||
export type PlPlanTypeTab = 'all' | 'inbound' | 'outbound' | 'direct'
|
||||
|
||||
/** 运输计划列表 Tab(单据类型前增加「待安排」「草稿中」) */
|
||||
export type PlPlanListTab = PlPlanTypeTab | 'pending_arrange' | 'drafting'
|
||||
/** 运输计划列表 Tab(单据类型前增加「待安排」「已安排」「草稿中」) */
|
||||
export type PlPlanListTab = PlPlanTypeTab | 'pending_arrange' | 'arranged' | 'drafting'
|
||||
|
||||
/** 危化品证上传页 Tab(在单据类型后增加「未上传证书」) */
|
||||
export type PlPlanCertTab = PlPlanTypeTab | 'cert_incomplete'
|
||||
@@ -367,6 +367,7 @@ export const PL_PLAN_TYPE_TABS: { label: string; name: PlPlanTypeTab }[] = [
|
||||
|
||||
export const PL_PLAN_LIST_TABS: { label: string; name: PlPlanListTab }[] = [
|
||||
{ label: '待安排', name: 'pending_arrange' },
|
||||
{ label: '已安排', name: 'arranged' },
|
||||
{ label: '草稿中', name: 'drafting' },
|
||||
...PL_PLAN_TYPE_TABS
|
||||
]
|
||||
@@ -378,8 +379,8 @@ export const PL_PLAN_CERT_TABS: { label: string; name: PlPlanCertTab }[] = [
|
||||
|
||||
export function isPlPlanFollowStatusListTab(
|
||||
tab: PlPlanListTab | string
|
||||
): tab is 'pending_arrange' | 'drafting' {
|
||||
return tab === 'pending_arrange' || tab === 'drafting'
|
||||
): tab is 'pending_arrange' | 'arranged' | 'drafting' {
|
||||
return tab === 'pending_arrange' || tab === 'arranged' || tab === 'drafting'
|
||||
}
|
||||
|
||||
export function plPlanTypeTabToFilter(tab: PlPlanTypeTab): string {
|
||||
@@ -393,6 +394,9 @@ export function plPlanListTabToFilters(tab: PlPlanListTab): {
|
||||
if (tab === 'pending_arrange') {
|
||||
return { planType: '', followStatus: 'pending_arrange' }
|
||||
}
|
||||
if (tab === 'arranged') {
|
||||
return { planType: '', followStatus: 'arranged' }
|
||||
}
|
||||
if (tab === 'drafting') {
|
||||
return { planType: '', followStatus: 'drafting' }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { describe, it } from 'node:test'
|
||||
import {
|
||||
PL_PLAN_LIST_TABS,
|
||||
isPlPlanFollowStatusListTab,
|
||||
plPlanListTabToFilters
|
||||
} from './pl-display'
|
||||
|
||||
describe('PL_PLAN_LIST_TABS', () => {
|
||||
it('places arranged immediately after pending_arrange', () => {
|
||||
const names = PL_PLAN_LIST_TABS.map((t) => t.name)
|
||||
assert.deepEqual(names.slice(0, 3), ['pending_arrange', 'arranged', 'drafting'])
|
||||
assert.equal(
|
||||
PL_PLAN_LIST_TABS.find((t) => t.name === 'arranged')?.label,
|
||||
'已安排'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('isPlPlanFollowStatusListTab', () => {
|
||||
it('recognizes pending_arrange, arranged, drafting', () => {
|
||||
assert.equal(isPlPlanFollowStatusListTab('pending_arrange'), true)
|
||||
assert.equal(isPlPlanFollowStatusListTab('arranged'), true)
|
||||
assert.equal(isPlPlanFollowStatusListTab('drafting'), true)
|
||||
assert.equal(isPlPlanFollowStatusListTab('all'), false)
|
||||
assert.equal(isPlPlanFollowStatusListTab('inbound'), false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('plPlanListTabToFilters', () => {
|
||||
it('maps arranged to followStatus arranged with empty planType', () => {
|
||||
assert.deepEqual(plPlanListTabToFilters('arranged'), {
|
||||
planType: '',
|
||||
followStatus: 'arranged'
|
||||
})
|
||||
})
|
||||
|
||||
it('keeps pending_arrange and drafting behavior', () => {
|
||||
assert.deepEqual(plPlanListTabToFilters('pending_arrange'), {
|
||||
planType: '',
|
||||
followStatus: 'pending_arrange'
|
||||
})
|
||||
assert.deepEqual(plPlanListTabToFilters('drafting'), {
|
||||
planType: '',
|
||||
followStatus: 'drafting'
|
||||
})
|
||||
})
|
||||
|
||||
it('maps type tabs without followStatus', () => {
|
||||
assert.deepEqual(plPlanListTabToFilters('all'), { planType: '' })
|
||||
assert.deepEqual(plPlanListTabToFilters('inbound'), { planType: 'inbound' })
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user