fix: 任务写清进度,设置和采集更好填

This commit is contained in:
2026-10-30 17:53:59 +08:00
parent 309ccebe6d
commit 08b2cb35be
7 changed files with 165 additions and 34 deletions
+21 -5
View File
@@ -1,17 +1,33 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { NButton, NInputNumber, NRadio, NRadioGroup } from "naive-ui";
import { NButton, NIcon, NInputNumber, NRadio, NRadioGroup, NTooltip, useDialog } from "naive-ui";
import { HelpCircleOutline } from "@vicons/ionicons5";
import Shell from "../../shell/Shell.vue";
import { api } from "../../shared/http";
import { useToast } from "../../shared/toast";
const toast = useToast();
const dialog = useDialog();
const mode = ref("local");
const seconds = ref(300);
const concurrency = ref(4);
const saving = ref(false);
const loaded = ref(false);
function askMode(next: string) {
if (next === mode.value) return;
const toPlatform = next === "nqi";
dialog.warning({
title: "更换登录方式",
content: toPlatform
? "换成大数据平台账号后,登录页会显示图形验证码,登录失败会换一张。管理员仍只校验本系统密码。"
: "换成自有账号后,登录页不再显示验证码。",
positiveText: "更换",
negativeText: "取消",
onPositiveClick: () => { mode.value = next; },
});
}
async function load() {
try {
const result = await api<{ loginMode: string; credentialRefreshSeconds: number; workerConcurrency: number }>("/api/admin/settings");
@@ -55,21 +71,21 @@ onMounted(load);
<p v-if="!loaded" class="admin-status">正在获取</p>
<div v-else class="settings-fields">
<div class="form-row">
<label for="login-mode">方式</label>
<n-radio-group id="login-mode" v-model:value="mode">
<label for="login-mode">登录方式<n-tooltip><template #trigger><n-icon class="hint-mark" :size="16"><HelpCircleOutline /></n-icon></template>自有账号登录不显示验证码。大数据平台登录会显示图形验证码,失败后换一张。管理员始终只校验本系统密码。</n-tooltip></label>
<n-radio-group id="login-mode" :value="mode" @update:value="askMode">
<n-radio value="local">自有账号</n-radio>
<n-radio value="nqi">大数据平台账号</n-radio>
</n-radio-group>
</div>
<div class="form-row">
<label for="refresh-seconds">刷新间隔</label>
<label for="refresh-seconds">凭证刷新间隔<n-tooltip><template #trigger><n-icon class="hint-mark" :size="16"><HelpCircleOutline /></n-icon></template>账号池里的平台凭证按这个间隔刷新。</n-tooltip></label>
<div class="setting-control">
<n-input-number id="refresh-seconds" v-model:value="seconds" button-placement="both" :min="60" :max="86400" :precision="0" />
<span class="setting-unit">秒</span>
</div>
</div>
<div class="form-row">
<label for="worker-concurrency">并行数量</label>
<label for="worker-concurrency">同时运行的任务数<n-tooltip><template #trigger><n-icon class="hint-mark" :size="16"><HelpCircleOutline /></n-icon></template>采集和导出共用。调大后马上多领任务。调小后不打断正在运行的任务。</n-tooltip></label>
<div class="setting-control">
<n-input-number id="worker-concurrency" v-model:value="concurrency" button-placement="both" :min="1" :max="32" :precision="0" />
<span class="setting-unit">个</span>
+5 -3
View File
@@ -131,10 +131,9 @@ onMounted(load);
</div>
</section>
<n-modal v-model:show="show" preset="dialog" title="采集" positive-text="保存" negative-text="取消" @positive-click="save">
<div class="form-row"><label>名称</label><n-input v-model:value="name" /></div>
<div class="form-row"><label>来源</label><n-select v-model:value="kind" :options="[{ label: 'FTP/SFTP', value: 'ftp' }, { label: 'NQI', value: 'nqi' }]" /></div>
<div class="form-row"><label>周期(天)</label><n-input-number v-model:value="periodDays" :min="1" :max="31" :show-button="false" /></div>
<div class="form-row"><label>启用</label><n-switch v-model:value="enabled" /></div>
<div class="form-row"><label>名称</label><n-input v-model:value="name" /></div>
<p class="form-section">连接</p>
<template v-if="kind === 'ftp'">
<div class="form-row"><label>协议</label><n-select v-model:value="protocol" :options="[{ label: 'SFTP', value: 'sftp' }, { label: 'FTP', value: 'ftp' }]" /></div>
<div class="form-row"><label>主机</label><n-input v-model:value="host" /></div>
@@ -146,6 +145,9 @@ onMounted(load);
<template v-else>
<div class="form-row"><label>地址</label><n-input v-model:value="url" /></div>
</template>
<p class="form-section">周期</p>
<div class="form-row"><label>周期(天)</label><n-input-number v-model:value="periodDays" :min="1" :max="31" :show-button="false" /></div>
<div class="form-row"><label>启用</label><n-switch v-model:value="enabled" /></div>
</n-modal>
</Shell>
</template>