The user wants a procurement demand planning interface with forecasts, contracts, and KPIs. This is a business dashboard type application.
Let me plan the features:
- Forecasts Section - Demand forecasting with charts showing predicted procurement needs
- Contracts Section - Contract management showing active, pending, expiring contracts
- KPIs Section - Key performance indicators for procurement
Design considerations:
- Professional business aesthetic - not generic
- Dark theme with sharp accents for a modern enterprise feel
- Use a distinctive font pairing
- Meaningful interactions: tabs, filters, hover states, maybe a chart interaction
- Motion: staggered reveals, smooth transitions
Color scheme:
- Dark sophisticated theme with cyan/teal accent
- Maybe use deep slate/charcoal backgrounds
- Accent color for important metrics and actions
Typography:
- Display font: "Space Grotesk" or "DM Sans" for headings
- UI font: "IBM Plex Sans" for body
Layout:
- Sidebar navigation
- Main content area with grid layout
- Cards for different sections
- Interactive chart area
- Data tables for contracts
Interactive elements:
- Time period selector for forecasts
- Category filter for contracts
- Animated chart bars/lines
- Hover effects on cards and rows
- Tab navigation
Let me build this step by step:
- HTML structure with semantic tags
- CSS variables for theming
- Grid layout
- Forecast chart (CSS-based or simple canvas)
- Contract list with status indicators
- KPI cards with animated counters
- Interactions with IntersectionObserver and click handlers
I'll create realistic procurement data:
- Forecasts by month/category
- Contract list with vendor names, values, expiry dates
- KPIs: Savings rate, On-time delivery, Supplier compliance, Cost avoidance
Let me code this properly with all the quality checks:
- Visual hierarchy ✓
- Responsive design ✓
- Meaningful interactions ✓
- Motion with staggered reveals ✓
- Polish and consistency ✓
- Accessibility ✓
- Reduced motion support ✓
采购需求计划系统界面
我将创建一个专业的采购需求规划界面,采用深色商务主题,包含预测图表、合同管理和KPI仪表盘。
设计思路:
- 配色:深灰背景配青色高亮,营造专业企业感
- 字体:Space Grotesk(标题)+ IBM Plex Sans(正文)
- 交互:时间段切换、分类筛选、图表悬停、行选择
- 动效:卡片渐入、数字滚动、进度条动画
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>采购需求规划系统</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=Space+Grotesk:wght@500;700&display=swap" rel="stylesheet">
<style>
:root {
--bg: #0f1419;
--bg-elevated: #1a1f26;
--bg-card: #232a33;
--fg: #e8eaed;
--fg-muted: #8b939e;
--accent: #00d4aa;
--accent-dim: rgba(0, 212, 170, 0.15);
--warning: #f5a623;
--warning-dim: rgba(245, 166, 35, 0.15);
--danger: #e74c3c;
--danger-dim: rgba(231, 76, 60, 0.15);
--border: #2d353f;
--chart-bar: #00d4aa;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'IBM Plex Sans', sans-serif;
background: var(--bg);
color: var(--fg);
min-height: 100vh;
overflow-x: hidden;
}
h1, h2, h3, h4 {
font-family: 'Space Grotesk', sans-serif;
}
/* Background pattern */
.bg-pattern {
position: fixed;
inset: 0;
background-image:
radial-gradient(circle at 20% 20%, rgba(0, 212, 170, 0.03) 0%, transparent 50%),
radial-gradient(circle at 80% 80%, rgba(0, 212, 170, 0.02) 0%, transparent 50%);
pointer-events: none;
z-index: 0;
}
.grid-overlay {
position: fixed;
inset: 0;
background-image:
linear-gradient(var(--border) 1px, transparent 1px),
linear-gradient(90deg, var(--border) 1px, transparent 1px);
background-size: 60px 60px;
opacity: 0.03;
pointer-events: none;
z-index: 0;
}
/* Scrollbar */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: var(--bg-elevated);
}
::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--fg-muted);
}
/* Sidebar */
.sidebar {
position: fixed;
left: 0;
top: 0;
bottom: 0;
width: 240px;
background: var(--bg-elevated);
border-right: 1px solid var(--border);
padding: 24px 16px;
z-index: 100;
display: flex;
flex-direction: column;
}
.logo {
display: flex;
align-items: center;
gap: 12px;
padding: 0 8px;
margin-bottom: 32px;
}
.logo-icon {
width: 36px;
height: 36px;
background: var(--accent);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
}
.logo-icon svg {
width: 20px;
height: 20px;
color: var(--bg);
}
.logo-text {
font-family: 'Space Grotesk', sans-serif;
font-size: 18px;
font-weight: 700;
color: var(--fg);
}
.nav-section {
margin-bottom: 24px;
}
.nav-label {
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--fg-muted);
padding: 0 12px;
margin-bottom: 8px;
}
.nav-item {
display: flex;
align-items: center;
gap: 12px;
padding: 12px;
border-radius: 8px;
color: var(--fg-muted);
cursor: pointer;
transition: all 0.2s ease;
font-size: 14px;
}
.nav-item:hover {
background: var(--bg-card);
color: var(--fg);
}
.nav-item.active {
background: var(--accent-dim);
color: var(--accent);
}
.nav-item svg {
width: 18px;
height: 18px;
flex-shrink: 0;
}
.nav-badge {
margin-left: auto;
background: var(--accent);
color: var(--bg);
font-size: 11px;
font-weight: 600;
padding: 2px 8px;
border-radius: 10px;
}
.sidebar-footer {
margin-top: auto;
padding: 16px;
background: var(--bg-card);
border-radius: 10px;
}
.user-info {
display: flex;
align-items: center;
gap: 12px;
}
.user-avatar {
width: 40px;
height: 40px;
border-radius: 10px;
background: linear-gradient(135deg, var(--accent), #00a080);
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: 14px;
color: var(--bg);
}
.user-details {
flex: 1;
}
.user-name {
font-size: 14px;
font-weight: 500;
color: var(--fg);
}
.user-role {
font-size: 12px;
color: var(--fg-muted);
}
/* Main content */
.main-content {
margin-left: 240px;
padding: 24px 32px;
position: relative;
z-index: 1;
min-height: 100vh;
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 32px;
}
.page-title {
font-size: 28px;
font-weight: 700;
color: var(--fg);
}
.page-subtitle {
font-size: 14px;
color: var(--fg-muted);
margin-top: 4px;
}
.header-actions {
display: flex;
align-items: center;
gap: 12px;
}
.btn {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 18px;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
border: none;
font-family: inherit;
}
.btn-primary {
background: var(--accent);
color: var(--bg);
}
.btn-primary:hover {
background: #00eebb;
transform: translateY(-1px);
}
.btn-secondary {
background: var(--bg-card);
color: var(--fg);
border: 1px solid var(--border);
}
.btn-secondary:hover {
background: var(--bg-elevated);
border-color: var(--fg-muted);
}
.btn svg {
width: 16px;
height: 16px;
}
/* KPI Cards */
.kpi-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
margin-bottom: 32px;
}
.kpi-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 12px;
padding: 20px;
position: relative;
overflow: hidden;
opacity: 0;
transform: translateY(20px);
transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.kpi-card.visible {
opacity: 1;
transform: translateY(0);
}
.kpi-card:hover {
border-color: var(--accent);
transform: translateY(-2px);
}
.kpi-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 3px;
background: var(--accent);
transform: scaleX(0);
transition: transform 0.3s ease;
}
.kpi-card:hover::before {
transform: scaleX(1);
}
.kpi-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16px;
}
.kpi-icon {
width: 40px;
height: 40px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
}
.kpi-icon svg {
width: 20px;
height: 20px;
}
.kpi-icon.green {
background: var(--accent-dim);
color: var(--accent);
}
.kpi-icon.yellow {
background: var(--warning-dim);
color: var(--warning);
}
.kpi-icon.red {
background: var(--danger-dim);
color: var(--danger);
}
.kpi-trend {
display: flex;
align-items: center;
gap: 4px;
font-size: 12px;
font-weight: 500;
padding: 4px 8px;
border-radius: 6px;
}
.kpi-trend.up {
background: var(--accent-dim);
color: var(--accent);
}
.kpi-trend.down {
background: var(--danger-dim);
color: var(--danger);
}
.kpi-trend svg {
width: 12px;
height: 12px;
}
.kpi-value {
font-family: 'Space Grotesk', sans-serif;
font-size: 32px;
font-weight: 700;
color: var(--fg);
margin-bottom: 4px;
}
.kpi-label {
font-size: 13px;
color: var(--fg-muted);
}
.kpi-progress {
margin-top: 16px;
height: 4px;
background: var(--bg);
border-radius: 2px;
overflow: hidden;
}
.kpi-progress-bar {
height: 100%;
border-radius: 2px;
transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}
/* Content Grid */
.content-grid {
display: grid;
grid-template-columns: 1fr 400px;
gap: 24px;
}
.card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 12px;
overflow: hidden;
opacity: 0;
transform: translateY(20px);
transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.card.visible {
opacity: 1;
transform: translateY(0);
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px;
border-bottom: 1px solid var(--border);
}
.card-title {
font-size: 16px;
font-weight: 600;
color: var(--fg);
}
.card-actions {
display: flex;
align-items: center;
gap: 8px;
}
/* Time Selector */
.time-selector {
display: flex;
background: var(--bg);
border-radius: 8px;
padding: 4px;
}
.time-option {
padding: 6px 14px;
border-radius: 6px;
font-size: 13px;
color: var(--fg-muted);
cursor: pointer;
transition: all 0.2s ease;
border: none;
background: transparent;
font-family: inherit;
}
.time-option:hover {
color: var(--fg);
}
.time-option.active {
background: var(--accent);
color: var(--bg);
font-weight: 500;
}
/* Chart */
.chart-container {
padding: 24px;
}
.chart {
height: 280px;
display: flex;
align-items: flex-end;
gap: 12px;
padding: 20px 0;
}
.chart-column {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
}
.chart-bar-wrapper {
width: 100%;
height: 220px;
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: center;
}
.chart-bar {
width: 70%;
max-width: 40px;
background: linear-gradient(to top, var(--accent), #00eebb);
border-radius: 6px 6px 0 0;
position: relative;
cursor: pointer;
transition: all 0.3s ease;
transform-origin: bottom;
}
.chart-bar:hover {
filter: brightness(1.2);
transform: scaleY(1.02);
}
.chart-bar::after {
content: attr(data-value);
position: absolute;
top: -24px;
left: 50%;
transform: translateX(-50%);
font-size: 11px;
font-weight: 600;
color: var(--accent);
opacity: 0;
transition: opacity 0.2s ease;
}
.chart-bar:hover::after {
opacity: 1;
}
.chart-label {
font-size: 12px;
color: var(--fg-muted);
}
.chart-legend {
display: flex;
align-items: center;
justify-content: center;
gap: 24px;
padding-top: 16px;
border-top: 1px solid var(--border);
margin-top: 8px;
}
.legend-item {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
color: var(--fg-muted);
}
.legend-dot {
width: 10px;
height: 10px;
border-radius: 3px;
}
/* Category Filter */
.category-filter {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.filter-chip {
padding: 6px 14px;
border-radius: 20px;
font-size: 12px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
border: 1px solid var(--border);
background: transparent;
color: var(--fg-muted);
font-family: inherit;
}
.filter-chip:hover {
border-color: var(--fg-muted);
color: var(--fg);
}
.filter-chip.active {
background: var(--accent);
border-color: var(--accent);
color: var(--bg);
}
/* Contract List */
.contract-list {
padding: 8px 0;
max-height: 400px;
overflow-y: auto;
}
.contract-item {
display: flex;
align-items: center;
padding: 16px 20px;
gap: 16px;
cursor: pointer;
transition: all 0.2s ease;
border-left: 3px solid transparent;
}
.contract-item:hover {
background: var(--bg);
}
.contract-item.selected {
background: var(--accent-dim);
border-left-color: var(--accent);
}
.contract-vendor {
flex: 1;
min-width: 0;
}
.vendor-name {
font-size: 14px;
font-weight: 500;
color: var(--fg);
margin-bottom: 4px;
}
.vendor-category {
font-size: 12px;
color: var(--fg-muted);
}
.contract-value {
text-align: right;
}
.value-amount {
font-family: 'Space Grotesk', sans-serif;
font-size: 14px;
font-weight: 600;
color: var(--fg);
margin-bottom: 4px;
}
.status-badge {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 3px 10px;
border-radius: 12px;
font-size: 11px;
font-weight: 500;
}
.status-badge.active {
background: var(--accent-dim);
color: var(--accent);
}
.status-badge.pending {
background: var(--warning-dim);
color: var(--warning);
}
.status-badge.expiring {
background: var(--danger-dim);
color: var(--danger);
}
.status-badge svg {
width: 10px;
height: 10px;
}
/* Forecast Details */
.forecast-details {
padding: 20px;
}
.detail-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 0;
border-bottom: 1px solid var(--border);
}
.detail-row:last-child {
border-bottom: none;
}
.detail-label {
font-size: 13px;
color: var(--fg-muted);
}
.detail-value {
font-size: 14px;
font-weight: 500;
color: var(--fg);
}
.detail-value.highlight {
color: var(--accent);
}
/* Mobile responsiveness */
@media (max-width: 1200px) {
.kpi-grid {
grid-template-columns: repeat(2, 1fr);
}
.content-grid {
grid-template-columns: 1fr;
}
}
@media (max-width: 768px) {
.sidebar {
transform: translateX(-100%);
}
.main-content {
margin-left: 0;
padding: 16px;
}
.kpi-grid {
grid-template-columns: 1fr;
}
.header {
flex-direction: column;
align-items: flex-start;
gap: 16px;
}
.chart {
height: 200px;
gap: 6px;
}
.chart-bar-wrapper {
height: 160px;
}
}
/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
/* Focus states */
.btn:focus-visible,
.nav-item:focus-visible,
.filter-chip:focus-visible,
.time-option:focus-visible,
.contract-item:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
</style>
</head>
<body>
<div class="bg-pattern"></div>
<div class="grid-overlay"></div>
<!-- Sidebar -->
<aside class="sidebar">
<div class="logo">
<div class="logo-icon">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>
<polyline points="3.27 6.96 12 12.01 20.73 6.96"/>
<line x1="12" y1="22.08" x2="12" y2="12"/>
</svg>
</div>
<span class="logo-text">ProcureHub</span>
</div>
<nav>
<div class="nav-section">
<div class="nav-label">规划中心</div>
<div class="nav-item active" tabindex="0" role="button">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>
<line x1="3" y1="9" x2="21" y2="9"/>
<line x1="9" y1="21" x2="9" y2="9"/>
</svg>
需求预测
</div>
<div class="nav-item" tabindex="0" role="button">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
<line x1="16" y1="13" x2="8" y2="13"/>
<line x1="16" y1="17" x2="8" y2="17"/>
<polyline points="10 9 9 9 8 9"/>
</svg>
合同管理
<span class="nav-badge">12</span>
</div>
<div class="nav-item" tabindex="0" role="button">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="20" x2="12" y2="10"/>
<line x1="18" y1="20" x2="18" y2="4"/>
<line x1="6" y1="20" x2="6" y2="16"/>
</svg>
供应商分析
</div>
</div>
<div class="nav-section">
<div class="nav-label">采购执行</div>
<div class="nav-item" tabindex="0" role="button">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="9" cy="21" r="1"/>
<circle cx="20" cy="21" r="1"/>
<path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"/>
</svg>
采购订单
</div>
<div class="nav-item" tabindex="0" role="button">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/>
<polyline points="22 4 12 14.01 9 11.01"/>
</svg>
审批流程
<span class="nav-badge">3</span>
</div>
</div>
</nav>
<div class="sidebar-footer">
<div class="user-info">
<div class="user-avatar">张伟</div>
<div class="user-details">
<div class="user-name">张伟</div>
<div class="user-role">采购经理</div>
</div>
</div>
</div>
</aside>
<!-- Main Content -->
<main class="main-content">
<header class="header">
<div>
<h1 class="page-title">需求规划中心</h1>
<p class="page-subtitle">2024年第四季度采购需求分析与预测</p>
</div>
<div class="header-actions">
<button class="btn btn-secondary">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<polyline points="7 10 12 15 17 10"/>
<line x1="12" y1="15" x2="12" y2="3"/>
</svg>
导出报告
</button>
<button class="btn btn-primary">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="5" x2="12" y2="19"/>
<line x1="5" y1="12" x2="19" y2="12"/>
</svg>
创建预测
</button>
</div>
</header>
<!-- KPI Cards -->
<div class="kpi-grid">
<div class="kpi-card" data-delay="0">
<div class="kpi-header">
<div class="kpi-icon green">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 2v20M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"/>
</svg>
</div>
<div class="kpi-trend up">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="23 6 13.5 15.5 8.5 10.5 1 18"/>
<polyline points="17 6 23 6 23 12"/>
</svg>
12.5%
</div>
</div>
<div class="kpi-value" data-target="2847">0</div>
<div class="kpi-label">成本节约 (万元)</div>
<div class="kpi-progress">
<div class="kpi-progress-bar" style="width: 0%; background: var(--accent);" data-width="78%"></div>
</div>
</div>
<div class="kpi-card" data-delay="100">
<div class="kpi-header">
<div class="kpi-icon green">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<polyline points="12 6 12 12 16 14"/>
</svg>
</div>
<div class="kpi-trend up">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="23 6 13.5 15.5 8.5 10.5 1 18"/>
<polyline points="17 6 23 6 23 12"/>
</svg>
3.2%
</div>
</div>
<div class="kpi-value" data-target="96.8">0</div>
<div class="kpi-label">准时交付率 (%)</div>
<div class="kpi-progress">
<div class="kpi-progress-bar" style="width: 0%; background: var(--accent);" data-width="96.8%"></div>
</div>
</div>
<div class="kpi-card" data-delay="200">
<div class="kpi-header">
<div class="kpi-icon yellow">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/>
<line x1="12" y1="9" x2="12" y2="13"/>
<line x1="12" y1="17" x2="12.01" y2="17"/>
</svg>
</div>
<div class="kpi-trend down">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="23 18 13.5 8.5 8.5 13.5 1 6"/>
<polyline points="17 18 23 18 23 12"/>
</svg>
2.1%
</div>
</div>
<div class="kpi-value" data-target="89.3">0</div>
<div class="kpi-label">供应商合规率 (%)</div>
<div class="kpi-progress">
<div class="kpi-progress-bar" style="width: 0%; background: var(--warning);" data-width="89.3%"></div>
</div>
</div>
<div class="kpi-card" data-delay="300">
<div class="kpi-header">
<div class="kpi-icon green">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="1" y="4" width="22" height="16" rx="2" ry="2"/>
<line x1="1" y1="10" x2="23" y2="10"/>
</svg>
</div>
<div class="kpi-trend up">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="23 6 13.5 15.5 8.5 10.5 1 18"/>
<polyline points="17 6 23 6 23 12"/>
</svg>
8.7%
</div>
</div>
<div class="kpi-value" data-target="156">0</div>
<div class="kpi-label">合同覆盖率 (%)</div>
<div class="kpi-progress">
<div class="kpi-progress-bar" style="width: 0%; background: var(--accent);" data-width="100%"></div>
</div>
</div>
</div>
<!-- Content Grid -->
<div class="content-grid">
<!-- Forecast Chart -->
<div class="card" data-delay="400">
<div class="card-header">
<h2 class="card-title">采购需求预测</h2>
<div class="card-actions">
<div class="time-selector" role="tablist">
<button class="time-option" role="tab" data-period="monthly">月度</button>
<button class="time-option active" role="tab" aria-selected="true" data-period="quarterly">季度</button>
<button class="time-option" role="tab" data-period="yearly">年度</button>
</div>
</div>
</div>
<div class="chart-container">
<div class="chart" id="forecastChart" role="img" aria-label="采购需求预测柱状图"></div>
<div class="chart-legend">
<div class="legend-item">
<div class="legend-dot" style="background: var(--accent);"></div>
<span>预测需求</span>
</div>
<div class="legend-item">
<div class="legend-dot" style="background: rgba(0, 212, 170, 0.3);"></div>
<span>已确认订单</span>
</div>
<div class="legend-item">
<div class="legend-dot" style="background: var(--warning);"></div>
<span>待审批</span>
</div>
</div>
</div>
</div>
<!-- Contracts Panel -->
<div class="card" data-delay="500">
<div class="card-header">
<h2 class="card-title">合同状态</h2>
</div>
<div class="card-actions" style="padding: 0 20px 16px;">
<div class="category-filter" role="group" aria-label="合同分类筛选">
<button class="filter-chip active" data-filter="all">全部</button>
<button class="filter-chip" data-filter="active">执行中</button>
<button class="filter-chip" data-filter="pending">待签署</button>
<button class="filter-chip" data-filter="expiring">即将到期</button>
</div>
</div>
<div class="contract-list" id="contractList" role="list"></div>
</div>
</div>
<!-- Forecast Details -->
<div class="card" data-delay="600" style="margin-top: 24px;">
<div class="card-header">
<h2 class="card-title">预测明细</h2>
<button class="btn btn-secondary">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="width: 16px; height: 16px;">
<polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/>
</svg>
筛选
</button>
</div>
<div class="forecast-details">
<div class="detail-row">
<span class="detail-label">预测总金额</span>
<span class="detail-value highlight">¥ 12,450,000</span>
</div>
<div class="detail-row">
<span class="detail-label">已确认采购</span>
<span class="detail-value">¥ 8,320,000</span>
</div>
<div class="detail-row">
<span class="detail-label">待审批金额</span>
<span class="detail-value">¥ 2,180,000</span>
</div>
<div class="detail-row">
<span class="detail-label">预测偏差率</span>
<span class="detail-value">4.2%</span>
</div>
<div class="detail-row">
<span class="detail-label">活跃供应商数</span>
<span class="detail-value">47</span>
</div>
<div class="detail-row">
<span class="detail-label">平均采购周期</span>
<span class="detail-value">12.5 天</span>
</div>
</div>
</div>
</main>
<script>
// Data
const forecastData = {
quarterly: [
{ label: 'Q1', value: 2800, confirmed: 2400, pending: 400 },
{ label: 'Q2', value: 3200, confirmed: 2900, pending: 300 },
{ label: 'Q3', value: 3600, confirmed: 3100, pending: 500 },
{ label: 'Q4', value: 4100, confirmed: 3200, pending: 900 },
],
monthly: [
{ label: '1月', value: 920, confirmed: 800, pending: 120 },
{ label: '2月', value: 880, confirmed: 750, pending: 130 },
{ label: '3月', value: 1000, confirmed: 850, pending: 150 },
{ label: '4月', value: 1050, confirmed: 950, pending: 100 },
{ label: '5月', value: 1100, confirmed: 980, pending: 120 },
{ label: '6月', value: 1050, confirmed: 970, pending: 80 },
],
yearly: [
{ label: '2021', value: 9800, confirmed: 9200, pending: 600 },
{ label: '2022', value: 11200, confirmed: 10500, pending: 700 },
{ label: '2023', value: 12800, confirmed: 11800, pending: 1000 },
{ label: '2024', value: 13700, confirmed: 11600, pending: 2100 },
]
};
const contracts = [
{ vendor: '华为技术有限公司', category: 'IT设备', value: 2450000, status: 'active', expiry: '2025-06-30' },
{ vendor: '阿里巴巴云计算', category: '云服务', value: 1800000, status: 'active', expiry: '2025-03-15' },
{ vendor: '顺丰速运有限公司', category: '物流服务', value: 960000, status: 'pending', expiry: '2024-12-31' },
{ vendor: '金蝶软件集团', category: '企业软件', value: 680000, status: 'active', expiry: '2025-09-20' },
{ vendor: '中国移动通信', category: '通信服务', value: 420000, status: 'expiring', expiry: '2024-11-30' },
{ vendor: '联想集团', category: 'IT设备', value: 1580000, status: 'active', expiry: '2025-08-15' },
{ vendor: '京东物流', category: '物流服务', value: 720000, status: 'pending', expiry: '2025-01-15' },
{ vendor: '用友网络科技', category: '企业软件', value: 540000, status: 'expiring', expiry: '2024-12-15' },
];
// Initialize
document.addEventListener('DOMContentLoaded', () => {
initAnimations();
renderChart('quarterly');
renderContracts('all');
initInteractions();
animateKPIValues();
});
// Scroll reveal animations
function initAnimations() {
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const delay = parseInt(entry.target.dataset.delay) || 0;
setTimeout(() => {
entry.target.classList.add('visible');
// Animate progress bars
const progressBar = entry.target.querySelector('.kpi-progress-bar');
if (progressBar) {
progressBar.style.width = progressBar.dataset.width;
}
}, delay);
}
});
}, observerOptions);
document.querySelectorAll('.kpi-card, .card').forEach(el => observer.observe(el));
}
// Animate KPI values
function animateKPIValues() {
document.querySelectorAll('.kpi-value').forEach(el => {
const target = parseFloat(el.dataset.target);
const duration = 1500;
const start = performance.now();
const isDecimal = target % 1 !== 0;
function update(currentTime) {
const elapsed = currentTime - start;
const progress = Math.min(elapsed / duration, 1);
const eased = 1 - Math.pow(1 - progress, 3);
const current = target * eased;
if (isDecimal) {
el.textContent = current.toFixed(1);
} else {
el.textContent = Math.round(current).toLocaleString();
}
if (progress < 1) {
requestAnimationFrame(update);
}
}
// Start animation when card is visible
const observer = new IntersectionObserver((entries) => {
if (entries[0].isIntersecting) {
requestAnimationFrame(update);
observer.disconnect();
}
});
observer.observe(el);
});
}
// Render chart
function renderChart(period) {
const data = forecastData[period];
const chart = document.getElementById('forecastChart');
const maxValue = Math.max(...data.map(d => d.value));
chart.innerHTML = data.map(item => {
const heightPercent = Math.max(10, (item.value / maxValue) * 100);
const confirmedPercent = (item.confirmed / item.value) * 100;
return `
<div class="chart-column">
<div class="chart-bar-wrapper">
<div class="chart-bar"
style="height: 0%; background: linear-gradient(to top, var(--accent), #00eebb);"
data-height="${heightPercent}"
data-value="¥${(item.value / 100).toFixed(0)}万"
role="presentation">
</div>
</div>
<span class="chart-label">${item.label}</span>
</div>
`;
}).join('');
// Animate bars
setTimeout(() => {
chart.querySelectorAll('.chart-bar').forEach((bar, i) => {
setTimeout(() => {
bar.style.height = bar.dataset.height + '%';
bar.style.transition = 'height 0.6s cubic-bezier(0.16, 1, 0.3, 1)';
}, i * 100);
});
}, 100);
}
// Render contracts
function renderContracts(filter) {
const list = document.getElementById('contractList');
const filtered = filter === 'all' ? contracts : contracts.filter(c => c.status === filter);
const statusLabels = {
active: '执行中',
pending: '待签署',
expiring: '即将到期'
};
list.innerHTML = filtered.map((contract, i) => `
<div class="contract-item"
role="listitem"
tabindex="0"
data-index="${i}">
<div class="contract-vendor">
<div class="vendor-name">${contract.vendor}</div>
<div class="vendor-category">${contract.category}</div>
</div>
<div class="contract-value">
<div class="value-amount">¥${(contract.value / 10000).toFixed(0)}万</div>
<span class="status-badge ${contract.status}">
<svg viewBox="0 0 24 24" fill="currentColor">
<circle cx="12" cy="12" r="6"/>
</svg>
${statusLabels[contract.status]}
</span>
</div>
</div>
`).join('');
// Add selection interaction
list.querySelectorAll('.contract-item').forEach(item => {
item.addEventListener('click', () => {
list.querySelectorAll('.contract-item').forEach(i => i.classList.remove('selected'));
item.classList.add('selected');
});
item.addEventListener('keydown', (e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
item.click();
}
});
});
}
// Initialize interactions
function initInteractions() {
// Time selector
document.querySelectorAll('.time-option').forEach(btn => {
btn.addEventListener('click', () => {
document.querySelectorAll('.time-option').forEach(b => {
b.classList.remove('active');
b.setAttribute('aria-selected', 'false');
});
btn.classList.add('active');
btn.setAttribute('aria-selected', 'true');
renderChart(btn.dataset.period);
});
});
// Category filter
document.querySelectorAll('.filter-chip').forEach(chip => {
chip.addEventListener('click', () => {
document.querySelectorAll('.filter-chip').forEach(c => c.classList.remove('active'));
chip.classList.add('active');
renderContracts(chip.dataset.filter);
});
});
// Navigation items
document.querySelectorAll('.nav-item').forEach(item => {
item.addEventListener('click', () => {
document.querySelectorAll('.nav-item').forEach(i => i.classList.remove('active'));
item.classList.add('active');
});
item.addEventListener('keydown', (e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
item.click();
}
});
});
}
</script>
</body>
</html>
界面功能说明
核心模块
-
KPI仪表盘 - 四个关键指标卡片:
- 成本节约金额(带趋势指示)
- 准时交付率
- 供应商合规率
- 合同覆盖率
-
需求预测图表:
- 支持月度/季度/年度视图切换
- 动态柱状图展示预测趋势
- 悬停显示详细数值
-
合同管理面板:
- 分类筛选(全部/执行中/待签署/即将到期)
- 供应商信息与合同金额
- 状态标签可视化
-
预测明细:
- 预测总金额与已确认采购
- 待审批金额与预测偏差率
- 活跃供应商数与采购周期
交互特性
- 入场动画:卡片依次渐入,KPI数字滚动计数
- 图表交互:柱状图悬停高亮,时间段切换重绘
- 列表选择:点击合同行高亮选中状态
- 响应式布局:适配移动端到桌面端
- 无障碍支持:键盘导航、ARIA标签、焦点指示