You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
5.7 KiB

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>智能数据匹配引擎</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
margin: 0;
padding: 24px 16px;
background: #0b0f14;
color: #e5e7eb;
font-family: Arial, -apple-system, sans-serif;
min-height: 100vh;
}
.container { max-width: 1400px; margin: auto; }
.card {
background: rgba(255,255,255,0.04);
border: 1px solid rgba(255,255,255,0.08);
border-radius: 14px;
padding: 22px;
margin-bottom: 16px;
}
h2 { margin: 0 0 10px 0; font-size: 20px; }
h3 { margin: 0 0 12px 0; font-size: 16px; }
.badge {
display: inline-block;
padding: 4px 10px;
font-size: 12px;
border-radius: 999px;
background: rgba(34,197,94,0.12);
border: 1px solid rgba(34,197,94,0.35);
color: #22c55e;
}
.upload-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 14px;
margin-top: 12px;
}
input[type="file"] {
width: 100%;
padding: 12px;
background: #111827;
border: 1px solid rgba(255,255,255,0.12);
border-radius: 10px;
color: #e5e7eb;
font-size: 14px;
}
button {
margin-top: 14px;
padding: 10px 16px;
background: #2563eb;
border: none;
border-radius: 10px;
color: white;
font-weight: 600;
cursor: pointer;
font-size: 14px;
}
button:hover { background: #1d4ed8; }
.info { margin-top: 10px; color: #60a5fa; font-size: 13px; }
.info-title { font-size: 14px; color: #93c5fd; margin-bottom: 8px; font-weight: 600; }
.info-main { font-size: 13px; color: #e5e7eb; margin-bottom: 12px; }
.info-grid { display: flex; gap: 12px; }
.info-item {
flex: 1;
padding: 10px 12px;
border-radius: 10px;
background: rgba(255,255,255,0.04);
border: 1px solid rgba(255,255,255,0.08);
}
.info-item .label { font-size: 12px; color: #9ca3af; }
.info-item .value { font-size: 18px; font-weight: 700; }
.info-item.success .value { color: #22c55e; }
.info-item.warn .value { color: #f59e0b; }
.preview-wrapper {
margin-top: 10px;
padding: 12px;
background: rgba(255,255,255,0.03);
border: 1px solid rgba(255,255,255,0.08);
border-radius: 12px;
overflow: auto;
}
.preview-wrapper table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
white-space: nowrap;
}
.preview-wrapper thead th {
position: sticky;
top: 0;
background: #111827;
color: #f9fafb;
padding: 10px 12px;
text-align: left;
border-bottom: 1px solid rgba(255,255,255,0.08);
}
.preview-wrapper tbody td {
padding: 9px 12px;
color: #d1d5db;
border-bottom: 1px solid rgba(255,255,255,0.05);
}
.preview-wrapper tbody tr:hover { background: rgba(59,130,246,0.08); }
.key1 { background: rgba(59,130,246,0.25) !important; color: #93c5fd !important; font-weight: 600; }
.key2 { background: rgba(168,85,247,0.25) !important; color: #d8b4fe !important; font-weight: 600; }
.download-btn {
display: inline-block;
margin-top: 12px;
padding: 8px 12px;
background: #22c55e;
color: #0b0f14;
border-radius: 10px;
text-decoration: none;
font-weight: 600;
font-size: 14px;
}
.download-btn:hover { background: #16a34a; }
@media (max-width: 768px) {
body { padding: 20px 12px; }
.upload-grid { grid-template-columns: 1fr; }
.card { padding: 18px 14px; }
h2 { font-size: 18px; }
.info-grid { flex-direction: column; gap: 8px; }
}
</style>
</head>
<body>
<div class="container">
<div class="card">
<h2>🧠 智能数据匹配引擎 <span class="badge">Auto Join · Schema Detect</span></h2>
</div>
<div class="card">
<h3>📂 上传数据文件</h3>
<form method="post" enctype="multipart/form-data">
<div class="upload-grid">
<input type="file" name="file1" required>
<input type="file" name="file2" required>
</div>
<button>开始智能匹配</button>
</form>
</div>
{% if message %}
<div class="card"><div class="info">{{ message }}</div></div>
{% endif %}
{% if match_info %}
<div class="card">
<div class="info-title">🧠 匹配分析结果</div>
<div class="info-main">{{ match_info }}</div>
<div class="info-grid">
<div class="info-item success">
<div class="label">成功匹配</div>
<div class="value">{{ matched_count or 0 }}</div>
</div>
<div class="info-item warn">
<div class="label">未匹配</div>
<div class="value">{{ unmatched_count or 0 }}</div>
</div>
</div>
</div>
{% endif %}
{% if preview %}
<div class="card">
<h3>📊 预览结果</h3>
<div class="preview-wrapper">{{ preview|safe }}</div>
<a class="download-btn" href="{{ url_for('smart_data_v2_download', filename=download_file) }}">下载结果</a>
</div>
{% endif %}
</div>
<script>
window.onload = function () {
const table = document.querySelector("table");
if (!table) return;
const k1 = "{{ match_info.split('↔')[0] if match_info else '' }}";
const k2 = "{{ match_info.split('↔')[1] if match_info else '' }}";
let i1 = -1, i2 = -1;
table.querySelectorAll("thead th").forEach((th, i) => {
const t = th.innerText.trim();
if (t.includes(k1.trim())) { i1 = i; th.classList.add("key1"); }
if (t.includes(k2.trim())) { i2 = i; th.classList.add("key2"); }
});
table.querySelectorAll("tbody tr").forEach(row => {
const tds = row.querySelectorAll("td");
if (i1 >= 0) tds[i1]?.classList.add("key1");
if (i2 >= 0) tds[i2]?.classList.add("key2");
});
};
</script>
</body>
</html>