add notice after config

This commit is contained in:
2026-07-31 10:20:33 +08:00
parent 692d8dd18a
commit d45acaf50f
12 changed files with 2721 additions and 2277 deletions
+4 -3
View File
@@ -43,7 +43,7 @@
<button class="tab active" data-target="plot-panel">绘图预览</button>
<button class="tab" data-target="identification-data-panel">辨识数据</button>
<button class="tab" data-target="control-data-panel">控制数据</button>
<button class="tab" data-target="config-panel">配置发布</button>
<button class="tab" data-target="config-panel">配置发布 <span id="config-notification-badge" class="tab-badge" hidden>0</span></button>
<button class="tab" data-target="model-panel">模型管理</button>
<button class="tab" data-target="license-panel">许可证</button>
<button class="tab" data-target="organization-panel">组织管理</button>
@@ -139,14 +139,15 @@
<button class="segment" data-type="identification">系统辨识</button>
</div>
</div>
<div id="config-notifications" class="notification-stack" aria-live="polite"></div>
<div class="editor-layout">
<div class="editor-column">
<div class="editor-toolbar">
<span id="config-label">容积测量配置</span>
<button id="import-config" class="text-button">导入 JSON</button>
</div>
<textarea id="config-editor" spellcheck="false" aria-label="JSON 配置编辑器"></textarea>
<p id="config-path" class="file-path">可直接编辑,或从本地 JSON 导入</p>
<form id="config-form" class="config-form" aria-label="配置字段"></form>
<p id="config-path" class="file-path">字段名称固定;可填写右侧数据或从本地 JSON 导入</p>
</div>
<aside class="publish-aside">
<h3>发布检查</h3>
+190 -14
View File
@@ -21,6 +21,11 @@ const identificationExample = {
repeat: 2
};
const configFields = {
volume: Object.keys(volumeExample),
identification: Object.keys(identificationExample)
};
const state = {
configType: "volume",
imagePaths: { csv: null, json: null },
@@ -33,7 +38,9 @@ const state = {
defaultDeviceId: "",
review: null,
retryDeviceId: null,
notificationDeviceId: null,
lightbox: { mediaType: null, scale: 1, fit: true, previousFocus: null },
notifications: [],
connected: false
};
@@ -66,12 +73,14 @@ const elements = {
openImage: document.querySelector('[data-open-plot="json"]')
}
},
configEditor: document.querySelector("#config-editor"),
configForm: document.querySelector("#config-form"),
configLabel: document.querySelector("#config-label"),
configPath: document.querySelector("#config-path"),
publishTarget: document.querySelector("#publish-target"),
publishButton: document.querySelector("#publish-config"),
publishResult: document.querySelector("#publish-result"),
configNotifications: document.querySelector("#config-notifications"),
configNotificationBadge: document.querySelector("#config-notification-badge"),
lineCompany: document.querySelector("#line-company"),
licenseTarget: document.querySelector("#license-target"),
licenseList: document.querySelector("#license-list"),
@@ -225,6 +234,11 @@ function renderLineOptions() {
function updateSelectedTarget() {
const company = selectedCompany();
const line = selectedLine();
if (state.notificationDeviceId !== elements.deviceId.value) {
state.notificationDeviceId = elements.deviceId.value;
state.notifications = [];
renderNotifications();
}
elements.licenseTarget.value = company && line ? `${company.name} / ${line.name}` : "";
void syncConnection();
}
@@ -413,16 +427,91 @@ function activateTab(target) {
}
function activateConfigType(configType) {
try {
state.configs[state.configType] = JSON.parse(elements.configEditor.value);
} catch (_error) {
// Keep the last valid configuration when changing views.
}
syncCurrentConfig();
state.configType = configType;
document.querySelectorAll(".segment").forEach((item) => item.classList.toggle("active", item.dataset.type === configType));
renderConfig();
}
function isPowerOfTwo(value) {
return Number.isInteger(value) && value >= 2 && (value & (value - 1)) === 0;
}
function clearConfigErrors() {
elements.configForm.querySelectorAll("[aria-invalid]").forEach((input) => input.removeAttribute("aria-invalid"));
elements.configForm.querySelectorAll(".config-field-error").forEach((item) => item.remove());
}
function showConfigFieldError(field, message) {
const input = elements.configForm.querySelector(`[data-config-field="${field}"]`);
if (!input) return;
input.setAttribute("aria-invalid", "true");
const error = document.createElement("p");
error.className = "config-field-error";
error.textContent = message;
input.closest(".config-field").append(error);
}
function readConfigForm({ showErrors = false } = {}) {
const type = state.configType;
const parameters = {};
let invalidField = null;
let invalidMessage = null;
clearConfigErrors();
for (const field of configFields[type]) {
const input = elements.configForm.querySelector(`[data-config-field="${field}"]`);
const text = input?.value.trim() || "";
if (field === "levels") {
const values = text.split(",").map((value) => value.trim()).filter(Boolean);
parameters[field] = values.map(Number);
if (!values.length || parameters[field].some((value) => !Number.isFinite(value))) {
invalidField = field;
invalidMessage = "请输入以逗号分隔的有效数字。";
} else if (!isPowerOfTwo(parameters[field].length)) {
invalidField = field;
invalidMessage = "元素个数必须是不小于 2 的 2 的整数次幂。";
}
continue;
}
const value = Number(text);
parameters[field] = value;
if (!text || !Number.isFinite(value)) {
invalidField = field;
invalidMessage = "请输入有效数字。";
} else if (["num_runs", "n_order", "repeat"].includes(field) && !Number.isInteger(value)) {
invalidField = field;
invalidMessage = "请输入整数。";
}
}
if (invalidField) {
if (showErrors) showConfigFieldError(invalidField, invalidMessage);
throw new Error(`${invalidField}${invalidMessage}`);
}
return parameters;
}
function syncCurrentConfig() {
try {
state.configs[state.configType] = readConfigForm();
} catch (_error) {
// Preserve the last valid values until the user corrects the visible form.
}
}
function normalizeImportedConfig(parameters) {
if (!parameters || typeof parameters !== "object" || Array.isArray(parameters)) {
throw new Error("导入配置必须是 JSON 对象");
}
const fields = configFields[state.configType];
const unknown = Object.keys(parameters).filter((field) => !fields.includes(field));
if (unknown.length) throw new Error(`导入配置包含未知字段:${unknown.join(", ")}`);
const normalized = { ...state.configs[state.configType] };
for (const field of fields) {
if (parameters[field] !== undefined) normalized[field] = parameters[field];
}
return normalized;
}
function switchToIdentificationConfigForRetry() {
if (!state.review) return;
state.retryDeviceId = state.review.deviceId;
@@ -464,11 +553,16 @@ async function submitRetryReview() {
function renderConfig() {
const isVolume = state.configType === "volume";
elements.configEditor.value = JSON.stringify(state.configs[state.configType], null, 2);
const config = state.configs[state.configType];
elements.configForm.innerHTML = configFields[state.configType].map((field) => {
const value = field === "levels" ? config[field].join(", ") : config[field];
const integer = ["num_runs", "n_order", "repeat"].includes(field);
return `<div class="config-field"><label for="config-${field}">${field}</label><input id="config-${field}" data-config-field="${field}" type="${field === "levels" ? "text" : "number"}"${field === "levels" ? "" : ` step="${integer ? "1" : "any"}"` } value="${escapeHtml(value)}" required></div>`;
}).join("");
elements.configLabel.textContent = isVolume ? "容积测量配置" : "系统辨识配置";
elements.publishTarget.textContent = isVolume ? "Server 配置文件" : "设备辨识配置";
elements.publishButton.textContent = isVolume ? "上传容积配置" : "发布辨识配置";
elements.configPath.textContent = "可直接编辑,或从本地 JSON 导入";
elements.configPath.textContent = "字段名称固定;可填写右侧数据或从本地 JSON 导入";
elements.publishResult.textContent = "等待操作";
delete elements.publishResult.dataset.tone;
}
@@ -688,8 +782,13 @@ elements.identificationFileList.addEventListener("click", async (event) => {
document.querySelector("#import-config").addEventListener("click", async () => {
const result = await runBusy("正在导入配置", () => window.reinloop.chooseConfig());
if (!result) return;
state.configs[state.configType] = result.parameters;
elements.configEditor.value = JSON.stringify(result.parameters, null, 2);
try {
state.configs[state.configType] = normalizeImportedConfig(result.parameters);
renderConfig();
} catch (error) {
showError(error);
return;
}
elements.configPath.textContent = result.filePath;
setStatus("配置已导入", "success");
});
@@ -700,8 +799,13 @@ document.querySelector("#load-server").addEventListener("click", async () => {
credentials: credentials()
}));
if (!parameters) return;
state.configs[state.configType] = parameters;
elements.configEditor.value = JSON.stringify(parameters, null, 2);
try {
state.configs[state.configType] = normalizeImportedConfig(parameters);
renderConfig();
} catch (error) {
showError(new Error(`Server 配置无效:${error.message}`));
return;
}
elements.publishResult.textContent = "已读取当前 Server 配置";
elements.publishResult.dataset.tone = "success";
setStatus("读取完成", "success");
@@ -710,9 +814,9 @@ document.querySelector("#load-server").addEventListener("click", async () => {
elements.publishButton.addEventListener("click", async () => {
let parameters;
try {
parameters = JSON.parse(elements.configEditor.value);
parameters = readConfigForm({ showErrors: true });
} catch (error) {
showError(new Error(`JSON 格式错误: ${error.message}`));
showError(error);
return;
}
@@ -732,6 +836,10 @@ elements.publishButton.addEventListener("click", async () => {
? `${result.message}: ${result.storagePath}`
: result.message;
elements.publishResult.dataset.tone = "success";
if (state.configType === "volume") {
const notification = state.notifications.find((item) => item.type === "volume_request_started");
if (notification) void acknowledgeNotification(notification);
}
if (state.configType === "identification" && state.retryDeviceId) {
await submitRetryReview();
} else {
@@ -830,4 +938,72 @@ elements.controlFileList.addEventListener("click", async (event) => {
button.disabled = false;
}
}
});
function renderNotifications() {
elements.configNotificationBadge.hidden = state.notifications.length === 0;
elements.configNotificationBadge.textContent = String(state.notifications.length);
elements.configNotifications.innerHTML = state.notifications.map((notification) => {
const action = notification.type === "volume_request_started"
? "处理配置"
: notification.type === "volume_result_ready"
? "查看结果"
: "查看绘图";
const secondaryAction = notification.type === "identification_result_ready" ? "查看辨识数据" : "";
return `<article class="panel-notification" data-notification-id="${escapeHtml(notification.notificationId)}" data-type="${escapeHtml(notification.type)}"><div class="notification-copy"><strong>${escapeHtml(notification.title)}</strong><span>${escapeHtml(notification.message)}</span></div><div class="notification-actions"><button class="button secondary" data-notification-action="primary" data-notification-id="${escapeHtml(notification.notificationId)}">${action}</button>${secondaryAction ? `<button class="button secondary" data-notification-action="secondary" data-notification-id="${escapeHtml(notification.notificationId)}">${secondaryAction}</button>` : ""}<button class="button icon" title="关闭提醒" aria-label="关闭提醒" data-notification-action="close" data-notification-id="${escapeHtml(notification.notificationId)}">x</button></div></article>`;
}).join("");
}
async function acknowledgeNotification(notification) {
const result = await runBusy("正在确认提醒", () => window.reinloop.acknowledgeNotification({
deviceId: notification.deviceId,
notificationId: notification.notificationId,
credentials: credentials()
}));
if (!result) return false;
state.notifications = state.notifications.filter((item) => item.notificationId !== notification.notificationId);
renderNotifications();
return true;
}
async function handleNotificationAction(notification, action) {
if (action === "close") {
await acknowledgeNotification(notification);
return;
}
if (notification.type === "volume_request_started") {
activateTab("config-panel");
activateConfigType("volume");
elements.configForm.querySelector("input")?.focus();
return;
}
if (notification.type === "volume_result_ready") {
const result = await runBusy("正在打开容积测试结果", () => window.reinloop.openNotificationFile({
fileID: notification.fileID,
credentials: credentials()
}));
if (result) setStatus(`已打开结果文件:${result.filePath}`, "success");
return;
}
if (action === "primary") {
activateTab("plot-panel");
return;
}
activateTab("identification-data-panel");
await refreshIdentificationFiles();
}
elements.configNotifications.addEventListener("click", (event) => {
const button = event.target.closest("button[data-notification-id]");
if (!button) return;
const notification = state.notifications.find((item) => item.notificationId === button.dataset.notificationId);
if (notification) void handleNotificationAction(notification, button.dataset.notificationAction);
});
window.reinloop.onPanelNotification((notification) => {
if (!notification?.notificationId || notification.deviceId !== elements.deviceId.value) return;
state.notificationDeviceId = notification.deviceId;
if (state.notifications.some((item) => item.notificationId === notification.notificationId)) return;
state.notifications.push(notification);
renderNotifications();
});
+256 -257
View File
@@ -1,258 +1,257 @@
:root {
color-scheme: light;
--ink: #15251f;
--muted: #617069;
--line: #cfd7d2;
--paper: #f2f4f1;
--surface: #ffffff;
--green: #146b4a;
--green-dark: #0d4b34;
--amber: #e7a928;
--red: #ad342d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
margin: 0;
min-width: 900px;
color: var(--ink);
background:
linear-gradient(rgba(20, 107, 74, 0.035) 1px, transparent 1px),
linear-gradient(90deg, rgba(20, 107, 74, 0.035) 1px, transparent 1px),
var(--paper);
background-size: 28px 28px;
font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
.topbar {
height: 104px;
padding: 20px 36px;
color: white;
background: var(--ink);
border-bottom: 5px solid var(--amber);
display: flex;
align-items: center;
justify-content: space-between;
}
h1, h2, h3, p { margin: 0; }
h1 { font-family: Georgia, "Microsoft YaHei UI", serif; font-size: 28px; font-weight: 600; letter-spacing: 0; }
h2 { font-family: Georgia, "Microsoft YaHei UI", serif; font-size: 25px; font-weight: 600; letter-spacing: 0; }
h3 { font-size: 15px; }
.eyebrow, .section-kicker { font-size: 11px; letter-spacing: 0; font-weight: 700; }
.eyebrow { color: #a9c1b6; margin-bottom: 5px; }
.section-kicker { color: var(--green); margin-bottom: 5px; }
.status {
min-width: 110px;
max-width: 420px;
padding: 8px 14px;
border: 1px solid #587067;
border-radius: 4px;
color: #d9e4df;
text-align: center;
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.status[data-tone="busy"] { border-color: var(--amber); color: #ffd985; }
.status[data-tone="success"] { border-color: #62b78f; color: #9fe1bf; }
.status[data-tone="error"] { border-color: #df766e; color: #ffb5ae; }
main { max-width: 1500px; margin: 0 auto; padding: 22px 36px 36px; }
.connection-screen {
min-height: calc(100vh - 104px);
display: grid;
place-items: center;
padding: 36px;
}
.connection-form {
width: min(480px, 100%);
padding: 30px;
display: grid;
gap: 18px;
background: var(--surface);
border: 1px solid var(--line);
border-top: 4px solid var(--green);
box-shadow: 0 18px 45px rgba(21, 37, 31, 0.12);
}
.connection-form h2 { margin-bottom: 6px; }
.connection-form label { display: grid; gap: 7px; }
.connection-form label span { color: var(--muted); font-size: 12px; font-weight: 700; }
.connection-form .button { width: 100%; margin-top: 4px; }
.connection-message { min-height: 20px; color: var(--muted); font-size: 12px; text-align: center; }
.connection-message[data-tone="busy"] { color: #8a6414; }
.connection-message[data-tone="error"] { color: var(--red); }
.connection-band {
display: grid;
grid-template-columns: repeat(2, minmax(260px, 1fr));
gap: 18px;
padding: 15px 18px;
background: #e4e9e5;
border: 1px solid var(--line);
border-left: 4px solid var(--green);
}
.connection-band label { display: grid; grid-template-columns: 118px 1fr; align-items: center; gap: 10px; }
.connection-band span { font-size: 12px; font-weight: 700; color: var(--muted); }
input, select {
min-width: 0;
height: 36px;
padding: 0 10px;
border: 1px solid #b9c5be;
border-radius: 3px;
background: white;
color: var(--ink);
outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(20, 107, 74, 0.12); }
.tabs { display: flex; gap: 0; margin-top: 22px; border-bottom: 1px solid var(--line); }
.tab {
min-width: 132px;
padding: 12px 20px;
border: 0;
border-bottom: 3px solid transparent;
background: transparent;
color: var(--muted);
font-weight: 700;
}
.tab.active { color: var(--green-dark); border-bottom-color: var(--green); }
.panel { display: none; padding-top: 22px; }
.panel.active { display: block; animation: reveal 180ms ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.panel-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.actions { display: flex; gap: 8px; }
.button {
height: 38px;
padding: 0 16px;
border-radius: 3px;
border: 1px solid transparent;
font-weight: 700;
}
.button.primary { color: white; background: var(--green); border-color: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { color: var(--ink); background: white; border-color: #aebbb4; }
.button.secondary:hover { border-color: var(--green); color: var(--green); }
.button.danger { color: var(--red); background: white; border-color: #d5a7a3; }
.button.danger:hover { color: white; background: var(--red); border-color: var(--red); }
.button.icon { width: 38px; padding: 0; background: white; border-color: #aebbb4; font-size: 19px; }
.plot-actions { display: flex; gap: 6px; }
.button.full { width: 100%; margin-top: 10px; }
.review-actions { display: flex; align-items: center; gap: 8px; }
.review-actions span { max-width: 320px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.plot-item { min-width: 0; }
.plot-title {
min-height: 54px;
padding: 9px 12px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
background: var(--surface);
border: 1px solid var(--line);
border-bottom: 0;
}
.plot-title div { display: grid; gap: 3px; }
.plot-title span { color: var(--green); font-size: 11px; font-weight: 700; }
.plot-title strong { font-size: 15px; }
.plot-stage {
height: calc(100vh - 405px);
min-height: 300px;
max-height: 620px;
display: grid;
place-items: center;
overflow: auto;
background-color: #dce2de;
background-image: linear-gradient(45deg, #d3dad5 25%, transparent 25%), linear-gradient(-45deg, #d3dad5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d3dad5 75%), linear-gradient(-45deg, transparent 75%, #d3dad5 75%);
background-size: 20px 20px;
background-position: 0 0, 0 10px, 10px -10px, -10px 0;
border: 1px solid #bdc8c1;
}
.plot-stage img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; background: white; }
.empty-state { display: grid; gap: 7px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); font-size: 18px; }
.empty-state span { font-size: 13px; }
.plot-meta { min-height: 29px; display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.file-path { min-height: 20px; margin-top: 9px; color: var(--muted); font: 12px Consolas, monospace; overflow-wrap: anywhere; }
.upload-time { flex: 0 0 auto; margin-top: 9px; color: var(--green-dark); font-size: 12px; font-weight: 700; }
.segmented { display: flex; padding: 3px; background: #dfe5e1; border: 1px solid #c6d0ca; border-radius: 4px; }
.segment { height: 34px; padding: 0 16px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-weight: 700; }
.segment.active { background: white; color: var(--green-dark); box-shadow: 0 1px 3px rgba(21, 37, 31, 0.14); }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; }
.editor-column, .publish-aside { background: var(--surface); border: 1px solid var(--line); }
.editor-toolbar { height: 46px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.text-button { border: 0; background: transparent; color: var(--green); font-size: 13px; font-weight: 700; }
textarea {
display: block;
width: calc(100% - 28px);
height: calc(100vh - 385px);
min-height: 330px;
margin: 14px;
padding: 16px;
resize: vertical;
border: 1px solid #bec9c2;
border-radius: 3px;
background: #f8faf8;
color: #18392d;
font: 14px/1.65 Consolas, "Microsoft YaHei UI", monospace;
tab-size: 2;
outline: none;
}
.editor-column > .file-path { padding: 0 14px 12px; }
.publish-aside { padding: 20px; align-self: start; }
.publish-aside h3 { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
dl { margin: 8px 0 18px; }
dl div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #e6ebe8; font-size: 12px; }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; font-weight: 700; }
.result { min-height: 42px; margin-top: 14px; padding: 10px; background: #eef1ef; color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.result[data-tone="success"] { color: var(--green-dark); background: #e2f2e9; }
.result[data-tone="error"] { color: var(--red); background: #f8e7e5; }
.management-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }
.management-layout.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-surface, .data-surface { background: var(--surface); border: 1px solid var(--line); }
.form-surface { padding: 20px; display: grid; gap: 14px; }
.form-surface h3 { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.form-surface label { display: grid; gap: 6px; }
.form-surface label span { color: var(--muted); font-size: 12px; font-weight: 700; }
.form-note { color: var(--muted); font-size: 11px; line-height: 1.6; }
.data-surface { min-width: 0; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 11px 13px; border-bottom: 1px solid #e4e9e6; text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #edf1ee; font-size: 11px; }
td:last-child { white-space: nowrap; }
.table-action { border: 0; background: transparent; color: var(--green); font-weight: 700; margin-right: 10px; }
.table-action.danger { color: var(--red); }
.empty-row { padding: 30px; color: var(--muted); text-align: center; font-size: 13px; }
.detail-view { margin: 0; padding: 16px; max-height: 260px; overflow: auto; background: #18251f; color: #d9e9df; font: 12px/1.6 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.lightbox { position: fixed; inset: 0; z-index: 20; padding: 24px; background: rgba(10, 20, 16, 0.78); }
.lightbox-shell { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--surface); border: 1px solid #9aa9a1; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.lightbox-toolbar { min-height: 58px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.lightbox-actions { display: flex; align-items: center; gap: 7px; }
.lightbox-canvas { min-width: 0; min-height: 0; display: grid; place-items: center; overflow: auto; padding: 22px; background-color: #dce2de; background-image: linear-gradient(45deg, #d3dad5 25%, transparent 25%), linear-gradient(-45deg, #d3dad5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d3dad5 75%), linear-gradient(-45deg, transparent 75%, #d3dad5 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.lightbox-canvas img { display: block; max-width: none; background: white; }
.lightbox-canvas img.fit-image { max-width: 100%; max-height: 100%; object-fit: contain; }
@media (max-width: 1050px) {
main { padding-left: 22px; padding-right: 22px; }
.connection-band { grid-template-columns: 1fr; }
.plot-grid { grid-template-columns: 1fr; }
.plot-stage { height: 360px; }
.editor-layout { grid-template-columns: minmax(0, 1fr) 240px; }
.management-layout, .management-layout.equal { grid-template-columns: 1fr; }
.lightbox { padding: 12px; }
.lightbox-toolbar { align-items: start; flex-direction: column; }
:root {
color-scheme: light;
--ink: #15251f;
--muted: #617069;
--line: #cfd7d2;
--paper: #f2f4f1;
--surface: #ffffff;
--green: #146b4a;
--green-dark: #0d4b34;
--amber: #e7a928;
--red: #ad342d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
margin: 0;
min-width: 900px;
color: var(--ink);
background:
linear-gradient(rgba(20, 107, 74, 0.035) 1px, transparent 1px),
linear-gradient(90deg, rgba(20, 107, 74, 0.035) 1px, transparent 1px),
var(--paper);
background-size: 28px 28px;
font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
.topbar {
height: 104px;
padding: 20px 36px;
color: white;
background: var(--ink);
border-bottom: 5px solid var(--amber);
display: flex;
align-items: center;
justify-content: space-between;
}
h1, h2, h3, p { margin: 0; }
h1 { font-family: Georgia, "Microsoft YaHei UI", serif; font-size: 28px; font-weight: 600; letter-spacing: 0; }
h2 { font-family: Georgia, "Microsoft YaHei UI", serif; font-size: 25px; font-weight: 600; letter-spacing: 0; }
h3 { font-size: 15px; }
.eyebrow, .section-kicker { font-size: 11px; letter-spacing: 0; font-weight: 700; }
.eyebrow { color: #a9c1b6; margin-bottom: 5px; }
.section-kicker { color: var(--green); margin-bottom: 5px; }
.status {
min-width: 110px;
max-width: 420px;
padding: 8px 14px;
border: 1px solid #587067;
border-radius: 4px;
color: #d9e4df;
text-align: center;
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.status[data-tone="busy"] { border-color: var(--amber); color: #ffd985; }
.status[data-tone="success"] { border-color: #62b78f; color: #9fe1bf; }
.status[data-tone="error"] { border-color: #df766e; color: #ffb5ae; }
main { max-width: 1500px; margin: 0 auto; padding: 22px 36px 36px; }
.connection-screen {
min-height: calc(100vh - 104px);
display: grid;
place-items: center;
padding: 36px;
}
.connection-form {
width: min(480px, 100%);
padding: 30px;
display: grid;
gap: 18px;
background: var(--surface);
border: 1px solid var(--line);
border-top: 4px solid var(--green);
box-shadow: 0 18px 45px rgba(21, 37, 31, 0.12);
}
.connection-form h2 { margin-bottom: 6px; }
.connection-form label { display: grid; gap: 7px; }
.connection-form label span { color: var(--muted); font-size: 12px; font-weight: 700; }
.connection-form .button { width: 100%; margin-top: 4px; }
.connection-message { min-height: 20px; color: var(--muted); font-size: 12px; text-align: center; }
.connection-message[data-tone="busy"] { color: #8a6414; }
.connection-message[data-tone="error"] { color: var(--red); }
.connection-band {
display: grid;
grid-template-columns: repeat(2, minmax(260px, 1fr));
gap: 18px;
padding: 15px 18px;
background: #e4e9e5;
border: 1px solid var(--line);
border-left: 4px solid var(--green);
}
.connection-band label { display: grid; grid-template-columns: 118px 1fr; align-items: center; gap: 10px; }
.connection-band span { font-size: 12px; font-weight: 700; color: var(--muted); }
input, select {
min-width: 0;
height: 36px;
padding: 0 10px;
border: 1px solid #b9c5be;
border-radius: 3px;
background: white;
color: var(--ink);
outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(20, 107, 74, 0.12); }
.tabs { display: flex; gap: 0; margin-top: 22px; border-bottom: 1px solid var(--line); }
.tab {
min-width: 132px;
padding: 12px 20px;
border: 0;
border-bottom: 3px solid transparent;
background: transparent;
color: var(--muted);
font-weight: 700;
}
.tab.active { color: var(--green-dark); border-bottom-color: var(--green); }
.tab-badge { display: inline-grid; min-width: 18px; height: 18px; place-items: center; margin-left: 5px; padding: 0 5px; border-radius: 9px; color: white; background: var(--red); font-size: 11px; }
.panel { display: none; padding-top: 22px; }
.panel.active { display: block; animation: reveal 180ms ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.panel-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.actions { display: flex; gap: 8px; }
.button {
height: 38px;
padding: 0 16px;
border-radius: 3px;
border: 1px solid transparent;
font-weight: 700;
}
.button.primary { color: white; background: var(--green); border-color: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { color: var(--ink); background: white; border-color: #aebbb4; }
.button.secondary:hover { border-color: var(--green); color: var(--green); }
.button.danger { color: var(--red); background: white; border-color: #d5a7a3; }
.button.danger:hover { color: white; background: var(--red); border-color: var(--red); }
.button.icon { width: 38px; padding: 0; background: white; border-color: #aebbb4; font-size: 19px; }
.plot-actions { display: flex; gap: 6px; }
.button.full { width: 100%; margin-top: 10px; }
.review-actions { display: flex; align-items: center; gap: 8px; }
.review-actions span { max-width: 320px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.plot-item { min-width: 0; }
.plot-title {
min-height: 54px;
padding: 9px 12px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
background: var(--surface);
border: 1px solid var(--line);
border-bottom: 0;
}
.plot-title div { display: grid; gap: 3px; }
.plot-title span { color: var(--green); font-size: 11px; font-weight: 700; }
.plot-title strong { font-size: 15px; }
.plot-stage {
height: calc(100vh - 405px);
min-height: 300px;
max-height: 620px;
display: grid;
place-items: center;
overflow: auto;
background-color: #dce2de;
background-image: linear-gradient(45deg, #d3dad5 25%, transparent 25%), linear-gradient(-45deg, #d3dad5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d3dad5 75%), linear-gradient(-45deg, transparent 75%, #d3dad5 75%);
background-size: 20px 20px;
background-position: 0 0, 0 10px, 10px -10px, -10px 0;
border: 1px solid #bdc8c1;
}
.plot-stage img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; background: white; }
.empty-state { display: grid; gap: 7px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); font-size: 18px; }
.empty-state span { font-size: 13px; }
.plot-meta { min-height: 29px; display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.file-path { min-height: 20px; margin-top: 9px; color: var(--muted); font: 12px Consolas, monospace; overflow-wrap: anywhere; }
.upload-time { flex: 0 0 auto; margin-top: 9px; color: var(--green-dark); font-size: 12px; font-weight: 700; }
.segmented { display: flex; padding: 3px; background: #dfe5e1; border: 1px solid #c6d0ca; border-radius: 4px; }
.segment { height: 34px; padding: 0 16px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-weight: 700; }
.segment.active { background: white; color: var(--green-dark); box-shadow: 0 1px 3px rgba(21, 37, 31, 0.14); }
.notification-stack { display: grid; gap: 8px; margin: 0 0 16px; }
.panel-notification { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 14px; border: 1px solid #d6b362; border-left: 4px solid var(--amber); background: #fff8e6; }
.panel-notification[data-type="volume_result_ready"] { border-color: #8ebba5; border-left-color: var(--green); background: #edf8f1; }
.panel-notification[data-type="identification_result_ready"] { border-color: #9db6c8; border-left-color: #367294; background: #edf5fa; }
.notification-copy { display: grid; gap: 3px; min-width: 0; }
.notification-copy strong { font-size: 13px; }
.notification-copy span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.notification-actions { display: flex; gap: 8px; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; }
.editor-column, .publish-aside { background: var(--surface); border: 1px solid var(--line); }
.editor-toolbar { height: 46px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.text-button { border: 0; background: transparent; color: var(--green); font-size: 13px; font-weight: 700; }
.config-form { display: grid; gap: 10px; padding: 14px; }
.config-field { display: grid; grid-template-columns: minmax(160px, 0.42fr) minmax(0, 1fr); align-items: center; gap: 12px; }
.config-field label { color: var(--muted); font: 13px Consolas, monospace; font-weight: 700; }
.config-field input { width: 100%; }
.config-field-error { grid-column: 2; margin: -4px 0 0; color: var(--red); font-size: 12px; }
.config-field input[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 2px rgba(173, 52, 45, 0.12); }
.editor-column > .file-path { padding: 0 14px 12px; }
.publish-aside { padding: 20px; align-self: start; }
.publish-aside h3 { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
dl { margin: 8px 0 18px; }
dl div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #e6ebe8; font-size: 12px; }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; font-weight: 700; }
.result { min-height: 42px; margin-top: 14px; padding: 10px; background: #eef1ef; color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.result[data-tone="success"] { color: var(--green-dark); background: #e2f2e9; }
.result[data-tone="error"] { color: var(--red); background: #f8e7e5; }
.management-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }
.management-layout.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-surface, .data-surface { background: var(--surface); border: 1px solid var(--line); }
.form-surface { padding: 20px; display: grid; gap: 14px; }
.form-surface h3 { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.form-surface label { display: grid; gap: 6px; }
.form-surface label span { color: var(--muted); font-size: 12px; font-weight: 700; }
.form-note { color: var(--muted); font-size: 11px; line-height: 1.6; }
.data-surface { min-width: 0; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 11px 13px; border-bottom: 1px solid #e4e9e6; text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #edf1ee; font-size: 11px; }
td:last-child { white-space: nowrap; }
.table-action { border: 0; background: transparent; color: var(--green); font-weight: 700; margin-right: 10px; }
.table-action.danger { color: var(--red); }
.empty-row { padding: 30px; color: var(--muted); text-align: center; font-size: 13px; }
.detail-view { margin: 0; padding: 16px; max-height: 260px; overflow: auto; background: #18251f; color: #d9e9df; font: 12px/1.6 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.lightbox { position: fixed; inset: 0; z-index: 20; padding: 24px; background: rgba(10, 20, 16, 0.78); }
.lightbox-shell { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--surface); border: 1px solid #9aa9a1; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.lightbox-toolbar { min-height: 58px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.lightbox-actions { display: flex; align-items: center; gap: 7px; }
.lightbox-canvas { min-width: 0; min-height: 0; display: grid; place-items: center; overflow: auto; padding: 22px; background-color: #dce2de; background-image: linear-gradient(45deg, #d3dad5 25%, transparent 25%), linear-gradient(-45deg, #d3dad5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d3dad5 75%), linear-gradient(-45deg, transparent 75%, #d3dad5 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.lightbox-canvas img { display: block; max-width: none; background: white; }
.lightbox-canvas img.fit-image { max-width: 100%; max-height: 100%; object-fit: contain; }
@media (max-width: 1050px) {
main { padding-left: 22px; padding-right: 22px; }
.connection-band { grid-template-columns: 1fr; }
.plot-grid { grid-template-columns: 1fr; }
.plot-stage { height: 360px; }
.editor-layout { grid-template-columns: minmax(0, 1fr) 240px; }
.management-layout, .management-layout.equal { grid-template-columns: 1fr; }
.lightbox { padding: 12px; }
.lightbox-toolbar { align-items: start; flex-direction: column; }
}