feat: 管理后台可动态调整采集和导出的并行数量

This commit is contained in:
2026-10-30 10:14:32 +08:00
parent c232ccbec5
commit 510093235f
12 changed files with 267 additions and 44 deletions
+8 -4
View File
@@ -6,12 +6,14 @@ import { api } from "../../shared/http";
const mode = ref("local");
const seconds = ref(300);
const concurrency = ref(4);
const message = ref("");
async function load() {
const result = await api<{ loginMode: string; credentialRefreshSeconds: number }>("/api/admin/settings");
const result = await api<{ loginMode: string; credentialRefreshSeconds: number; workerConcurrency: number }>("/api/admin/settings");
mode.value = result.loginMode;
seconds.value = result.credentialRefreshSeconds;
concurrency.value = result.workerConcurrency;
}
async function save() {
@@ -19,7 +21,7 @@ async function save() {
try {
await api("/api/admin/settings", {
method: "PUT",
body: JSON.stringify({ loginMode: mode.value, credentialRefreshSeconds: seconds.value }),
body: JSON.stringify({ loginMode: mode.value, credentialRefreshSeconds: seconds.value, workerConcurrency: concurrency.value }),
});
message.value = "已保存";
} catch (error) {
@@ -33,18 +35,20 @@ onMounted(load);
<template>
<Shell>
<header class="topbar">
<h1>登录方式 <n-tooltip><template #trigger><span class="hint">?</span></template>同时只启用一种登录方式</n-tooltip></h1>
<h1>设置</h1>
<n-button type="primary" @click="save">保存</n-button>
</header>
<div class="content">
<div class="form-grid">
<label>方式</label>
<label>方式 <n-tooltip><template #trigger><span class="hint">?</span></template>同时只启用一种登录方式</n-tooltip></label>
<n-radio-group v-model:value="mode">
<n-radio value="local">自有账号</n-radio>
<n-radio value="nqi">大数据平台账号</n-radio>
</n-radio-group>
<label>刷新间隔</label>
<n-input-number v-model:value="seconds" :min="60" :max="86400" />
<label>并行数量 <n-tooltip><template #trigger><span class="hint">?</span></template>采集和导出共用。调大后马上多领任务;调小后等正在运行的结束,再降到新的数量</n-tooltip></label>
<n-input-number v-model:value="concurrency" :min="1" :max="32" />
</div>
<p>{{ message }}</p>
</div>
+1 -1
View File
@@ -9,7 +9,7 @@ const role = sessionStorage.getItem("decom-role");
const name = sessionStorage.getItem("decom-name") || "";
const items = role === "admin"
? [
{ label: "登录方式", path: "/admin/settings" },
{ label: "设置", path: "/admin/settings" },
{ label: "用户", path: "/admin/users" },
{ label: "账号池", path: "/admin/pool" },
{ label: "采集", path: "/admin/sources" },