基线:全量源码首提(D1 版本控制落地,含第一轮优化 B1-B4/A1/A4/缩放修复)

This commit is contained in:
dqb-dev
2026-10-01 22:15:22 +08:00
commit 1e65792b09
499 changed files with 204579 additions and 0 deletions
+109
View File
@@ -0,0 +1,109 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<title>库备份管理</title>
<style>
body { font-family: "Microsoft YaHei UI", "Microsoft YaHei", sans-serif; font-size: 14px; margin: 20px; background: #f5f6f8; }
h2 { margin: 0 0 14px; }
table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { border: 1px solid #d0d4da; padding: 6px 10px; text-align: left; }
th { background: #eef1f5; }
tr:hover td { background: #f4f8ff; }
.bar { margin-bottom: 12px; }
button { padding: 5px 14px; cursor: pointer; }
input, select { padding: 4px 8px; }
.op button { margin-right: 4px; padding: 2px 8px; font-size: 12px; }
.del { color: #c33; }
#tip { color: #2a7; margin-left: 10px; }
.nav { margin-bottom: 16px; }
.nav a { margin-right: 14px; color: #247; text-decoration: none; font-weight: 700; }
.nav a.cur { color: #f60; }
</style>
</head>
<body>
<div class="nav"><a href="/admin.html">会员管理</a><a href="/xiangmu-cloud.html">项目云管理</a><a class="cur" href="/lib-cloud.html">库备份管理</a></div>
<h2>库备份管理(方案库/用户库/柜体库/铜排铝排库/企业信息,按手机号)</h2>
<div class="bar">
手机号: <select id="c手机号sel" onchange="同步手机号()" style="width:150px"><option value="">-- 选择会员 --</option></select>
或输入: <input id="c手机号" style="width:130px" placeholder="手动输入">
<button onclick="云查询()">查看云上库备份</button>
<span id="tip"></span>
</div>
<table id="云tbl">
<thead>
<tr><th>库名</th><th>原始路径</th><th>备份时间</th><th>大小</th><th>操作</th></tr>
</thead>
<tbody></tbody>
</table>
<script>
function 提示(s, ok) {
var t = document.getElementById('tip');
t.textContent = s; t.style.color = ok ? '#2a7' : '#c33';
}
function 加载会员下拉() {
fetch('/api/list').then(r => r.json()).then(function (j) {
var sel = document.getElementById('c手机号sel');
(j['会员'] || []).forEach(function (m) {
var p = m['手机号'] || '';
if (!p) return;
var op = document.createElement('option');
op.value = p;
op.textContent = p + (m['会员类型'] ? ' (' + m['会员类型'] + ')' : '');
sel.appendChild(op);
});
}).catch(function () {});
}
function 同步手机号() {
var v = document.getElementById('c手机号sel').value;
if (v) document.getElementById('c手机号').value = v;
}
function 格式大小(b) {
if (b >= 1048576) return (b / 1048576).toFixed(1) + 'M';
if (b >= 1024) return (b / 1024).toFixed(1) + 'K';
return b + 'B';
}
function 云查询() {
var p = document.getElementById('c手机号').value.trim();
if (!p) { 提示('请选择或输入手机号', false); return; }
fetch('/api/proj/list?手机号=' + encodeURIComponent(p)).then(r => r.json()).then(function (j) {
var tb = document.getElementById('云tbl').getElementsByTagName('tbody')[0];
tb.innerHTML = '';
if (!j.ok) { 提示(j.msg || '查询失败', false); return; }
// 只显示 LIB_ 开头的库条目(项目在 xiangmu-cloud.html)
var list = (j['项目'] || []).filter(function (pr) { return (pr.编号 || '').indexOf('LIB_') === 0; });
if (!list.length) { 提示('该手机号云上暂无库备份', true); return; }
提示('共 ' + list.length + ' 个库备份', true);
list.forEach(function (pr) {
var 名称 = pr.名称 || '', 显示名 = 名称, 路径 = '';
var 竖 = 名称.indexOf('|');
if (竖 >= 0) { 显示名 = 名称.slice(0, 竖); 路径 = 名称.slice(竖 + 1); }
var tr = tb.insertRow();
tr.insertCell().textContent = 显示名;
tr.insertCell().textContent = 路径;
tr.insertCell().textContent = pr.时间 || '';
tr.insertCell().textContent = 格式大小(pr.大小 || 0);
var op = tr.insertCell(); op.className = 'op';
var del = document.createElement('button');
del.textContent = '删除'; del.className = 'del';
del.onclick = function () {
if (!confirm('确定删除云端库备份 ' + 显示名 + ' ?')) return;
fetch('/api/proj/delete', { method:'POST', headers:{'Content-Type':'application/json'},
body: JSON.stringify({ 手机号: p, 编号: pr.编号 }) })
.then(r => r.json()).then(function (d) { 提示(d.ok ? '已删除' : '删除失败:'+(d.msg||''), d.ok); 云查询(); });
};
op.appendChild(del);
var dl = document.createElement('button');
dl.textContent = '下载';
dl.onclick = function () {
location.href = '/api/proj/download?手机号=' + encodeURIComponent(p) + '&编号=' + encodeURIComponent(pr.编号);
};
op.appendChild(dl);
});
}).catch(function (e) { 提示('请求失败: ' + e, false); });
}
加载会员下拉();
</script>
</body>
</html>