From 01946dde8ec831d8a0bcac5d6c2d9d586b4c1c27 Mon Sep 17 00:00:00 2001 From: zlwu Date: Fri, 4 Sep 2026 17:34:34 +0800 Subject: [PATCH] feat(web-admin): add arranged tab to transport plan list filters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Insert「已安排」after「待安排」in PL_PLAN_LIST_TABS and map it to followStatus=arranged. Co-authored-by: Cursor --- web-admin/src/utils/pl-display.ts | 12 +++-- web-admin/src/utils/pl-plan-list-tabs.test.ts | 53 +++++++++++++++++++ 2 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 web-admin/src/utils/pl-plan-list-tabs.test.ts diff --git a/web-admin/src/utils/pl-display.ts b/web-admin/src/utils/pl-display.ts index 52fc01a0a..b09f8e248 100644 --- a/web-admin/src/utils/pl-display.ts +++ b/web-admin/src/utils/pl-display.ts @@ -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' } } diff --git a/web-admin/src/utils/pl-plan-list-tabs.test.ts b/web-admin/src/utils/pl-plan-list-tabs.test.ts new file mode 100644 index 000000000..9cbea9860 --- /dev/null +++ b/web-admin/src/utils/pl-plan-list-tabs.test.ts @@ -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' }) + }) +})