@@ -128,7 +128,7 @@ function AnalysisDialog({ selection, subject, close }: Props & { selection: Vehi
extra : view === 'inventory' ? { 待交车 : row.totals.pending , 异动 : row.totals.abnormal } : undefined } ) ) ,
showDetails ? rows.length : analysis.total ,
) ;
await downloadAnalysisWorkbook ( statistics , vehicleExportRows ( rows ) , ` ${ title } - ${ scopeLabel } ${ detailGroup ? ` - ${ detailGroup . label } ` : '' } ` ) ;
await downloadAnalysisWorkbook ( statistics , vehicleExportRows ( rows , view === 'inventory' ) , ` ${ title } - ${ scopeLabel } ${ detailGroup ? ` - ${ detailGroup . label } ` : '' } ` ) ;
} ;
return < div className = "asset-analysis-overlay" >
< div ref = { dialog } role = "dialog" aria-modal = "true" aria-label = { title } tabIndex = { - 1 } className = { ` asset-analysis-dialog ${ view === 'abnormal' ? 'analysis-amber' : '' } ` } >
@@ -164,7 +164,7 @@ function AnalysisDialog({ selection, subject, close }: Props & { selection: Vehi
< div className = "analysis-table-tools" > < h3 > 车 辆 明 细 < small > { number ( visibleVehicles . length ) } 台 < / small > < / h3 > < AnalysisExportButton disabled = { detailBusy || ! ! detailError || ! visibleVehicles . length } onExport = { exportWorkbook } / > < label className = "analysis-search" > < Search size = { 15 } / > < input aria-label = "搜索车辆明细" placeholder = "搜索车牌、VIN、型号、城市" value = { search } onChange = { event = > { setSearch ( event . target . value ) ; } } / > < / label > < / div >
{ detailBusy ? < div className = "analysis-message" role = "status" > < Loader2 className = "animate-spin" / > 正 在 加 载 车 辆 明 细 … < / div > : detailError ? < div className = "analysis-message" role = "alert" > < p > { detailError } < / p > < button className = "analysis-button" onClick = { ( ) = > setDetailRetry ( detailRetry + 1 ) } > 重 新 加 载 明 细 < / button > < / div > : < >
{ vehicles . length !== detailGroup . count && < p className = "analysis-definition" > 车 辆 状 态 可 能 已 更 新 : 统 计 快 照 { detailGroup . count } 台 , 当 前 明 细 { vehicles . length } 台 。 < / p > }
{ ( view === 'abnormal' || detailGroup . values . inventoryState === 'abnormal' || ( filterValues . inventoryState ? . length === 1 && filterValues . inventoryState [ 0 ] === 'abnormal' ) ) ? < AbnormalVehicleDetails vehicles = { shownVehicles } / > : ( view === 'pending' || detailGroup . values . inventoryState === 'pending' || ( filterValues . inventoryState ? . length === 1 && filterValues . inventoryState [ 0 ] === 'pending' ) ) ? < PendingVehicleDetails vehicles = { shownVehicles } / > : < VehicleRows vehicles = { shownVehicles } / > }
{ ( view === 'abnormal' || detailGroup . values . inventoryState === 'abnormal' || ( filterValues . inventoryState ? . length === 1 && filterValues . inventoryState [ 0 ] === 'abnormal' ) ) ? < AbnormalVehicleDetails vehicles = { shownVehicles } / > : ( view === 'pending' || detailGroup . values . inventoryState === 'pending' || ( filterValues . inventoryState ? . length === 1 && filterValues . inventoryState [ 0 ] === 'pending' ) ) ? < PendingVehicleDetails vehicles = { shownVehicles } / > : < VehicleRows vehicles = { shownVehicles } inventory = { view === 'inventory' } / > }
< ProgressiveRowsStatus { ...detailProgress } unit = "台" / >
< / > }
< / div > }
@@ -175,14 +175,14 @@ function AnalysisDialog({ selection, subject, close }: Props & { selection: Vehi
< / div > ;
}
function VehicleRows ( { vehicles } : { vehicles : VehicleListItem [ ] } ) {
function VehicleRows ( { vehicles , inventory = false } : { vehicles : VehicleListItem [ ] ; inventory? : boolean } ) {
if ( ! vehicles . length ) return < div className = "analysis-message" > 暂 无 匹 配 车 辆 < / div > ;
const stateLabel = ( vehicle : VehicleListItem ) = > {
const operation = ( { '1' : '租赁' , '2' : '自营' , '3' : '可运营' , '4' : '待运营' } as Record < string , string > ) [ vehicle . operationStatus || '' ] || vehicle . operationStatus ;
const business = ( { Abnormal : '异动' , Pending : '待交车' , Inventory : '在库' , Operating : '运营中' } as Record < string , string > ) [ vehicle . status ] || vehicle . status ;
return [ business , operation ] . filter ( Boolean ) . join ( ' · ' ) ;
} ;
return < div className = "analysis-detail-table" tabIndex = { 0 } role = "region" aria-label = "车辆明细表" > < table > < thead > < tr > { [ '车牌 / VIN' , '品牌 / 车型 / 型号' , '省份 / 城市' , '状态' , '客户 / 签约公司' , '部门 / 业务负责人' , '所属公司' ] . map ( label = > < th key = { label } > { label } < / th > ) } < / tr > < / thead > < tbody > { vehicles . map ( vehicle = > < tr key = { vehicle . id } > < td > < Blur > { vehicle . plateNumber || vehicle . vin || '未提供' } < / Blur > < / td > < td > { vehicle . brandLabel || '—' } · { vehicle . type } < small > { vehicle . model } < / small > < / td > < td > { vehicle . province || '未标注' } / { vehicle . city || vehicle . location || '未标注' } < / td > < td > { stateLabel ( vehicle ) } < / td > < td > < Blur > { vehicle . customerName || '—' } < / Blur > < small > < Blur > { vehicle . orgName || '—' } < / Blur > < / small > < / td > < td > < Blur > { vehicle . departmentName || '—' } < / Blur > < small > < Blur > { vehicle . customerManager || '—' } < / Blur > < / small > < / td > < td > { vehicle . subjectOrg || '—' } < / td > < / tr > ) } < / tbody > < / table > < / div > ;
return < div className = "analysis-detail-table" tabIndex = { 0 } role = "region" aria-label = "车辆明细表" > < table > < thead > < tr > { [ '车牌 / VIN' , '品牌 / 车型 / 型号' , '省份 / 城市' , '状态' , . . . ( inventory ? [ '运维负责人' ] : [ '客户 / 签约公司' , '部门 / 业务负责人' ] ) , '所属公司' ] . map ( label = > < th key = { label } > { label } < / th > ) } < / tr > < / thead > < tbody > { vehicles . map ( vehicle = > < tr key = { vehicle . id } > < td > < Blur > { vehicle . plateNumber || vehicle . vin || '未提供' } < / Blur > < / td > < td > { vehicle . brandLabel || '—' } · { vehicle . type } < small > { vehicle . model } < / small > < / td > < td > { vehicle . province || '未标注' } / { vehicle . city || vehicle . location || '未标注' } < / td > < td > { stateLabel ( vehicle ) } < / td > { inventory ? < td > < Blur > { vehicle . opsManagers ? . trim ( ) || '-' } < / Blur > < / td > : < > < td > < Blur > { vehicle . customerName || '—' } < / Blur > < small > < Blur > { vehicle . orgName || '—' } < / Blur > < / small > < / td > < td > < Blur > { vehicle . departmentName || '—' } < / Blur > < small > < Blur > { vehicle . customerManager || '—' } < / Blur > < / small > < / td > < / > } < td > { vehicle . subjectOrg || '—' } < / td > < / tr > ) } < / tbody > < / table > < / div > ;
}
type WeeklyDimension = 'date' | 'contract_type' ;