"use client" import { useState } from "react" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Database, RefreshCw, CheckCircle2, AlertTriangle, Search, FileText, Upload, Download, Filter, TrendingUp, Zap, Tag, } from "lucide-react" import { Progress } from "@/components/ui/progress" export default function DataMiddlePlatform() { const [searchQuery, setSearchQuery] = useState("") const dataSources = [ { id: 1, name: "私域系统数据源", type: "微信生态", status: "active", lastSync: "2分钟前", users: 2850000000, syncRate: 98.5, dataSize: "850TB", }, { id: 2, name: "电商平台数据", type: "淘宝/京东", status: "active", lastSync: "5分钟前", users: 680000000, syncRate: 95.2, dataSize: "210TB", }, { id: 3, name: "表单收集数据", type: "第三方表单", status: "active", lastSync: "10分钟前", users: 425000000, syncRate: 92.8, dataSize: "125TB", }, { id: 4, name: "碰撞补全数据", type: "数据碰撞", status: "syncing", lastSync: "正在同步", users: 280000000, syncRate: 76.3, dataSize: "95TB", }, { id: 5, name: "项目API数据源", type: "外部API", status: "active", lastSync: "1分钟前", users: 50670000, syncRate: 99.1, dataSize: "18TB", }, ] const cleaningTasks = [ { name: "手机号格式校验", total: 4285670000, processed: 4200000000, progress: 98.0, errors: 1250000 }, { name: "重复数据去除", total: 4285670000, processed: 3850000000, progress: 89.8, errors: 85000000 }, { name: "缺失字段补全", total: 4285670000, processed: 3250000000, progress: 75.8, errors: 125000000 }, { name: "异常值检测", total: 4285670000, processed: 4100000000, progress: 95.7, errors: 8500000 }, ] const tagStats = { totalTags: 1258, systemTags: 485, customTags: 773, activeRules: 2850, todayTagged: 2845000 } const qualityChecks = [ { type: "重复数据", count: 85420000, percentage: 2.0, severity: "warning" }, { type: "异常数据", count: 12850000, percentage: 0.3, severity: "error" }, { type: "缺失字段", count: 325680000, percentage: 7.6, severity: "warning" }, { type: "格式错误", count: 5280000, percentage: 0.12, severity: "error" }, ] const formatNumber = (num: number): string => { if (num >= 1000000000) return `${(num / 1000000000).toFixed(1)}B` if (num >= 1000000) return `${(num / 1000000).toFixed(1)}M` if (num >= 1000) return `${(num / 1000).toFixed(1)}K` return num.toString() } return (

数据中台

全平台数据源管理、清洗与质量监控

数据源管理 数据清洗 标签系统 质量检测
setSearchQuery(e.target.value)} className="pl-10 bg-white/60 backdrop-blur-md border-gray-200" />
{dataSources.map((source) => (

{source.name}

{source.type}

{source.status === "active" ? ( <> 运行中 ) : ( <> 同步中 )}
用户数量
{formatNumber(source.users)}
同步率
{source.syncRate}%
数据量
{source.dataSize}
最后同步
{source.lastSync}
))}
{cleaningTasks.map((task, index) => ( {task.name}
进度 {task.progress}%
已处理
{formatNumber(task.processed)}
异常数据
{formatNumber(task.errors)}
))}
{[ { icon: Tag, label: "标签总数", value: tagStats.totalTags, color: "text-purple-600", bg: "bg-purple-100", }, { icon: FileText, label: "系统标签", value: tagStats.systemTags, color: "text-blue-600", bg: "bg-blue-100", }, { icon: Tag, label: "自定义标签", value: tagStats.customTags, color: "text-green-600", bg: "bg-green-100", }, { icon: Zap, label: "活跃规则", value: tagStats.activeRules, color: "text-yellow-600", bg: "bg-yellow-100", }, { icon: TrendingUp, label: "今日打标", value: formatNumber(tagStats.todayTagged), color: "text-orange-600", bg: "bg-orange-100", }, ].map((stat, index) => (
{stat.value}
{stat.label}
))}
{qualityChecks.map((check, index) => (

{check.type}

{check.severity === "error" ? "严重" : "警告"}
问题数量 {formatNumber(check.count)}
占比 {check.percentage}%
))}
) }