From 9cad3ba80765d58f583c755d5f1f417e051074ae Mon Sep 17 00:00:00 2001 From: Nixevol Date: Thu, 25 Jun 2026 17:38:41 +0800 Subject: [PATCH] =?UTF-8?q?=EF=BB=BFfix:=20=E4=BF=AE=E5=A4=8D=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E5=88=87=E6=8D=A2=E5=8F=82=E6=95=B0=E5=92=8C=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E6=95=B0=E6=8D=AE=E6=BA=90=E6=8E=92=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CellData.sql | 1 + app/api/routers/script.py | 10 +-- .../src/components/LicenseActivationModal.vue | 12 ++-- frontend/src/components/ScriptPanel.vue | 15 +++-- frontend/src/components/SettingsPanel.vue | 61 ++++++++++--------- frontend/src/styles.css | 12 +--- 6 files changed, 54 insertions(+), 57 deletions(-) create mode 100644 CellData.sql diff --git a/CellData.sql b/CellData.sql new file mode 100644 index 0000000..97be136 --- /dev/null +++ b/CellData.sql @@ -0,0 +1 @@ +# demo \ No newline at end of file diff --git a/app/api/routers/script.py b/app/api/routers/script.py index e2b1d3b..886fdbb 100644 --- a/app/api/routers/script.py +++ b/app/api/routers/script.py @@ -32,9 +32,9 @@ def _resolve_script_path(script_type: str) -> Path: @router.get("/api/script/content") -async def get_script_content(type: str = Query("report")): - script_path = _resolve_script_path(type) - label = SCRIPT_LABELS.get(type, type) +async def get_script_content(script_type: str = Query("report")): + script_path = _resolve_script_path(script_type) + label = SCRIPT_LABELS.get(script_type, script_type) try: if not script_path.exists(): return { @@ -42,7 +42,7 @@ async def get_script_content(type: str = Query("report")): "content": f"# {label}文件不存在,请在此编写脚本\n", "modified": None, "path": str(script_path), - "script_type": type, + "script_type": script_type, } modified = datetime.fromtimestamp(script_path.stat().st_mtime).strftime("%Y-%m-%d %H:%M:%S") @@ -51,7 +51,7 @@ async def get_script_content(type: str = Query("report")): "content": script_path.read_text(encoding="utf-8"), "modified": modified, "path": str(script_path), - "script_type": type, + "script_type": script_type, } except Exception as exc: return {"success": False, "error": str(exc)} diff --git a/frontend/src/components/LicenseActivationModal.vue b/frontend/src/components/LicenseActivationModal.vue index b9f3382..aac6180 100644 --- a/frontend/src/components/LicenseActivationModal.vue +++ b/frontend/src/components/LicenseActivationModal.vue @@ -17,7 +17,7 @@ :disabled="activationLoading" />
- + 启用 Metrix 平台
@@ -72,14 +72,14 @@ async function loadMetrixEnabled() { } } -async function toggleMetrix(enabled: boolean) { +async function toggleMetrix(target: boolean) { + if (target === metrixEnabled.value) return; savingMetrix.value = true; try { - await apiPost('/api/config/metrix-enabled', { enabled }); - metrixEnabled.value = enabled; - emit('metrixChanged', enabled); + await apiPost('/api/config/metrix-enabled', { enabled: target }); + metrixEnabled.value = target; + emit('metrixChanged', target); } catch (error) { - metrixEnabled.value = !enabled; message.error(error instanceof Error ? error.message : '保存失败'); } finally { savingMetrix.value = false; diff --git a/frontend/src/components/ScriptPanel.vue b/frontend/src/components/ScriptPanel.vue index 94b5029..0e9be6a 100644 --- a/frontend/src/components/ScriptPanel.vue +++ b/frontend/src/components/ScriptPanel.vue @@ -79,6 +79,7 @@ const editor = shallowRef(null); const disposables: monaco.IDisposable[] = []; const content = ref(''); const originalContent = ref(''); +const scriptPath = ref(''); const modified = ref(null); const cursorText = ref('行 1,列 1'); const lineCount = ref(1); @@ -125,7 +126,7 @@ const currentLabel = computed(() => SCRIPT_OPTIONS.find(o => o.key === scriptTyp onMounted(async () => { setPageHeader({ - subtitle: computed(() => currentLabel.value), + subtitle: computed(() => scriptPath.value || currentLabel.value), actions: [ { key: 'script-modified', kind: 'text', label: modifiedText }, { @@ -228,19 +229,21 @@ async function switchScript(type: string) { const confirm = window.confirm(`当前脚本有未保存的修改,是否放弃?`); if (!confirm) return; } - scriptType.value = type; - await loadScript(); + await loadScript(type); } -async function loadScript() { +async function loadScript(type?: string) { + const target = type || scriptType.value; loading.value = true; try { - const result = await apiGet(`/api/script/content?type=${scriptType.value}`); + const result = await apiGet(`/api/script/content?script_type=${target}`); if (!result.success) { throw new Error(result.error || '加载脚本失败'); } - applyScriptContent(result.content); + scriptType.value = target; + scriptPath.value = result.path || ''; modified.value = result.modified; + applyScriptContent(result.content); } catch (error) { message.error(error instanceof Error ? error.message : '加载脚本失败'); } finally { diff --git a/frontend/src/components/SettingsPanel.vue b/frontend/src/components/SettingsPanel.vue index 7366c6e..179d454 100644 --- a/frontend/src/components/SettingsPanel.vue +++ b/frontend/src/components/SettingsPanel.vue @@ -682,36 +682,37 @@ >
-
- 高级匹配 -
- - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/frontend/src/styles.css b/frontend/src/styles.css index c61f3e8..dbdced1 100644 --- a/frontend/src/styles.css +++ b/frontend/src/styles.css @@ -1547,7 +1547,7 @@ select { } .settings-remote-panel { - grid-template-columns: repeat(2, minmax(420px, 1fr)); + grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); } .settings-scheduler-panel { @@ -1556,7 +1556,7 @@ select { .remote-connection-row { display: grid; - grid-template-columns: minmax(112px, 0.8fr) minmax(220px, 1.8fr) minmax(110px, 0.8fr) minmax(120px, 0.8fr) minmax(116px, 0.7fr); + grid-template-columns: repeat(auto-fill, minmax(min(120px, 100%), 1fr)); gap: 12px; align-items: start; } @@ -2281,10 +2281,6 @@ select { grid-template-columns: 1fr; } - .remote-connection-row { - grid-template-columns: repeat(2, minmax(0, 1fr)); - } - .settings-rules-grid { grid-template-rows: auto minmax(520px, 1fr); align-items: start; @@ -2292,10 +2288,6 @@ select { overflow-y: auto; } - .settings-remote-panel { - grid-template-columns: 1fr; - } - .settings-tabs .n-tab-pane { overflow: hidden; }