"use client" import { useState } from "react" import Link from "next/link" import { Card, CardContent, CardHeader, CardTitle, CardDescription } 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, Plus, Plug, Shield, ArrowRight } 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: 1234567, syncRate: 98.5, dataSize: "85GB", }, { id: 2, name: "抖音粉丝数据", type: "抖音平台", status: "active", lastSync: "5分钟前", users: 856432, syncRate: 95.2, dataSize: "21GB", }, { id: 3, name: "小红书数据", type: "小红书", status: "pending", lastSync: "待配置", users: 0, syncRate: 0, dataSize: "0", }, { id: 4, name: "企业CRM数据", type: "数据库直连", status: "active", lastSync: "1分钟前", users: 2456789, syncRate: 99.1, dataSize: "156GB", }, { id: 5, name: "淘宝店铺数据", type: "API接入", status: "error", lastSync: "授权过期", users: 345678, syncRate: 0, dataSize: "18GB", }, ] // 数据清洗进度 const cleaningTasks = [ { name: "手机号格式校验", total: 4285670, processed: 4200000, progress: 98.0, errors: 1250 }, { name: "重复数据去除", total: 4285670, processed: 3850000, progress: 89.8, errors: 85000 }, { name: "缺失字段补全", total: 4285670, processed: 3250000, progress: 75.8, errors: 125000 }, { name: "异常值检测", total: 4285670, processed: 4100000, progress: 95.7, errors: 8500 }, ] // 标签分类 const tagCategories = [ { name: "用户价值", count: 5, color: "bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400" }, { name: "活跃度", count: 4, color: "bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400" }, { name: "消费行为", count: 6, color: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400" }, { name: "兴趣偏好", count: 12, color: "bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400" }, { name: "生命周期", count: 5, color: "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400" }, { name: "地域分布", count: 8, color: "bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400" }, ] // 标签系统统计 const tagStats = { totalTags: 40, systemTags: 25, customTags: 15, activeRules: 28, todayTagged: 28450, } // 数据质量检测 const qualityChecks = [ { type: "重复数据", count: 85420, percentage: 2.0, severity: "warning" }, { type: "异常数据", count: 12850, percentage: 0.3, severity: "error" }, { type: "缺失字段", count: 325680, percentage: 7.6, severity: "warning" }, { type: "格式错误", count: 5280, 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 */}

数据中台

管理数据源、清洗规则和标签体系

{/* 子功能导航卡片 */}

数据源管理

5个数据源

数据清洗

4个任务运行中

标签管理

40个标签

数据质量

质量分: 92

数据源 数据清洗 标签体系 质量检测 {/* 数据源管理 */} {/* 搜索栏 */}
setSearchQuery(e.target.value)} className="pl-10" />
{/* 数据源列表 */} 已接入数据源 管理所有已配置的数据源连接
{dataSources.map((source) => (

{source.name}

{source.type} · {formatNumber(source.users)} 条记录

{source.status === "active" && } {source.status === "pending" && } {source.status === "error" && } {source.status === "active" ? "已连接" : source.status === "pending" ? "待配置" : "错误"}

{source.lastSync}

))}
{/* 数据清洗 */} 清洗任务 数据清洗与标准化任务进度
{cleaningTasks.map((task, index) => (

{task.name}

{formatNumber(task.processed)}
0 ? "secondary" : "outline"} > {task.progress === 100 ? "已完成" : task.progress > 0 ? "运行中" : "等待中"}
{task.progress}% 完成 {formatNumber(task.errors)} 异常
))}
{/* 标签系统 */} {/* 统计卡片 */}
{tagStats.totalTags}
标签总数
{tagStats.systemTags}
系统标签
{tagStats.customTags}
自定义标签
{tagStats.activeRules}
活跃规则
{formatNumber(tagStats.todayTagged)}
今日打标
{/* 标签分类 */} 标签分类 用户标签体系管理
{tagCategories.map((category) => (

{category.name}

{category.count} 个标签

))}
{/* 质量检测 */} 数据质量报告 检测并修复数据质量问题
{qualityChecks.map((check, index) => (

{check.type}

{check.severity === "error" ? "严重" : "警告"}

{formatNumber(check.count)}

问题数量

{check.percentage}%

占比

))}
) }