"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 DataManagement() { 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 (
{/* Header */}

数据管理

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

数据源管理 数据清洗 标签系统 质量检测 {/* 数据源管理 */} {/* 搜索栏 */}
setSearchQuery(e.target.value)} className="pl-10 bg-white/5 border-white/10" />
{/* 数据源列表 */}
{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)}
))}
{/* 标签系统 */}
{tagStats.totalTags}
标签总数
{tagStats.systemTags}
系统标签
{tagStats.customTags}
自定义标签
{tagStats.activeRules}
活跃规则
{formatNumber(tagStats.todayTagged)}
今日打标
标签管理
标签详细管理界面开发中...
{/* 质量检测 */}
{qualityChecks.map((check, index) => (
{check.severity === "error" ? ( ) : ( )}

{check.type}

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