统一样式
This commit is contained in:
+137
-173
@@ -3,160 +3,84 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>荣誉证书核验 - 详细信息</title>
|
<title>证书核验详情</title>
|
||||||
|
<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=Noto+Sans+SC:wght@400;500;600;700&family=Orbitron:wght@500;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="../css/tech-query.css">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
|
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
|
||||||
<style>
|
|
||||||
:root { --primary: #1a73e8; }
|
|
||||||
body {
|
|
||||||
margin: 0; padding: 0; background: #f0f2f5;
|
|
||||||
display: flex; flex-direction: column; align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
font-family: system-ui, -apple-system, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 顶部工具栏 */
|
|
||||||
.toolbar {
|
|
||||||
width: 100%; padding: 15px; background: white;
|
|
||||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
||||||
position: sticky; top: 0; z-index: 100;
|
|
||||||
display: flex; justify-content: center; gap: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
padding: 8px 20px; border-radius: 6px; cursor: pointer;
|
|
||||||
font-weight: 500; text-decoration: none; font-size: 14px; border: none;
|
|
||||||
}
|
|
||||||
.btn-print { background: var(--primary); color: white; }
|
|
||||||
.btn-back { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
|
|
||||||
|
|
||||||
/* 主体内容 */
|
|
||||||
.main-content {
|
|
||||||
width: 100%; max-width: 850px;
|
|
||||||
display: flex; flex-direction: column; padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 证书预览区域 */
|
|
||||||
#cert-viewport {
|
|
||||||
width: 100%; background: white;
|
|
||||||
box-shadow: 0 10px 30px rgba(0,0,0,0.1);
|
|
||||||
margin-bottom: 40px;
|
|
||||||
display: flex; justify-content: center;
|
|
||||||
cursor: pointer;
|
|
||||||
position: relative;
|
|
||||||
min-height: 400px;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
#cert-img { width: 100%; height: auto; display: none; }
|
|
||||||
|
|
||||||
/* 点击加载提示 */
|
|
||||||
.click-hint {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
text-align: center;
|
|
||||||
color: #64748b;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
.click-hint-icon {
|
|
||||||
font-size: 48px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
color: var(--primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 详细信息表卡片 */
|
|
||||||
.info-card {
|
|
||||||
width: 100%; background: white; border-radius: 12px;
|
|
||||||
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
|
|
||||||
overflow: hidden; margin-bottom: 40px;
|
|
||||||
}
|
|
||||||
.info-header {
|
|
||||||
background: #f8fafc; padding: 15px 20px;
|
|
||||||
border-bottom: 1px solid #edf2f7; font-weight: 600;
|
|
||||||
display: flex; justify-content: space-between;
|
|
||||||
}
|
|
||||||
.info-table { width: 100%; border-collapse: collapse; }
|
|
||||||
.info-table th, .info-table td {
|
|
||||||
padding: 16px 20px; text-align: left; border-bottom: 1px solid #f1f5f9;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
.info-table th { color: #64748b; width: 25%; font-weight: 500; background: #fafbfc; }
|
|
||||||
.info-table td { color: #1e293b; }
|
|
||||||
|
|
||||||
.status-tag { padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 600; }
|
|
||||||
.status-valid { background: #dcfce7; color: #166534; }
|
|
||||||
|
|
||||||
/* --- 核心修改:打印分页样式 --- */
|
|
||||||
@media print {
|
|
||||||
body { background: white; }
|
|
||||||
.toolbar, .footer { display: none !important; }
|
|
||||||
|
|
||||||
.main-content { padding: 0; max-width: none; width: 100%; }
|
|
||||||
|
|
||||||
/* 第一页:证书 */
|
|
||||||
#cert-viewport {
|
|
||||||
box-shadow: none;
|
|
||||||
margin: 0;
|
|
||||||
width: 100%;
|
|
||||||
page-break-after: always; /* 旧版浏览器兼容 */
|
|
||||||
break-after: page; /* 现代浏览器:强制在此元素后分页 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 第二页:详情表 */
|
|
||||||
.info-card {
|
|
||||||
box-shadow: none;
|
|
||||||
border: 1px solid #e2e8f0;
|
|
||||||
margin: 0;
|
|
||||||
break-before: page; /* 确保详情表从新页面开始 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-table th { background: #f8fafc !important; -webkit-print-color-adjust: exact; }
|
|
||||||
|
|
||||||
@page {
|
|
||||||
size: A4 portrait;
|
|
||||||
margin: 10mm; /* 设置页边距 */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer { padding: 40px 0; text-align: center; color: #94a3b8; font-size: 13px; }
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<main class="detail-shell">
|
||||||
<div class="toolbar">
|
<div class="top-actions">
|
||||||
<a href="javascript:history.back()" class="btn btn-back">返回查询</a>
|
<a href="javascript:history.back()" class="tech-link-button secondary">返回查询</a>
|
||||||
<button class="btn btn-print" onclick="window.print()">打印证书及明细</button>
|
<div class="top-actions-group">
|
||||||
</div>
|
<button type="button" class="tech-button secondary" onclick="loadCertificateImage()">加载证书图片</button>
|
||||||
|
<button type="button" class="tech-button" onclick="printCertificate()">打印证书与明细</button>
|
||||||
<div class="main-content">
|
|
||||||
<div id="cert-viewport" onclick="loadCertificateImage()">
|
|
||||||
<img id="cert-img" alt="荣誉证书原件">
|
|
||||||
<div class="click-hint" id="click-hint">
|
|
||||||
<div class="click-hint-icon">🖼️</div>
|
|
||||||
<div>点击查看证书图片</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="info-card" id="info-card" style="display: none;">
|
<section class="detail-grid">
|
||||||
<div class="info-header">
|
<section class="preview-panel">
|
||||||
<span>证书明细</span>
|
<div class="section-kicker">Certificate Preview</div>
|
||||||
<span id="display-status"></span>
|
<h1 class="section-heading">证书原件预览</h1>
|
||||||
</div>
|
<p class="section-copy">点击下方预览区域或使用顶部按钮,即可加载对应证书原件图片。</p>
|
||||||
<table class="info-table">
|
<div id="cert-viewport" class="certificate-stage" onclick="loadCertificateImage()">
|
||||||
<tr><th>证书编号</th><td id="d-cert-number">-</td></tr>
|
<img id="cert-img" alt="证书原件">
|
||||||
<tr><th>持有人姓名</th><td id="d-holder-name">-</td></tr>
|
<div class="certificate-hint" id="click-hint">
|
||||||
<tr><th>荣誉名称</th><td id="d-honor-title">-</td></tr>
|
<span class="hint-orb">证</span>
|
||||||
<tr><th>颁发日期</th><td id="d-issue-date">-</td></tr>
|
<strong>点击加载证书图片</strong>
|
||||||
<tr><th>颁发机构</th><td id="d-issuer">-</td></tr>
|
<span>原件图片将从当前证书编号对应的 `img/*.svg` 文件中读取。</span>
|
||||||
<tr><th>详细描述</th><td id="d-desc">-</td></tr>
|
</div>
|
||||||
<tr><th>系统备注</th><td id="d-remarks">-</td></tr>
|
</div>
|
||||||
<tr><th>核验时间</th><td id="d-verify-time">-</td></tr>
|
</section>
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class="footer">
|
<aside class="summary-panel">
|
||||||
<p>© 2026 BI</p>
|
<div class="section-kicker">Verify Status</div>
|
||||||
|
<h2 class="section-heading">核验摘要</h2>
|
||||||
|
<p class="section-copy">证书基础信息与系统核验状态会在这里同步展示。</p>
|
||||||
|
<div class="summary-stack">
|
||||||
|
<div class="summary-tile">
|
||||||
|
<span class="summary-label">证书编号</span>
|
||||||
|
<div class="summary-value emphasis" id="summary-cert-number">-</div>
|
||||||
|
</div>
|
||||||
|
<div class="summary-tile">
|
||||||
|
<span class="summary-label">持有人</span>
|
||||||
|
<div class="summary-value" id="summary-holder-name">-</div>
|
||||||
|
</div>
|
||||||
|
<div class="summary-tile">
|
||||||
|
<span class="summary-label">核验状态</span>
|
||||||
|
<div id="display-status"><span class="status-pill pending">待核验</span></div>
|
||||||
|
</div>
|
||||||
|
<div class="summary-tile">
|
||||||
|
<span class="summary-label">最近核验时间</span>
|
||||||
|
<div class="summary-value" id="summary-verify-time">-</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="detail-panel" id="info-card" style="display: none; margin-top: 18px;">
|
||||||
|
<div class="section-kicker">Certificate Detail</div>
|
||||||
|
<h2 class="section-heading">证书明细信息</h2>
|
||||||
|
<p class="section-copy">以下信息由证书数据库实时读取,用于核验与归档展示。</p>
|
||||||
|
<div class="info-table-shell">
|
||||||
|
<table class="info-table">
|
||||||
|
<tr><th>证书编号</th><td id="d-cert-number">-</td></tr>
|
||||||
|
<tr><th>持有人姓名</th><td id="d-holder-name">-</td></tr>
|
||||||
|
<tr><th>荣誉名称</th><td id="d-honor-title">-</td></tr>
|
||||||
|
<tr><th>颁发日期</th><td id="d-issue-date">-</td></tr>
|
||||||
|
<tr><th>颁发机构</th><td id="d-issuer">-</td></tr>
|
||||||
|
<tr><th>详细描述</th><td id="d-desc">-</td></tr>
|
||||||
|
<tr><th>系统备注</th><td id="d-remarks">-</td></tr>
|
||||||
|
<tr><th>核验时间</th><td id="d-verify-time">-</td></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="page-footer">
|
||||||
|
<p>© 2026 BI Intelligent Query Interface</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -175,56 +99,55 @@
|
|||||||
.eq('id', id)
|
.eq('id', id)
|
||||||
.single();
|
.single();
|
||||||
|
|
||||||
if (error || !data) throw error;
|
if (error || !data) throw error || new Error('未找到证书信息');
|
||||||
|
|
||||||
// 填充数据
|
const verifyTime = new Date().toLocaleString('zh-CN');
|
||||||
document.getElementById('info-card').style.display = 'block';
|
document.getElementById('info-card').style.display = 'block';
|
||||||
document.getElementById('d-cert-number').innerText = data.cert_number;
|
document.getElementById('d-cert-number').innerText = data.cert_number || '-';
|
||||||
document.getElementById('d-holder-name').innerText = data.holder_name;
|
document.getElementById('d-holder-name').innerText = data.holder_name || '-';
|
||||||
document.getElementById('d-honor-title').innerText = data.honor_title;
|
document.getElementById('d-honor-title').innerText = data.honor_title || '-';
|
||||||
document.getElementById('d-issue-date').innerText = data.issue_date || '-';
|
document.getElementById('d-issue-date').innerText = data.issue_date || '-';
|
||||||
document.getElementById('d-issuer').innerText = data.issuer || '官方授权机构';
|
document.getElementById('d-issuer').innerText = data.issuer || '官方授权机构';
|
||||||
document.getElementById('d-desc').innerText = data.description || '官方荣誉认证';
|
document.getElementById('d-desc').innerText = data.description || '官方荣誉认证';
|
||||||
document.getElementById('d-remarks').innerText = data.remarks || '无';
|
document.getElementById('d-remarks').innerText = data.remarks || '无';
|
||||||
document.getElementById('d-verify-time').innerText = new Date().toLocaleString();
|
document.getElementById('d-verify-time').innerText = verifyTime;
|
||||||
|
|
||||||
|
document.getElementById('summary-cert-number').innerText = data.cert_number || '-';
|
||||||
|
document.getElementById('summary-holder-name').innerText = data.holder_name || '-';
|
||||||
|
document.getElementById('summary-verify-time').innerText = verifyTime;
|
||||||
|
|
||||||
if (data.status === 'valid') {
|
if (data.status === 'valid') {
|
||||||
document.getElementById('display-status').innerHTML = '<span class="status-tag status-valid">有效</span>';
|
document.getElementById('display-status').innerHTML = '<span class="status-pill done">有效</span>';
|
||||||
|
} else if (data.status === 'invalid') {
|
||||||
|
document.getElementById('display-status').innerHTML = '<span class="status-pill pending">无效</span>';
|
||||||
|
} else {
|
||||||
|
document.getElementById('display-status').innerHTML = '<span class="status-pill pending">待核验</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.status === 'invalid') {
|
|
||||||
document.getElementById('display-status').innerHTML = '<span class="status-tag">无效</span>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// 图片改为点击加载,初始不加载
|
|
||||||
window.currentCertNumber = data.cert_number;
|
window.currentCertNumber = data.cert_number;
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("加载失败:", e);
|
console.error('加载失败:', e);
|
||||||
alert("证书信息检索失败");
|
alert('证书信息检索失败。');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击加载证书图片
|
|
||||||
function loadCertificateImage() {
|
function loadCertificateImage() {
|
||||||
const certNumber = window.currentCertNumber;
|
const certNumber = window.currentCertNumber;
|
||||||
if (!certNumber) return;
|
if (!certNumber) return;
|
||||||
|
|
||||||
const img = document.getElementById('cert-img');
|
const img = document.getElementById('cert-img');
|
||||||
const hint = document.getElementById('click-hint');
|
const hint = document.getElementById('click-hint');
|
||||||
|
|
||||||
// 如果图片已加载,直接显示
|
|
||||||
if (img.src && img.complete) {
|
if (img.src && img.complete) {
|
||||||
img.style.display = 'block';
|
img.style.display = 'block';
|
||||||
if (hint) hint.style.display = 'none';
|
if (hint) hint.style.display = 'none';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载中提示
|
|
||||||
if (hint) {
|
if (hint) {
|
||||||
hint.innerHTML = '<div class="click-hint-icon">⏳</div><div>图片加载中...</div>';
|
hint.innerHTML = '<span class="hint-orb">载</span><strong>图片加载中</strong><span>正在读取证书原件,请稍候。</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
img.src = `img/${certNumber}.svg`;
|
img.src = `img/${certNumber}.svg`;
|
||||||
img.onload = () => {
|
img.onload = () => {
|
||||||
img.style.display = 'block';
|
img.style.display = 'block';
|
||||||
@@ -232,14 +155,55 @@
|
|||||||
};
|
};
|
||||||
img.onerror = () => {
|
img.onerror = () => {
|
||||||
if (hint) {
|
if (hint) {
|
||||||
hint.innerHTML = '<div class="click-hint-icon">❌</div><div>图片加载失败</div>';
|
hint.innerHTML = '<span class="hint-orb">!</span><strong>图片加载失败</strong><span>未找到对应证书图片文件,请检查 `img` 目录资源。</span>';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
loadData();
|
async function ensureCertificateImageLoaded() {
|
||||||
|
const certNumber = window.currentCertNumber;
|
||||||
|
const img = document.getElementById('cert-img');
|
||||||
|
const hint = document.getElementById('click-hint');
|
||||||
|
|
||||||
|
if (!certNumber) {
|
||||||
|
throw new Error('未找到证书编号');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (img.src && img.complete && img.naturalWidth > 0) {
|
||||||
|
img.style.display = 'block';
|
||||||
|
if (hint) hint.style.display = 'none';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hint) {
|
||||||
|
hint.innerHTML = '<span class="hint-orb">载</span><strong>图片加载中</strong><span>正在为打印准备证书原件,请稍候。</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
img.onload = () => {
|
||||||
|
img.style.display = 'block';
|
||||||
|
if (hint) hint.style.display = 'none';
|
||||||
|
resolve();
|
||||||
|
};
|
||||||
|
img.onerror = () => {
|
||||||
|
reject(new Error('证书图片加载失败'));
|
||||||
|
};
|
||||||
|
img.src = `img/${certNumber}.svg`;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function printCertificate() {
|
||||||
|
try {
|
||||||
|
await ensureCertificateImageLoaded();
|
||||||
|
window.print();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('打印前加载证书失败:', error);
|
||||||
|
alert('证书原件加载失败,无法打印。');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadData();
|
||||||
</script>
|
</script>
|
||||||
<script src="https://cdn.jsdmirror.cn/gh/bishshi/wechat-detect@main/wechat-detect.js"></script>
|
<script src="https://cdn.jsdmirror.cn/gh/bishshi/wechat-detect@main/wechat-detect.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+191
-316
@@ -3,335 +3,210 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>荣誉证书查询系统</title>
|
<title>证书查询系统</title>
|
||||||
|
<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=Noto+Sans+SC:wght@400;500;600;700&family=Orbitron:wght@500;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="../css/tech-query.css">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
|
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
|
||||||
<script src="https://unpkg.com/html5-qrcode"></script>
|
<script src="https://unpkg.com/html5-qrcode"></script>
|
||||||
|
</head>
|
||||||
<style>
|
<body>
|
||||||
:root {
|
<main class="page-shell">
|
||||||
--primary-color: #1a73e8;
|
<section class="page-header">
|
||||||
--bg-color: #f8fafc;
|
<div class="hero-card">
|
||||||
--card-bg: #ffffff;
|
<span class="eyebrow">Certificate Search</span>
|
||||||
--text-main: #1e293b;
|
<h1>荣誉证书智能核验平台</h1>
|
||||||
--text-muted: #64748b;
|
<p>支持按证书编号、持有人姓名与发证日期进行检索,也可以直接扫码快速定位证书记录。</p>
|
||||||
--border-color: #e2e8f0;
|
<div class="hero-meta">
|
||||||
|
<span class="meta-chip">数据范围:2024 年 10 月至今</span>
|
||||||
|
<span class="meta-chip">查询方式:文本检索 / 二维码扫描</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<aside class="stat-card">
|
||||||
|
<div>
|
||||||
|
<div class="stat-label">Module</div>
|
||||||
|
<div class="stat-value">CERT</div>
|
||||||
|
</div>
|
||||||
|
<p></p>
|
||||||
|
</aside>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="panel-card">
|
||||||
|
<div class="panel-title-row">
|
||||||
|
<div>
|
||||||
|
<h2 class="panel-title">检索条件</h2>
|
||||||
|
<div class="panel-subtitle">输入编号或姓名后即可开始查询</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="search-grid">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="searchTerm">编号 / 姓名</label>
|
||||||
|
<div class="input-with-action">
|
||||||
|
<input type="text" id="searchTerm" class="tech-input" placeholder="输入编号或姓名,或点击右侧扫码">
|
||||||
|
<button type="button" class="icon-action" id="startScanBtn" title="扫码查询" aria-label="扫码查询">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7V5a2 2 0 0 1 2-2h2"></path><path d="M17 3h2a2 2 0 0 1 2 2v2"></path><path d="M21 17v2a2 2 0 0 1-2 2h-2"></path><path d="M7 21H5a2 2 0 0 1-2-2v-2"></path><rect x="7" y="7" width="10" height="10"></rect></svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="dateStart">开始日期</label>
|
||||||
|
<input type="date" id="dateStart" class="tech-input">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="dateEnd">结束日期</label>
|
||||||
|
<input type="date" id="dateEnd" class="tech-input">
|
||||||
|
</div>
|
||||||
|
<button id="searchBtn" class="tech-button">执行查询</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="panel-card results-card">
|
||||||
|
<div class="panel-title-row">
|
||||||
|
<div>
|
||||||
|
<h2 class="panel-title">查询结果</h2>
|
||||||
|
<div class="panel-subtitle">点击“查看详情”进入证书详情页</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="resultsArea" class="results-shell">
|
||||||
|
<div class="empty-state">请输入查询条件,或使用扫码功能快速检索证书。</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div id="scanner-overlay" class="scanner-overlay">
|
||||||
|
<div class="scanner-frame">
|
||||||
|
<div id="reader"></div>
|
||||||
|
<div class="scanner-line"></div>
|
||||||
|
</div>
|
||||||
|
<div class="scanner-text">请将二维码置于识别框内</div>
|
||||||
|
<button class="tech-button secondary" id="stopScanBtn" type="button">退出扫描</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer class="page-footer">
|
||||||
|
<p>© 2026 BI Intelligent Query Interface</p>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co';
|
||||||
|
const SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNoaXhzc3JwaGZneHZxcWlna3pvIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQ2OTE0OTEsImV4cCI6MjA5MDI2NzQ5MX0.Az_Ew2J2zdOMcSV0UNAjBS-LPqGpqhsaN4IyZ5R7iqU';
|
||||||
|
const sbClient = supabase.createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
|
||||||
|
|
||||||
|
const html5QrCode = new Html5Qrcode("reader");
|
||||||
|
const scannerOverlay = document.getElementById('scanner-overlay');
|
||||||
|
|
||||||
|
document.getElementById('startScanBtn').addEventListener('click', async () => {
|
||||||
|
scannerOverlay.style.display = 'flex';
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
fps: 15,
|
||||||
|
qrbox: { width: 300, height: 180 },
|
||||||
|
aspectRatio: 1.0
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
await html5QrCode.start(
|
||||||
|
{ facingMode: "environment" },
|
||||||
|
config,
|
||||||
|
(decodedText) => {
|
||||||
|
document.getElementById('searchTerm').value = decodedText;
|
||||||
|
closeScanner();
|
||||||
|
handleSearch();
|
||||||
|
},
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
alert("无法启动摄像头,请检查 HTTPS 权限或设备连接。");
|
||||||
|
scannerOverlay.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
async function closeScanner() {
|
||||||
|
if (html5QrCode.isScanning) {
|
||||||
|
await html5QrCode.stop();
|
||||||
|
}
|
||||||
|
scannerOverlay.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
* { box-sizing: border-box; }
|
document.getElementById('stopScanBtn').addEventListener('click', closeScanner);
|
||||||
body {
|
|
||||||
background: var(--bg-color);
|
|
||||||
font-family: system-ui, -apple-system, sans-serif;
|
|
||||||
margin: 0; padding: 10px;
|
|
||||||
color: var(--text-main);
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
async function handleSearch() {
|
||||||
max-width: 1000px;
|
const term = document.getElementById('searchTerm').value.trim();
|
||||||
margin: 20px auto;
|
const start = document.getElementById('dateStart').value;
|
||||||
background: var(--card-bg);
|
const end = document.getElementById('dateEnd').value;
|
||||||
padding: 24px;
|
const display = document.getElementById('resultsArea');
|
||||||
border-radius: 16px;
|
|
||||||
box-shadow: 0 4px 20px rgba(0,0,0,0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
if (!term) {
|
||||||
text-align: center;
|
alert("请输入证书编号或持有人姓名。");
|
||||||
color: var(--primary-color);
|
return;
|
||||||
font-size: clamp(20px, 5vw, 26px);
|
}
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-section {
|
display.innerHTML = '<div class="loading-state">正在连接证书数据库并执行检索...</div>';
|
||||||
background: var(--bg-color);
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 12px;
|
|
||||||
margin-bottom: 24px;
|
|
||||||
border: 1px solid var(--border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-grid {
|
try {
|
||||||
display: grid;
|
let query = sbClient.from('certificates').select('*');
|
||||||
grid-template-columns: 1fr;
|
query = query.or(`cert_number.ilike.%${term}%,holder_name.ilike.%${term}%`);
|
||||||
gap: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
if (start) query = query.gte('issue_date', start);
|
||||||
.search-grid {
|
if (end) query = query.lte('issue_date', end);
|
||||||
grid-template-columns: 2fr 1fr 1fr auto;
|
|
||||||
align-items: end;
|
const { data, error } = await query.order('issue_date', { ascending: false });
|
||||||
|
if (error) throw error;
|
||||||
|
|
||||||
|
renderResults(data);
|
||||||
|
} catch (err) {
|
||||||
|
display.innerHTML = `<div class="error-state">检索失败:${err.message}</div>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group { display: flex; flex-direction: column; }
|
function renderResults(data) {
|
||||||
.form-group label {
|
const display = document.getElementById('resultsArea');
|
||||||
font-size: 13px;
|
if (!data || data.length === 0) {
|
||||||
color: var(--text-muted);
|
display.innerHTML = '<div class="empty-state">未找到匹配的证书记录。</div>';
|
||||||
margin-bottom: 6px;
|
return;
|
||||||
font-weight: 600;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* 搜索框容器:容纳扫码图标 */
|
let html = `
|
||||||
.input-with-icon {
|
<div class="table-wrapper">
|
||||||
position: relative;
|
<table class="result-table">
|
||||||
display: flex;
|
<thead>
|
||||||
align-items: center;
|
<tr>
|
||||||
}
|
<th>证书编号</th>
|
||||||
|
<th>持有人</th>
|
||||||
.form-control {
|
<th>荣誉标题</th>
|
||||||
padding: 10px 45px 10px 14px; /* 右侧留出空间给图标 */
|
<th>颁发日期</th>
|
||||||
border: 1px solid var(--border-color);
|
<th>操作</th>
|
||||||
border-radius: 8px;
|
</tr>
|
||||||
font-size: 15px;
|
</thead>
|
||||||
width: 100%;
|
<tbody>
|
||||||
height: 42px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scan-trigger {
|
|
||||||
position: absolute;
|
|
||||||
right: 10px;
|
|
||||||
cursor: pointer;
|
|
||||||
color: var(--primary-color);
|
|
||||||
padding: 5px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
transition: transform 0.2s;
|
|
||||||
}
|
|
||||||
.scan-trigger:hover { transform: scale(1.1); }
|
|
||||||
|
|
||||||
.btn-search {
|
|
||||||
height: 42px;
|
|
||||||
padding: 0 30px;
|
|
||||||
background: var(--primary-color);
|
|
||||||
color: #fff;
|
|
||||||
border: none;
|
|
||||||
border-radius: 8px;
|
|
||||||
font-weight: 600;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 扫码弹出层 */
|
|
||||||
#scanner-overlay {
|
|
||||||
display: none;
|
|
||||||
position: fixed;
|
|
||||||
top: 0; left: 0; width: 100%; height: 100%;
|
|
||||||
background: rgba(0,0,0,0.85);
|
|
||||||
z-index: 9999;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#reader {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 400px;
|
|
||||||
border-radius: 12px;
|
|
||||||
overflow: hidden;
|
|
||||||
background: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scanner-controls {
|
|
||||||
margin-top: 20px;
|
|
||||||
display: flex;
|
|
||||||
gap: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-cancel {
|
|
||||||
padding: 10px 24px;
|
|
||||||
background: #ef4444;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
border-radius: 6px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 表格样式 */
|
|
||||||
.table-wrapper { overflow-x: auto; margin-top: 10px; }
|
|
||||||
.result-table { width: 100%; border-collapse: collapse; min-width: 600px; }
|
|
||||||
.result-table th {
|
|
||||||
text-align: left; padding: 14px;
|
|
||||||
background: #f1f5f9; color: var(--text-muted);
|
|
||||||
font-size: 13px; border-bottom: 2px solid var(--border-color);
|
|
||||||
}
|
|
||||||
.result-table td { padding: 14px; border-bottom: 1px solid var(--bg-color); font-size: 14px; }
|
|
||||||
@media (max-width: 640px) { .hide-on-mobile { display: none; } }
|
|
||||||
.btn-link { color: var(--primary-color); text-decoration: none; cursor: pointer; font-weight: 600; }
|
|
||||||
.loading, .no-result { text-align: center; padding: 40px; color: var(--text-muted); }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h1>证书查询系统</h1>
|
|
||||||
<p>说明:可以输入编号或姓名进行查询,也可以点击右侧图标扫码查询;查询范围2024年10月至今</p>
|
|
||||||
|
|
||||||
<div class="search-section">
|
|
||||||
<div class="search-grid">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>编号 / 姓名</label>
|
|
||||||
<div class="input-with-icon">
|
|
||||||
<input type="text" id="searchTerm" class="form-control" placeholder="输入或扫码查询">
|
|
||||||
<div class="scan-trigger" id="startScanBtn" title="请扫描条形码">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7V5a2 2 0 0 1 2-2h2"></path><path d="M17 3h2a2 2 0 0 1 2 2v2"></path><path d="M21 17v2a2 2 0 0 1-2 2h-2"></path><path d="M7 21H5a2 2 0 0 1-2-2v-2"></path><rect x="7" y="7" width="10" height="10"></rect></svg>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>颁发起</label>
|
|
||||||
<input type="date" id="dateStart" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>颁发止</label>
|
|
||||||
<input type="date" id="dateEnd" class="form-control">
|
|
||||||
</div>
|
|
||||||
<button id="searchBtn" class="btn-search">查询</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="resultsArea">
|
|
||||||
<div class="no-result">请输入信息或点击右侧图标扫码</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="scanner-overlay">
|
|
||||||
<div id="reader"></div>
|
|
||||||
<div class="scanner-controls">
|
|
||||||
<button class="btn-cancel" id="stopScanBtn">退出扫描</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class="footer">
|
|
||||||
<p>© 2026 BI All rights reserved</p>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// Supabase 配置
|
|
||||||
const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co';
|
|
||||||
const SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNoaXhzc3JwaGZneHZxcWlna3pvIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQ2OTE0OTEsImV4cCI6MjA5MDI2NzQ5MX0.Az_Ew2J2zdOMcSV0UNAjBS-LPqGpqhsaN4IyZ5R7iqU';
|
|
||||||
const sbClient = supabase.createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
|
|
||||||
|
|
||||||
// 初始化扫码器
|
|
||||||
const html5QrCode = new Html5Qrcode("reader");
|
|
||||||
const scannerOverlay = document.getElementById('scanner-overlay');
|
|
||||||
|
|
||||||
// --- 扫码逻辑 ---
|
|
||||||
document.getElementById('startScanBtn').addEventListener('click', async () => {
|
|
||||||
scannerOverlay.style.display = 'flex';
|
|
||||||
|
|
||||||
// 扫码配置:qrbox 设为长方形有助于识别条形码
|
|
||||||
const config = {
|
|
||||||
fps: 15,
|
|
||||||
qrbox: { width: 300, height: 180 },
|
|
||||||
aspectRatio: 1.0
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
await html5QrCode.start(
|
|
||||||
{ facingMode: "environment" }, // 使用后置摄像头
|
|
||||||
config,
|
|
||||||
(decodedText) => {
|
|
||||||
// 识别成功
|
|
||||||
document.getElementById('searchTerm').value = decodedText;
|
|
||||||
closeScanner();
|
|
||||||
handleSearch(); // 自动执行查询
|
|
||||||
},
|
|
||||||
(errorMessage) => { /* 扫描中不抛出错误 */ }
|
|
||||||
);
|
|
||||||
} catch (err) {
|
|
||||||
alert("无法启动摄像头,请检查 HTTPS 权限或设备连接");
|
|
||||||
scannerOverlay.style.display = 'none';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
async function closeScanner() {
|
|
||||||
if (html5QrCode.isScanning) {
|
|
||||||
await html5QrCode.stop();
|
|
||||||
}
|
|
||||||
scannerOverlay.style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById('stopScanBtn').addEventListener('click', closeScanner);
|
|
||||||
|
|
||||||
// --- 查询逻辑 ---
|
|
||||||
async function handleSearch() {
|
|
||||||
const term = document.getElementById('searchTerm').value.trim();
|
|
||||||
const start = document.getElementById('dateStart').value;
|
|
||||||
const end = document.getElementById('dateEnd').value;
|
|
||||||
const display = document.getElementById('resultsArea');
|
|
||||||
|
|
||||||
if (!term) {
|
|
||||||
alert("请输入证书编号或持有人姓名");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
display.innerHTML = '<div class="loading">正在检索数据库...</div>';
|
|
||||||
|
|
||||||
try {
|
|
||||||
let query = sbClient.from('certificates').select('*');
|
|
||||||
query = query.or(`cert_number.ilike.%${term}%,holder_name.ilike.%${term}%`);
|
|
||||||
|
|
||||||
if (start) query = query.gte('issue_date', start);
|
|
||||||
if (end) query = query.lte('issue_date', end);
|
|
||||||
|
|
||||||
const { data, error } = await query.order('issue_date', { ascending: false });
|
|
||||||
|
|
||||||
if (error) throw error;
|
|
||||||
renderResults(data);
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
display.innerHTML = `<div style="color:#dc2626; text-align:center;">检索失败: ${err.message}</div>`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderResults(data) {
|
|
||||||
const display = document.getElementById('resultsArea');
|
|
||||||
if (!data || data.length === 0) {
|
|
||||||
display.innerHTML = '<div class="no-result">未找到匹配的证书</div>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let html = `
|
|
||||||
<div class="table-wrapper">
|
|
||||||
<table class="result-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>证书编号</th>
|
|
||||||
<th>持有人</th>
|
|
||||||
<th>荣誉标题</th>
|
|
||||||
<th>颁发日期</th>
|
|
||||||
<th>操作</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
`;
|
|
||||||
|
|
||||||
data.forEach(item => {
|
|
||||||
html += `
|
|
||||||
<tr>
|
|
||||||
<td><strong>${item.cert_number}</strong></td>
|
|
||||||
<td>${item.holder_name}</td>
|
|
||||||
<td>${item.honor_title}</td>
|
|
||||||
<td>${item.issue_date || '-'}</td>
|
|
||||||
<td><a class="btn-link" onclick="goToDetail('${item.id}')">详情</a></td>
|
|
||||||
</tr>
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
data.forEach(item => {
|
||||||
|
html += `
|
||||||
|
<tr>
|
||||||
|
<td class="table-highlight">${item.cert_number || '-'}</td>
|
||||||
|
<td>${item.holder_name || '-'}</td>
|
||||||
|
<td>${item.honor_title || '-'}</td>
|
||||||
|
<td>${item.issue_date || '-'}</td>
|
||||||
|
<td><button class="tech-link-button secondary" type="button" onclick="goToDetail('${item.id}')">查看详情</button></td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
});
|
||||||
|
|
||||||
|
html += '</tbody></table></div>';
|
||||||
|
display.innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function goToDetail(id) {
|
||||||
|
window.location.href = `certificate.html?id=${id}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('searchBtn').addEventListener('click', handleSearch);
|
||||||
|
document.getElementById('searchTerm').addEventListener('keypress', e => {
|
||||||
|
if (e.key === 'Enter') handleSearch();
|
||||||
});
|
});
|
||||||
|
</script>
|
||||||
html += '</tbody></table></div>';
|
<script src="https://cdn.jsdmirror.cn/gh/bishshi/wechat-detect@main/wechat-detect.js"></script>
|
||||||
display.innerHTML = html;
|
|
||||||
}
|
|
||||||
|
|
||||||
function goToDetail(id) {
|
|
||||||
window.location.href = `certificate.html?id=${id}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById('searchBtn').addEventListener('click', handleSearch);
|
|
||||||
document.getElementById('searchTerm').addEventListener('keypress', e => {
|
|
||||||
if (e.key === 'Enter') handleSearch();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<script src="https://cdn.jsdmirror.cn/gh/bishshi/wechat-detect@main/wechat-detect.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+1000
File diff suppressed because it is too large
Load Diff
+50
-23
@@ -3,33 +3,60 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>多彩场景信函样例</title>
|
<title>查询入口总览</title>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Zhi+Mang+Xing&display=swap" rel="stylesheet">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="stylesheet" href="./css/style.css">
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&family=Orbitron:wght@500;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="./css/tech-query.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<main class="landing-shell">
|
||||||
|
<section class="landing-hero">
|
||||||
|
<span class="eyebrow">Unified Gateway</span>
|
||||||
|
<h1>智能查询入口矩阵</h1>
|
||||||
|
<p>统一接入证书、单据与信函三类查询页面,整体切换为一致的科技感视觉风格,方便在同一入口快速跳转。</p>
|
||||||
|
<div class="hero-meta">
|
||||||
|
<span class="meta-chip">统一样式系统</span>
|
||||||
|
<span class="meta-chip">快速入口导航</span>
|
||||||
|
<span class="meta-chip">兼容桌面与移动端</span>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<div class="letter-container theme-campus">
|
<section class="landing-grid">
|
||||||
|
<a class="entry-card" href="./certs/index.html">
|
||||||
<h2 class="salutation">亲爱的[朋友/同学姓名]:</h2>
|
<div class="entry-kicker">Module 01</div>
|
||||||
|
<h2>证书查询</h2>
|
||||||
|
<p>按编号、姓名或扫码方式检索证书记录,进入详情页查看核验信息与证书原件。</p>
|
||||||
|
<div class="entry-meta">
|
||||||
|
<span>进入证书模块</span>
|
||||||
|
<span class="entry-arrow">→</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
<div class="content">
|
<a class="entry-card" href="./ticket/index.html">
|
||||||
<p>好久不见!最近过得怎么样?</p>
|
<div class="entry-kicker">Module 02</div>
|
||||||
<p>转眼间夏天就要到了,还记得那时候我们一起在操场上挥洒汗水、在教室里畅谈未来的日子吗?那段时光,真的就像昨天刚发生一样。</p>
|
<h2>单据查询</h2>
|
||||||
<p>这次致信,是想告诉你一个好消息。下周六我要举办一个久违的聚会,希望你一定要来!哪怕只是聊聊天,喝杯茶,也是极好的。时光易逝,友情常驻。愿你每天都充满活力,事事顺心!</p>
|
<p>查看单据金额、处理状态与明细信息,保留扫码能力与原有详情跳转。</p>
|
||||||
</div>
|
<div class="entry-meta">
|
||||||
|
<span>进入单据模块</span>
|
||||||
|
<span class="entry-arrow">→</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
<div class="closing">
|
<a class="entry-card" href="./xinhan/index.html">
|
||||||
<p class="wish-prefix">此致</p>
|
<div class="entry-kicker">Module 03</div>
|
||||||
<p class="wish-suffix">敬礼!</p>
|
<h2>信函查询</h2>
|
||||||
</div>
|
<p>按收件人、关键字和寄送时间查询信函流转记录,集中展示路径与摘要。</p>
|
||||||
|
<div class="entry-meta">
|
||||||
<div class="footer">
|
<span>进入信函模块</span>
|
||||||
<p class="signature">[您的署名]</p>
|
<span class="entry-arrow">→</span>
|
||||||
<p class="date">2026年3月25日</p>
|
</div>
|
||||||
</div>
|
</a>
|
||||||
|
</section>
|
||||||
</div>
|
</main>
|
||||||
|
|
||||||
|
<footer class="page-footer">
|
||||||
|
<p>© 2026 BI Intelligent Query Interface</p>
|
||||||
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+106
-212
@@ -4,239 +4,133 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>单据详情</title>
|
<title>单据详情</title>
|
||||||
|
<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=Noto+Sans+SC:wght@400;500;600;700&family=Orbitron:wght@500;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="../css/tech-query.css">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
|
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
|
||||||
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
background: #f0f2f5;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-container {
|
|
||||||
max-width: 900px;
|
|
||||||
margin: 60px auto;
|
|
||||||
padding: 32px;
|
|
||||||
background: #fff;
|
|
||||||
border-radius: 12px;
|
|
||||||
box-shadow: 0 8px 24px rgba(0,0,0,0.08);
|
|
||||||
}
|
|
||||||
|
|
||||||
.back-link {
|
|
||||||
display: inline-block;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
color: #4CAF50;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-header {
|
|
||||||
border-bottom: 2px solid #4CAF50;
|
|
||||||
padding-bottom: 15px;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-title {
|
|
||||||
font-size: 22px;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-title {
|
|
||||||
font-size: 16px;
|
|
||||||
color: #4CAF50;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
|
||||||
gap: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-item {
|
|
||||||
padding: 14px;
|
|
||||||
background: #fafafa;
|
|
||||||
border-radius: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-label {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #888;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-value {
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status {
|
|
||||||
padding: 4px 10px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.done {
|
|
||||||
background: #e8f5e9;
|
|
||||||
color: #2e7d32;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pending {
|
|
||||||
background: #fff3e0;
|
|
||||||
color: #ef6c00;
|
|
||||||
}
|
|
||||||
|
|
||||||
.action-buttons {
|
|
||||||
margin-top: 30px;
|
|
||||||
display: flex;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
padding: 10px 20px;
|
|
||||||
border-radius: 6px;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
background: #4CAF50;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary {
|
|
||||||
background: #6c757d;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading, .error-message {
|
|
||||||
text-align: center;
|
|
||||||
padding: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-message {
|
|
||||||
color: #c33;
|
|
||||||
background: #fee;
|
|
||||||
border-radius: 6px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<main class="detail-shell">
|
||||||
|
<div class="top-actions">
|
||||||
|
<a href="./index.html" class="tech-link-button secondary">返回查询页</a>
|
||||||
|
<div class="top-actions-group">
|
||||||
|
<button class="tech-button secondary" type="button" onclick="history.back()">返回上一页</button>
|
||||||
|
<button class="tech-button" type="button" onclick="goPrint()">打印单据</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="detail-container">
|
<div id="detailContent" class="detail-panel feedback-card">
|
||||||
<a href="./index.html" class="back-link">← 返回查询页面</a>
|
正在加载单据详情...
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
<div id="detailContent">
|
<footer class="page-footer">
|
||||||
<div class="loading">正在加载详情...</div>
|
<p>© 2026 BI Intelligent Query Interface</p>
|
||||||
</div>
|
</footer>
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co';
|
const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co';
|
||||||
const SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNoaXhzc3JwaGZneHZxcWlna3pvIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQ2OTE0OTEsImV4cCI6MjA5MDI2NzQ5MX0.Az_Ew2J2zdOMcSV0UNAjBS-LPqGpqhsaN4IyZ5R7iqU';
|
const SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNoaXhzc3JwaGZneHZxcWlna3pvIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQ2OTE0OTEsImV4cCI6MjA5MDI2NzQ5MX0.Az_Ew2J2zdOMcSV0UNAjBS-LPqGpqhsaN4IyZ5R7iqU';
|
||||||
|
|
||||||
// 防重复初始化(关键修复)
|
if (!window._sbClient) {
|
||||||
if (!window._sbClient) {
|
window._sbClient = window.supabase.createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
|
||||||
window._sbClient = window.supabase.createClient(
|
|
||||||
SUPABASE_URL,
|
|
||||||
SUPABASE_ANON_KEY
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const sbClient = window._sbClient;
|
|
||||||
|
|
||||||
async function loadTicketDetail() {
|
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
|
||||||
const ticketId = urlParams.get('id');
|
|
||||||
|
|
||||||
if (!ticketId) {
|
|
||||||
showError('未提供单据 ID');
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
const sbClient = window._sbClient;
|
||||||
|
|
||||||
try {
|
async function loadTicketDetail() {
|
||||||
const { data: ticket, error } = await sbClient
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
.from('tickets')
|
const ticketId = urlParams.get('id');
|
||||||
.select('*')
|
|
||||||
.eq('id', ticketId)
|
|
||||||
.single();
|
|
||||||
|
|
||||||
if (error) throw error;
|
if (!ticketId) {
|
||||||
|
showError('未提供单据 ID。');
|
||||||
if (!ticket) {
|
|
||||||
showError('未找到该单据');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
displayTicketDetail(ticket);
|
try {
|
||||||
|
const { data: ticket, error } = await sbClient
|
||||||
|
.from('tickets')
|
||||||
|
.select('*')
|
||||||
|
.eq('id', ticketId)
|
||||||
|
.single();
|
||||||
|
|
||||||
} catch (error) {
|
if (error) throw error;
|
||||||
showError(error.message);
|
if (!ticket) {
|
||||||
|
showError('未找到该单据。');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayTicketDetail(ticket);
|
||||||
|
} catch (error) {
|
||||||
|
showError(error.message || '加载失败');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function displayTicketDetail(ticket) {
|
function displayTicketDetail(ticket) {
|
||||||
const el = document.getElementById('detailContent');
|
const el = document.getElementById('detailContent');
|
||||||
|
const processedLabel = ticket.processed ? '已处理' : '未处理';
|
||||||
|
const completionLabel = ticket.status ? '已办结' : '未办结';
|
||||||
|
const amount = Number(ticket.amount || 0).toLocaleString('zh-CN', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'CNY'
|
||||||
|
});
|
||||||
|
|
||||||
el.innerHTML = `
|
el.classList.remove('feedback-card');
|
||||||
<div class="detail-header">
|
el.innerHTML = `
|
||||||
<h1 class="detail-title">
|
<div class="ticket-header">
|
||||||
${ticket.ticket_number || ''} / ${ticket.customer_name || ''}
|
<div>
|
||||||
</h1>
|
<div class="section-kicker">Ticket Detail</div>
|
||||||
</div>
|
<h1 class="ticket-title">${ticket.ticket_number || '-'} / ${ticket.customer_name || '-'}</h1>
|
||||||
|
<p class="ticket-subtitle">单据全量信息、处理状态与打印操作在此统一展示。</p>
|
||||||
|
</div>
|
||||||
|
<div class="top-actions-group">
|
||||||
|
<span class="status-pill ${ticket.processed ? 'done' : 'pending'}">${processedLabel}</span>
|
||||||
|
<span class="status-pill ${ticket.status ? 'done' : 'pending'}">${completionLabel}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="info-grid">
|
<div class="ticket-detail-grid">
|
||||||
${item('编号', ticket.ticket_number)}
|
${item('编号', ticket.ticket_number)}
|
||||||
${item('姓名', ticket.customer_name)}
|
${item('姓名', ticket.customer_name)}
|
||||||
${item('事由', ticket.reason)}
|
${item('事由', ticket.reason)}
|
||||||
${item('处理结果', ticket.result)}
|
${item('处理结果', ticket.result)}
|
||||||
${item('金额', '¥' + Number(ticket.amount || 0).toFixed(2))}
|
${item('金额', amount, 'money')}
|
||||||
${item('开具人', ticket.issuer)}
|
${item('开具人', ticket.issuer)}
|
||||||
${item('日期', formatDate(ticket.created_at))}
|
${item('创建时间', formatDate(ticket.created_at))}
|
||||||
${item('状态', `
|
${item('办结日期', formatDate(ticket.processed_at))}
|
||||||
<span class="status ${ticket.processed ? 'done' : 'pending'}">
|
${item('处理状态', `<span class="status-pill ${ticket.processed ? 'done' : 'pending'}">${processedLabel}</span>`, '', true)}
|
||||||
${ticket.status ? '已处理' : '待处理'}
|
${item('办结状态', `<span class="status-pill ${ticket.status ? 'done' : 'pending'}">${completionLabel}</span>`, '', true)}
|
||||||
</span>
|
${item('备注', ticket.remarks || '无', '', false, true)}
|
||||||
`, true)}
|
</div>
|
||||||
${item('办结否', `
|
`;
|
||||||
<span class="status ${ticket.status ? 'TRUE' : 'FALSE'}">
|
}
|
||||||
${ticket.processed ? '已办结' : '未办结'}
|
|
||||||
</span>
|
|
||||||
`, true)}
|
|
||||||
${item('办结日期', formatDate(ticket.processed_at) || '暂无')}
|
|
||||||
${item('备注', ticket.remarks || '无')}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="action-buttons">
|
function item(label, value, extraClass = '', isHTML = false, isWide = false) {
|
||||||
<button class="btn btn-primary" onclick="goPrint()">打印</button>
|
return `
|
||||||
<button class="btn btn-secondary" onclick="history.back()">返回</button>
|
<div class="detail-item${isWide ? ' wide' : ''}">
|
||||||
</div>
|
<span class="detail-label">${label}</span>
|
||||||
`;
|
<div class="detail-value${extraClass ? ` ${extraClass}` : ''}">${isHTML ? value : (value || '无')}</div>
|
||||||
}
|
</div>
|
||||||
|
`;
|
||||||
function goPrint() {
|
}
|
||||||
window.open(`print.html?id=${new URLSearchParams(location.search).get('id')}`, '_blank');
|
|
||||||
}
|
|
||||||
|
|
||||||
function item(label, value, isHTML = false) {
|
function goPrint() {
|
||||||
return `
|
window.open(`print.html?id=${new URLSearchParams(location.search).get('id')}`, '_blank');
|
||||||
<div class="info-item">
|
}
|
||||||
<div class="info-label">${label}</div>
|
|
||||||
<div class="info-value">${isHTML ? value : (value || '无')}</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatDate(dateString) {
|
function formatDate(dateString) {
|
||||||
if (!dateString) return '暂无';
|
if (!dateString) return '暂无';
|
||||||
return new Date(dateString).toLocaleString('zh-CN');
|
return new Date(dateString).toLocaleString('zh-CN');
|
||||||
}
|
}
|
||||||
|
|
||||||
function showError(msg) {
|
function showError(msg) {
|
||||||
document.getElementById('detailContent').innerHTML =
|
const el = document.getElementById('detailContent');
|
||||||
`<div class="error-message">${msg}</div>`;
|
el.classList.add('feedback-card');
|
||||||
}
|
el.innerHTML = `<div class="error-state">${msg}</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', loadTicketDetail);
|
document.addEventListener('DOMContentLoaded', loadTicketDetail);
|
||||||
</script>
|
</script>
|
||||||
<script src="https://cdn.jsdmirror.cn/gh/bishshi/wechat-detect@main/wechat-detect.js"></script>
|
<script src="https://cdn.jsdmirror.cn/gh/bishshi/wechat-detect@main/wechat-detect.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+185
-213
@@ -4,234 +4,206 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||||
<title>单据查询系统</title>
|
<title>单据查询系统</title>
|
||||||
|
<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=Noto+Sans+SC:wght@400;500;600;700&family=Orbitron:wght@500;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="../css/tech-query.css">
|
||||||
<script src="https://cdn.jsdmirror.cn/gh/bishshi/wechat-detect@main/wechat-detect.js"></script>
|
<script src="https://cdn.jsdmirror.cn/gh/bishshi/wechat-detect@main/wechat-detect.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
|
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
|
||||||
<script src="https://unpkg.com/html5-qrcode"></script>
|
<script src="https://unpkg.com/html5-qrcode"></script>
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color: #f0f2f5;
|
|
||||||
--card-bg: #ffffff;
|
|
||||||
--text-main: #1e293b;
|
|
||||||
--text-muted: #64748b;
|
|
||||||
--border-color: #e2e8f0;
|
|
||||||
--primary: #1a73e8;
|
|
||||||
--success: #10b981;
|
|
||||||
--warning: #f59e0b;
|
|
||||||
--danger: #ef4444;
|
|
||||||
}
|
|
||||||
|
|
||||||
html, body { margin: 0; padding: 0; height: 100%; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
|
|
||||||
body { background: var(--bg-color); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--text-main); box-sizing: border-box; }
|
|
||||||
|
|
||||||
.ticket-container {
|
|
||||||
max-width: 1000px; margin: 30px auto; padding: 28px;
|
|
||||||
background: var(--card-bg); border-radius: 16px;
|
|
||||||
box-shadow: 0 4px 20px rgba(0,0,0,0.08); box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 { text-align: center; font-size: clamp(22px, 5vw, 28px); font-weight: 600; margin-bottom: 12px; }
|
|
||||||
.page-desc { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
|
|
||||||
|
|
||||||
/* 搜索卡片 */
|
|
||||||
.search-card {
|
|
||||||
background: #fafbfc; border-radius: 10px; padding: 16px; border: 1px solid var(--border-color);
|
|
||||||
margin-bottom: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
|
||||||
gap: 12px; align-items: end;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-group { display: flex; flex-direction: column; gap: 4px; }
|
|
||||||
.form-group label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
|
|
||||||
|
|
||||||
.input-with-icon { position: relative; display: flex; align-items: center; }
|
|
||||||
.form-control {
|
|
||||||
padding: 6px 12px; border: 1px solid var(--border-color); border-radius: 6px;
|
|
||||||
font-size: 14px; height: 36px; flex: 1; box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scan-trigger {
|
|
||||||
position: absolute; right: 8px; cursor: pointer; color: var(--primary);
|
|
||||||
padding: 4px; display: flex; align-items: center; background: none; border: none; z-index: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
height: 36px; padding: 0 24px; background: var(--primary); border: none;
|
|
||||||
border-radius: 6px; color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 表格样式恢复 */
|
|
||||||
.table-wrapper { overflow-x: auto; margin-top: 16px; border-radius: 8px; border: 1px solid var(--border-color); }
|
|
||||||
.result-table { width: 100%; border-collapse: collapse; min-width: 700px; font-size: 14px; }
|
|
||||||
.result-table th { background: #f8fafc; text-align: left; padding: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid var(--border-color); font-size: 13px; }
|
|
||||||
.result-table td { padding: 12px; border-bottom: 1px solid var(--border-color); color: var(--text-main); vertical-align: middle; }
|
|
||||||
|
|
||||||
/* 状态标签样式 */
|
|
||||||
.status { padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; display: inline-block; white-space: nowrap; }
|
|
||||||
.status.done { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #166534; }
|
|
||||||
.status.pending { background: linear-gradient(135deg, #ffedd5, #fed7aa); color: #c2410c; }
|
|
||||||
|
|
||||||
.loading, .no-result { text-align: center; padding: 40px; color: var(--text-muted); font-size: 15px; }
|
|
||||||
|
|
||||||
/* --- 扫码正方形 UI --- */
|
|
||||||
#scanner-overlay {
|
|
||||||
display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
|
|
||||||
background: rgba(0,0,0,0.9); z-index: 9999;
|
|
||||||
flex-direction: column; justify-content: center; align-items: center; touch-action: none;
|
|
||||||
}
|
|
||||||
.scanner-wrapper {
|
|
||||||
position: relative; width: 280px; height: 280px;
|
|
||||||
border-radius: 12px; overflow: hidden; background: #000;
|
|
||||||
border: 2px solid rgba(255,255,255,0.2);
|
|
||||||
}
|
|
||||||
#reader { width: 100% !important; height: 100% !important; }
|
|
||||||
.scan-line {
|
|
||||||
position: absolute; width: 100%; height: 2px;
|
|
||||||
background: linear-gradient(to right, transparent, var(--primary), transparent);
|
|
||||||
top: 0; left: 0; z-index: 10; animation: scanMove 2s infinite linear;
|
|
||||||
}
|
|
||||||
@keyframes scanMove { 0% { top: 0; } 100% { top: 100%; } }
|
|
||||||
.btn-cancel { margin-top: 30px; padding: 10px 40px; background: #ef4444; color: white; border: none; border-radius: 20px; font-size: 14px; }
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.ticket-container { margin: 15px; padding: 20px; width: calc(100% - 30px); }
|
|
||||||
.search-card { grid-template-columns: 1fr; }
|
|
||||||
.hide-mobile { display: none; }
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<main class="page-shell">
|
||||||
<div class="ticket-container">
|
<section class="page-header">
|
||||||
<h1>单据查询</h1>
|
<div class="hero-card">
|
||||||
<p class="page-desc">请输入查询条件,可查询 2024 年至今的单据</p>
|
<span class="eyebrow">Ticket Search</span>
|
||||||
|
<h1>单据状态追踪中心</h1>
|
||||||
<div class="search-card">
|
<p>支持按单据编号、姓名和时间范围查询,扫码可直接识别单据信息并进入检索流程。</p>
|
||||||
<div class="form-group">
|
<div class="hero-meta">
|
||||||
<label for="searchTerm">编号 / 姓名</label>
|
<span class="meta-chip">覆盖范围:2024 年至今</span>
|
||||||
<div class="input-with-icon">
|
<span class="meta-chip">输出内容:金额 / 状态 / 详情入口</span>
|
||||||
<input type="text" id="searchTerm" class="form-control" placeholder="请输入编号或姓名">
|
|
||||||
<div class="scan-trigger" id="startScanBtn">
|
|
||||||
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 7V5a2 2 0 0 1 2-2h2m10 0h2a2 2 0 0 1 2 2v2m0 10v2a2 2 0 0 1-2 2h-2M7 21H5a2 2 0 0 1-2-2v-2M7 7h10v10H7z"/></svg>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<aside class="stat-card">
|
||||||
|
<div>
|
||||||
|
<div class="stat-label">Module</div>
|
||||||
|
<div class="stat-value">TICKET</div>
|
||||||
|
</div>
|
||||||
|
<p></p>
|
||||||
|
</aside>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="panel-card">
|
||||||
|
<div class="panel-title-row">
|
||||||
|
<div>
|
||||||
|
<h2 class="panel-title">检索条件</h2>
|
||||||
|
<div class="panel-subtitle">支持文本检索与扫码录入</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="search-grid">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="searchTerm">编号 / 姓名</label>
|
||||||
|
<div class="input-with-action">
|
||||||
|
<input type="text" id="searchTerm" class="tech-input" placeholder="请输入单据编号或姓名">
|
||||||
|
<button type="button" class="icon-action" id="startScanBtn" title="扫码查询" aria-label="扫码查询">
|
||||||
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 7V5a2 2 0 0 1 2-2h2m10 0h2a2 2 0 0 1 2 2v2m0 10v2a2 2 0 0 1-2 2h-2M7 21H5a2 2 0 0 1-2-2v-2M7 7h10v10H7z"/></svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="dateFrom">开始日期</label>
|
||||||
|
<input type="date" id="dateFrom" class="tech-input">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="dateTo">结束日期</label>
|
||||||
|
<input type="date" id="dateTo" class="tech-input">
|
||||||
|
</div>
|
||||||
|
<button id="searchBtn" class="tech-button">执行查询</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="panel-card results-card">
|
||||||
|
<div class="panel-title-row">
|
||||||
|
<div>
|
||||||
|
<h2 class="panel-title">查询结果</h2>
|
||||||
|
<div class="panel-subtitle">金额、状态与详情一屏展示</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="searchResults" class="results-shell">
|
||||||
|
<div class="empty-state">输入查询条件后开始检索,或使用扫码功能快速定位单据。</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div id="scanner-overlay" class="scanner-overlay">
|
||||||
|
<div class="scanner-frame">
|
||||||
|
<div id="reader"></div>
|
||||||
|
<div class="scanner-line"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="scanner-text">请将二维码保持在扫描框内</div>
|
||||||
<label for="dateFrom">开始日期</label>
|
<button class="tech-button secondary" id="stopScanBtn" type="button">退出扫描</button>
|
||||||
<input type="date" id="dateFrom" class="form-control">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="dateTo">结束日期</label>
|
|
||||||
<input type="date" id="dateTo" class="form-control">
|
|
||||||
</div>
|
|
||||||
<button id="searchBtn" class="btn">立即查询</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="searchResults"></div>
|
<footer class="page-footer">
|
||||||
</div>
|
<p>© 2026 BI Intelligent Query Interface</p>
|
||||||
|
</footer>
|
||||||
|
|
||||||
<div id="scanner-overlay">
|
<script>
|
||||||
<div class="scanner-wrapper">
|
const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co';
|
||||||
<div id="reader"></div>
|
const SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNoaXhzc3JwaGZneHZxcWlna3pvIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQ2OTE0OTEsImV4cCI6MjA5MDI2NzQ5MX0.Az_Ew2J2zdOMcSV0UNAjBS-LPqGpqhsaN4IyZ5R7iqU';
|
||||||
<div class="scan-line"></div>
|
const sbClient = supabase.createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
|
||||||
</div>
|
|
||||||
<div style="color:white; margin-top:15px; font-size:14px; opacity:0.8">请将二维码置于框内</div>
|
|
||||||
<button class="btn-cancel" id="stopScanBtn">退出扫描</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
let html5QrCode = null;
|
||||||
const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co';
|
|
||||||
const SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNoaXhzc3JwaGZneHZxcWlna3pvIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQ2OTE0OTEsImV4cCI6MjA5MDI2NzQ5MX0.Az_Ew2J2zdOMcSV0UNAjBS-LPqGpqhsaN4IyZ5R7iqU';
|
|
||||||
const sbClient = supabase.createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
|
|
||||||
|
|
||||||
let html5QrCode = null;
|
document.getElementById('startScanBtn').addEventListener('click', async () => {
|
||||||
|
document.getElementById('scanner-overlay').style.display = 'flex';
|
||||||
// 扫码逻辑
|
if (html5QrCode) {
|
||||||
document.getElementById('startScanBtn').addEventListener('click', async () => {
|
try {
|
||||||
document.getElementById('scanner-overlay').style.display = 'flex';
|
await html5QrCode.stop();
|
||||||
if (html5QrCode) { try { await html5QrCode.stop(); } catch(e) {} }
|
} catch (e) {}
|
||||||
html5QrCode = new Html5Qrcode("reader");
|
}
|
||||||
const config = { fps: 15, qrbox: { width: 250, height: 250 }, aspectRatio: 1.0 };
|
html5QrCode = new Html5Qrcode("reader");
|
||||||
try {
|
const config = { fps: 15, qrbox: { width: 250, height: 250 }, aspectRatio: 1.0 };
|
||||||
await html5QrCode.start({ facingMode: "environment" }, config, (text) => {
|
try {
|
||||||
document.getElementById('searchTerm').value = text;
|
await html5QrCode.start({ facingMode: "environment" }, config, (text) => {
|
||||||
closeScanner();
|
document.getElementById('searchTerm').value = text;
|
||||||
handleSearch();
|
closeScanner();
|
||||||
});
|
handleSearch();
|
||||||
} catch (err) { alert("摄像头启动失败"); closeScanner(); }
|
});
|
||||||
});
|
} catch (err) {
|
||||||
|
alert("摄像头启动失败。");
|
||||||
async function closeScanner() {
|
closeScanner();
|
||||||
if (html5QrCode && html5QrCode.isScanning) { await html5QrCode.stop(); }
|
|
||||||
document.getElementById('scanner-overlay').style.display = 'none';
|
|
||||||
}
|
|
||||||
document.getElementById('stopScanBtn').addEventListener('click', closeScanner);
|
|
||||||
|
|
||||||
// 查询与结果渲染逻辑(完整找回)
|
|
||||||
async function handleSearch() {
|
|
||||||
const searchTerm = document.getElementById('searchTerm').value.trim();
|
|
||||||
const dateFrom = document.getElementById('dateFrom').value;
|
|
||||||
const dateTo = document.getElementById('dateTo').value;
|
|
||||||
const resultsDiv = document.getElementById('searchResults');
|
|
||||||
|
|
||||||
resultsDiv.innerHTML = '<div class="loading">正在查询...</div>';
|
|
||||||
|
|
||||||
try {
|
|
||||||
let query = sbClient.from('tickets').select('*');
|
|
||||||
if (searchTerm) {
|
|
||||||
query = query.or(`ticket_number.ilike.%${searchTerm}%,customer_name.ilike.%${searchTerm}%`);
|
|
||||||
}
|
}
|
||||||
if (dateFrom) query = query.gte('created_at', dateFrom);
|
|
||||||
if (dateTo) query = query.lte('created_at', dateTo);
|
|
||||||
|
|
||||||
const { data, error } = await query.order('created_at', { ascending: false });
|
|
||||||
if (error) throw error;
|
|
||||||
|
|
||||||
displayResults(data);
|
|
||||||
} catch (error) {
|
|
||||||
resultsDiv.innerHTML = `<div style="color:red;padding:20px;">查询失败:${error.message}</div>`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function displayResults(tickets) {
|
|
||||||
const resultsDiv = document.getElementById('searchResults');
|
|
||||||
if (!tickets || tickets.length === 0) {
|
|
||||||
resultsDiv.innerHTML = '<div class="no-result">🔍 未找到符合条件的单据</div>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let html = `
|
|
||||||
<div class="table-wrapper">
|
|
||||||
<table class="result-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>编号</th><th>姓名</th><th>事由</th><th>金额</th><th class="hide-mobile">日期</th><th>状态</th><th>操作</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
`;
|
|
||||||
|
|
||||||
tickets.forEach(ticket => {
|
|
||||||
const amount = (ticket.amount || 0).toLocaleString('zh-CN', { style: 'currency', currency: 'CNY' });
|
|
||||||
const reason = ticket.reason || '';
|
|
||||||
const displayReason = reason.length > 15 ? `<span title="${reason}">${reason.substring(0, 15)}...</span>` : reason;
|
|
||||||
|
|
||||||
html += `
|
|
||||||
<tr>
|
|
||||||
<td><strong>${ticket.ticket_number || ''}</strong></td>
|
|
||||||
<td>${ticket.customer_name || ''}</td>
|
|
||||||
<td>${displayReason}</td>
|
|
||||||
<td style="font-weight: 600; color: var(--primary);">${amount}</td>
|
|
||||||
<td class="hide-mobile">${new Date(ticket.created_at).toLocaleDateString('zh-CN')}</td>
|
|
||||||
<td><span class="status ${ticket.processed ? 'done' : 'pending'}">${ticket.processed ? '✓ 已处理' : '⏳ 未处理'}</span></td>
|
|
||||||
<td><button class="btn" onclick="location.href='detail.html?id=${ticket.id}'" style="padding: 6px 12px; font-size: 13px;">查看详情</button></td>
|
|
||||||
</tr>
|
|
||||||
`;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
html += '</tbody></table></div>';
|
async function closeScanner() {
|
||||||
resultsDiv.innerHTML = html;
|
if (html5QrCode && html5QrCode.isScanning) {
|
||||||
}
|
await html5QrCode.stop();
|
||||||
|
}
|
||||||
|
document.getElementById('scanner-overlay').style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById('searchBtn').addEventListener('click', handleSearch);
|
document.getElementById('stopScanBtn').addEventListener('click', closeScanner);
|
||||||
</script>
|
|
||||||
|
async function handleSearch() {
|
||||||
|
const searchTerm = document.getElementById('searchTerm').value.trim();
|
||||||
|
const dateFrom = document.getElementById('dateFrom').value;
|
||||||
|
const dateTo = document.getElementById('dateTo').value;
|
||||||
|
const resultsDiv = document.getElementById('searchResults');
|
||||||
|
|
||||||
|
resultsDiv.innerHTML = '<div class="loading-state">正在连接单据数据库并执行检索...</div>';
|
||||||
|
|
||||||
|
try {
|
||||||
|
let query = sbClient.from('tickets').select('*');
|
||||||
|
if (searchTerm) {
|
||||||
|
query = query.or(`ticket_number.ilike.%${searchTerm}%,customer_name.ilike.%${searchTerm}%`);
|
||||||
|
}
|
||||||
|
if (dateFrom) query = query.gte('created_at', dateFrom);
|
||||||
|
if (dateTo) query = query.lte('created_at', dateTo);
|
||||||
|
|
||||||
|
const { data, error } = await query.order('created_at', { ascending: false });
|
||||||
|
if (error) throw error;
|
||||||
|
|
||||||
|
displayResults(data);
|
||||||
|
} catch (error) {
|
||||||
|
resultsDiv.innerHTML = `<div class="error-state">查询失败:${error.message}</div>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayResults(tickets) {
|
||||||
|
const resultsDiv = document.getElementById('searchResults');
|
||||||
|
if (!tickets || tickets.length === 0) {
|
||||||
|
resultsDiv.innerHTML = '<div class="empty-state">未找到符合条件的单据记录。</div>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let html = `
|
||||||
|
<div class="table-wrapper">
|
||||||
|
<table class="result-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>编号</th>
|
||||||
|
<th>姓名</th>
|
||||||
|
<th>事由</th>
|
||||||
|
<th>金额</th>
|
||||||
|
<th>日期</th>
|
||||||
|
<th>状态</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
`;
|
||||||
|
|
||||||
|
tickets.forEach(ticket => {
|
||||||
|
const amount = (ticket.amount || 0).toLocaleString('zh-CN', { style: 'currency', currency: 'CNY' });
|
||||||
|
const reason = ticket.reason || '';
|
||||||
|
const displayReason = reason.length > 18
|
||||||
|
? `<span class="text-truncate" title="${reason}">${reason}</span>`
|
||||||
|
: reason;
|
||||||
|
|
||||||
|
html += `
|
||||||
|
<tr>
|
||||||
|
<td class="table-highlight">${ticket.ticket_number || ''}</td>
|
||||||
|
<td>${ticket.customer_name || ''}</td>
|
||||||
|
<td>${displayReason}</td>
|
||||||
|
<td class="table-highlight">${amount}</td>
|
||||||
|
<td>${ticket.created_at ? new Date(ticket.created_at).toLocaleDateString('zh-CN') : '-'}</td>
|
||||||
|
<td>
|
||||||
|
<span class="status-pill ${ticket.processed ? 'done' : 'pending'}">
|
||||||
|
${ticket.processed ? '已处理' : '未处理'}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td><button class="tech-link-button secondary" type="button" onclick="location.href='detail.html?id=${ticket.id}'">查看详情</button></td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
});
|
||||||
|
|
||||||
|
html += '</tbody></table></div>';
|
||||||
|
resultsDiv.innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('searchBtn').addEventListener('click', handleSearch);
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+144
-87
@@ -1,99 +1,156 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>信函查询</title>
|
<title>信函查询系统</title>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<style>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
:root { --bg: #f7f7f7; --card: #fff; --primary: #1a73e8; --text: #222; font-size: 14px; }
|
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&family=Orbitron:wght@500;700&display=swap" rel="stylesheet">
|
||||||
html, body { margin: 0; padding: 0; height: 100%; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
|
<link rel="stylesheet" href="../css/tech-query.css">
|
||||||
.container { max-width: 1000px; margin: 20px auto; padding: 0 12px; }
|
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
|
||||||
.card { background: var(--card); border-radius: 8px; padding: 16px; box-shadow: 0 2px 6px rgba(0,0,0,.05); }
|
|
||||||
h1 { font-size: 20px; margin: 0 0 12px; }
|
|
||||||
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 12px; }
|
|
||||||
.form-control { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
|
|
||||||
.btn { padding: 8px 14px; background: var(--primary); color: white; border-radius: 6px; border: none; font-weight: 600; cursor: pointer; }
|
|
||||||
.table-wrapper { margin-top: 12px; overflow-x: auto; }
|
|
||||||
table { width: 100%; border-collapse: collapse; font-size: 14px; }
|
|
||||||
th, td { padding: 10px 12px; border-bottom: 1px solid #eee; text-align: left; }
|
|
||||||
th { background: #f6f7f9; }
|
|
||||||
.loading { text-align: center; color: #666; padding: 20px; }
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
.form-row { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
|
|
||||||
}
|
|
||||||
@media (max-width: 700px) {
|
|
||||||
.form-row { grid-template-columns: 1fr; }
|
|
||||||
}
|
|
||||||
/* 更紧凑的表格在小屏上隐藏部分列,保持可读性,同时允许横向滚动查看完整信息 */
|
|
||||||
@media (max-width: 600px) {
|
|
||||||
table thead th:nth-child(4), table tbody td:nth-child(4),
|
|
||||||
table thead th:nth-child(5), table tbody td:nth-child(5) { display: none; }
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<main class="page-shell">
|
||||||
<div class="card">
|
<section class="page-header">
|
||||||
<h1>信函查询</h1>
|
<div class="hero-card">
|
||||||
<div class="form-row">
|
<span class="eyebrow">Letter Search</span>
|
||||||
<div>
|
<h1>信函流转查询台</h1>
|
||||||
<label>收件人</label><br />
|
<p>可按收件人、关键字与寄送时间进行检索,统一展示寄达信息与内容摘要,方便快速确认记录。</p>
|
||||||
<input id="recipientTerm" class="form-control" placeholder="收件人" />
|
<div class="hero-meta">
|
||||||
</div>
|
<span class="meta-chip">检索字段:收件人 / 内容关键字</span>
|
||||||
<div>
|
<span class="meta-chip">输出内容:目的地 / 时间 / 摘要</span>
|
||||||
<label>编号/关键词</label><br />
|
</div>
|
||||||
<input id="searchTerm" class="form-control" placeholder="内容搜索" />
|
</div>
|
||||||
</div>
|
<aside class="stat-card">
|
||||||
<div>
|
<div>
|
||||||
<label>开始日期</label><br />
|
<div class="stat-label">Module</div>
|
||||||
<input id="dateFrom" type="date" class="form-control" />
|
<div class="stat-value">LETTER</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<p></p>
|
||||||
<label>结束日期</label><br />
|
</aside>
|
||||||
<input id="dateTo" type="date" class="form-control" />
|
</section>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button id="searchBtn" class="btn">立即查询</button>
|
|
||||||
</div>
|
|
||||||
<div id="searchResults" class="card table-wrapper"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<section class="panel-card">
|
||||||
const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co';
|
<div class="panel-title-row">
|
||||||
const SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNoaXhzc3JwaGZneHZxcWlna3pvIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQ2OTE0OTEsImV4cCI6MjA5MDI2NzQ5MX0.Az_Ew2J2zdOMcSV0UNAjBS-LPqGpqhsaN4IyZ5R7iqU';
|
<div>
|
||||||
const sb = supabase.createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
|
<h2 class="panel-title">检索条件</h2>
|
||||||
|
<div class="panel-subtitle">多字段组合查询,快速过滤信函记录</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
async function handleSearch(){
|
<div class="search-grid compact">
|
||||||
const recipientTerm = document.getElementById('recipientTerm').value.trim();
|
<div class="form-group">
|
||||||
const contentTerm = document.getElementById('searchTerm').value.trim();
|
<label class="form-label" for="recipientTerm">收件人</label>
|
||||||
const from = document.getElementById('dateFrom').value;
|
<input id="recipientTerm" class="tech-input" placeholder="输入收件人姓名">
|
||||||
const to = document.getElementById('dateTo').value;
|
</div>
|
||||||
const out = document.getElementById('searchResults');
|
<div class="form-group">
|
||||||
out.innerHTML = '<div class="loading">正在查询...</div>';
|
<label class="form-label" for="searchTerm">编号 / 关键字</label>
|
||||||
|
<input id="searchTerm" class="tech-input" placeholder="输入内容关键字">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="dateFrom">开始日期</label>
|
||||||
|
<input id="dateFrom" type="date" class="tech-input">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="dateTo">结束日期</label>
|
||||||
|
<input id="dateTo" type="date" class="tech-input">
|
||||||
|
</div>
|
||||||
|
<button id="searchBtn" class="tech-button">执行查询</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
let q = sb.from('xinhan').select('*');
|
<section class="panel-card results-card">
|
||||||
if (recipientTerm) q = q.ilike('recipient', `%${recipientTerm}%`);
|
<div class="panel-title-row">
|
||||||
if (contentTerm) q = q.ilike('content', `%${contentTerm}%`);
|
<div>
|
||||||
if (from) q = q.gte('sent_date', from);
|
<h2 class="panel-title">查询结果</h2>
|
||||||
if (to) q = q.lte('sent_date', to);
|
<div class="panel-subtitle">寄送路径与摘要信息集中展示</div>
|
||||||
const { data, error } = await q.order('sent_date', { ascending: false });
|
</div>
|
||||||
if (error){ out.innerHTML = `<div class="loading" style="color:red">查询失败:${error.message}</div>`; return; }
|
</div>
|
||||||
renderResults(data || []);
|
<div id="searchResults" class="results-shell">
|
||||||
}
|
<div class="empty-state">设置检索条件后即可查询信函流转记录。</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
function renderResults(rows){
|
<footer class="page-footer">
|
||||||
const c = document.getElementById('searchResults');
|
<p>© 2026 BI Intelligent Query Interface</p>
|
||||||
if (!rows.length){ c.innerHTML = '<div class="loading">未找到符合条件的信函</div>'; return; }
|
</footer>
|
||||||
let html = '<div class="table-wrapper"><table><thead><tr><th>ID</th><th>收件人</th><th>寄达地</th><th>寄出日期</th><th>寄达日期</th><th>内容</th></tr></thead><tbody>';
|
|
||||||
for (const r of rows){
|
|
||||||
html += `<tr><td>${r.id}</td><td>${r.recipient||''}</td><td>${r.destination||''}</td><td>${r.sent_date||''}</td><td>${r.arrival_date||''}</td><td>${(r.content||'').slice(0,60)}${(r.content||'').length>60?'…':''}</td></tr>`;
|
|
||||||
}
|
|
||||||
html += '</tbody></table></div>';
|
|
||||||
c.innerHTML = html;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById('searchBtn').addEventListener('click', handleSearch);
|
<script>
|
||||||
</script>
|
const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co';
|
||||||
|
const SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNoaXhzc3JwaGZneHZxcWlna3pvIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQ2OTE0OTEsImV4cCI6MjA5MDI2NzQ5MX0.Az_Ew2J2zdOMcSV0UNAjBS-LPqGpqhsaN4IyZ5R7iqU';
|
||||||
|
const sb = supabase.createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
|
||||||
|
|
||||||
|
async function handleSearch() {
|
||||||
|
const recipientTerm = document.getElementById('recipientTerm').value.trim();
|
||||||
|
const contentTerm = document.getElementById('searchTerm').value.trim();
|
||||||
|
const from = document.getElementById('dateFrom').value;
|
||||||
|
const to = document.getElementById('dateTo').value;
|
||||||
|
const out = document.getElementById('searchResults');
|
||||||
|
|
||||||
|
out.innerHTML = '<div class="loading-state">正在连接信函数据库并执行检索...</div>';
|
||||||
|
|
||||||
|
let q = sb.from('xinhan').select('*');
|
||||||
|
if (recipientTerm) q = q.ilike('recipient', `%${recipientTerm}%`);
|
||||||
|
if (contentTerm) q = q.ilike('content', `%${contentTerm}%`);
|
||||||
|
if (from) q = q.gte('sent_date', from);
|
||||||
|
if (to) q = q.lte('sent_date', to);
|
||||||
|
|
||||||
|
const { data, error } = await q.order('sent_date', { ascending: false });
|
||||||
|
if (error) {
|
||||||
|
out.innerHTML = `<div class="error-state">查询失败:${error.message}</div>`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
renderResults(data || []);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderResults(rows) {
|
||||||
|
const container = document.getElementById('searchResults');
|
||||||
|
if (!rows.length) {
|
||||||
|
container.innerHTML = '<div class="empty-state">未找到符合条件的信函记录。</div>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let html = `
|
||||||
|
<div class="table-wrapper">
|
||||||
|
<table class="result-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>收件人</th>
|
||||||
|
<th>目的地</th>
|
||||||
|
<th>寄出日期</th>
|
||||||
|
<th>寄达日期</th>
|
||||||
|
<th>内容摘要</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
`;
|
||||||
|
|
||||||
|
rows.forEach(row => {
|
||||||
|
const content = row.content || '';
|
||||||
|
const summary = content.length > 60
|
||||||
|
? `<span class="text-truncate" title="${content}">${content}</span>`
|
||||||
|
: content;
|
||||||
|
|
||||||
|
html += `
|
||||||
|
<tr>
|
||||||
|
<td class="table-highlight">${row.id}</td>
|
||||||
|
<td>${row.recipient || ''}</td>
|
||||||
|
<td>${row.destination || ''}</td>
|
||||||
|
<td>${row.sent_date || ''}</td>
|
||||||
|
<td>${row.arrival_date || ''}</td>
|
||||||
|
<td>${summary}</td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
});
|
||||||
|
|
||||||
|
html += '</tbody></table></div>';
|
||||||
|
container.innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('searchBtn').addEventListener('click', handleSearch);
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user