Merge branch 'dev'
All checks were successful
Deploy / deploy (push) Successful in 11s

This commit is contained in:
mac
2026-07-09 16:03:30 +08:00
3 changed files with 29 additions and 5 deletions

View File

@@ -666,6 +666,26 @@ def bootstrap():
# ---------- 通用 CRUD ----------
@bp.route("/api/<resource>/list", methods=["GET"])
@login_required
def list_resource(resource):
"""轻量级列表接口,只返回指定 tenant 的记录"""
if resource not in TABLES:
return jsonify({"error": "unknown resource"}), 404
table, _ = TABLES[resource]
tenant = request.args.get("tenant", session.get("tenants", [""])[0])
allowed = session.get("tenants", [])
allowed = [t if t != "总工作台" else "总览" for t in allowed]
allowed = [t if t != "学会·无界" else "学术·无界" for t in allowed]
if tenant not in allowed:
tenant = allowed[0] if allowed else ""
conn = db()
try:
result = rows(conn, f"SELECT * FROM {table} WHERE tenant=? ORDER BY id DESC", [tenant])
return jsonify(result)
finally:
conn.close()
@bp.route("/api/<resource>", methods=["POST"])
@login_required
def create_resource(resource):

View File

@@ -199,8 +199,10 @@ window.savePlanExpense = async function(event) {
return;
}
closePlanExpModal();
await load();
renderPlanExpense();
try {
state.data.planExpense = await api("/api/planExpense/list?tenant=" + encodeURIComponent(state.tenant));
renderPlanExpense();
} catch (e) { /* non-critical */ }
};
window.deletePlanExpItem = async function() {
@@ -213,6 +215,8 @@ window.deletePlanExpItem = async function() {
return;
}
closePlanExpModal();
await load();
renderPlanExpense();
try {
state.data.planExpense = await api("/api/planExpense/list?tenant=" + encodeURIComponent(state.tenant));
renderPlanExpense();
} catch (e) { /* non-critical */ }
};

View File

@@ -76,7 +76,7 @@
<header class="topbar border-b border-slate-200 bg-white px-8 py-5">
<div class="flex items-center gap-3 w-full">
<div class="flex-1">
<p class="eyebrow text-xs font-semibold uppercase tracking-[0.18em] text-blue-700">OPC Manager <span class="ml-2 text-xs font-normal text-slate-400 tracking-normal">v1.0.0.36</span></p>
<p class="eyebrow text-xs font-semibold uppercase tracking-[0.18em] text-blue-700">OPC Manager <span class="ml-2 text-xs font-normal text-slate-400 tracking-normal">v1.0.0.37</span></p>
<div class="flex items-center gap-4 mt-1">
<h1 class="text-2xl font-semibold" id="workspaceTitle">科普 OPC 工作台</h1>
<div class="hidden sm:flex items-center gap-1.5 bg-gradient-to-r from-blue-50 to-indigo-50 border border-blue-100 rounded-full px-4 py-1.5">