feat(rohs-check): 新增 RoHS 检核工具 API 及相关功能
This commit is contained in:
1 parent
8a541211b7
commit
24551e9a9a
39 files changed
+3128
-189
No files matched your search
@@ -15,17 +15,20 @@ const admin = useSchedulesAdmin();
|
||||
onMounted(() => { void admin.loadAll(); });
|
||||
|
||||
const {
|
||||
agents, users, schedules, selectedScheduleRuns, scheduleLoading, scheduleRunsLoading,
|
||||
agents, users, kbGroups, schedules, selectedScheduleRuns, scheduleLoading, scheduleRunsLoading,
|
||||
selectedScheduleId, scheduleRunStatusFilter, scheduleRunStartedAfter, scheduleRunStartedBefore,
|
||||
scheduleRunColumnDefs, scheduleViewMode, showScheduleCreateModal, scheduleCreateSaving,
|
||||
scheduleEditingId, scheduleCreateForm, scheduleConfigCollapsed, scheduleCronDesigner,
|
||||
weeklyDayOptions, scheduleCronPreview, scheduleNextRunPreview, selectedSchedule,
|
||||
scheduleRunStatusOptions, getScheduleRunStatusBadge, formatDateTime, expandedScheduleRunId,
|
||||
expandedScheduleRun, stepLabelMap, stepStatusMap, showTestRunDialog, testRunSchedule,
|
||||
testRunWhere, testRunOrderBy, testRunBaseFetchSql, testRunLimit, testRunLoading, testRunResult,
|
||||
testRunWhere, testRunOrderBy, testRunBaseFetchSql, testRunLimit, testRunKbSync, testRunKbSyncAvailable,
|
||||
testRunKbSyncAttempted, testRunLoading, testRunResult,
|
||||
filteredScheduleRuns, selectedScheduleRunMetrics, selectedScheduleLatestRunAt,
|
||||
scheduleEnabledCount, scheduleDisabledCount, scheduleRunningCount, scheduleSqlEditForm,
|
||||
scheduleTestLoading, scheduleTestResult, scheduleNotifyDropdownOpen,
|
||||
scheduleTestLoading, scheduleTestResult, scheduleNotifyDropdownOpen, scheduleNotifyUserQuery,
|
||||
filteredNotifyUsers, scheduleCloseNotifyDropdown, scheduleOwnerDropdownOpen, scheduleOwnerQuery,
|
||||
filteredOwnerUsers, selectScheduleOwner, handleScheduleOwnerInput, scheduleCloseOwnerDropdown,
|
||||
showDeleteConfirmDialog, deleteConfirmTitle, deleteConfirmMessage,
|
||||
loadSchedules, startScheduleColResize, openScheduleCreateModal, openScheduleEditModal,
|
||||
openScheduleRunSubmenu, backToScheduleOverview, viewScheduleRuns, resetScheduleRunFilters,
|
||||
@@ -416,7 +419,7 @@ const {
|
||||
<td class="whitespace-nowrap px-4 py-2.5">
|
||||
<div class="flex items-center">
|
||||
<button
|
||||
v-if="(r.step_logs && r.step_logs.length > 0) || r.dify_execution_snapshot"
|
||||
v-if="(r.step_logs && r.step_logs.length > 0) || r.dify_execution_snapshot || r.kb_sync_status"
|
||||
@click="expandedScheduleRunId = expandedScheduleRunId === r.id ? null : r.id"
|
||||
class="inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-lg border border-blue-200 px-2 py-1 text-xs font-medium text-blue-600 transition-colors hover:bg-blue-50"
|
||||
>
|
||||
@@ -435,6 +438,23 @@ const {
|
||||
>
|
||||
<td colspan="10" class="px-4 py-3 bg-surface-soft/60">
|
||||
<div class="space-y-3">
|
||||
<div
|
||||
v-if="expandedScheduleRun.kb_sync_status"
|
||||
class="rounded-xl border border-emerald-200 bg-emerald-50/50 p-3 text-xs text-secondary"
|
||||
>
|
||||
<div class="font-bold text-emerald-800">{{ $t('admin.schedule.kbSync.title') }}</div>
|
||||
<div class="mt-1">
|
||||
<span class="font-semibold text-muted">{{ $t('admin.schedule.kbSync.status') }}:</span>
|
||||
{{ expandedScheduleRun.kb_sync_status }}
|
||||
</div>
|
||||
<div v-if="expandedScheduleRun.kb_document_id" class="mt-1">
|
||||
<span class="font-semibold text-muted">{{ $t('admin.schedule.kbSync.document') }}:</span>
|
||||
{{ expandedScheduleRun.kb_document_id }}
|
||||
</div>
|
||||
<div v-if="expandedScheduleRun.kb_sync_error" class="mt-1 text-rose-600">
|
||||
{{ expandedScheduleRun.kb_sync_error }}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="expandedScheduleRun.dify_execution_snapshot"
|
||||
class="rounded-xl border border-indigo-200 bg-indigo-50/50 p-3"
|
||||
@@ -544,6 +564,20 @@ const {
|
||||
<input type="number" v-model.number="testRunLimit" min="1" max="10" class="w-full input-field px-3 py-2 text-sm text-secondary focus:border-blue-300 focus:outline-none focus:ring-1 focus:ring-blue-200" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="rounded-xl border border-emerald-200 bg-emerald-50/40 px-4 py-3">
|
||||
<label class="inline-flex items-center gap-2 text-sm text-secondary">
|
||||
<input
|
||||
v-model="testRunKbSync"
|
||||
type="checkbox"
|
||||
class="h-4 w-4 rounded border-default text-emerald-600 focus:ring-emerald-300"
|
||||
:disabled="!testRunKbSyncAvailable"
|
||||
/>
|
||||
{{ $t('admin.schedule.testRun.writeToKb') }}
|
||||
</label>
|
||||
<p class="mt-1 text-xs text-muted">
|
||||
{{ testRunKbSyncAvailable ? $t('admin.schedule.testRun.writeToKbHint') : $t('admin.schedule.testRun.noKbGroupHint') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<button
|
||||
class="inline-flex items-center gap-1.5 rounded-xl bg-violet-600 px-4 py-2 text-sm font-semibold text-white transition hover:bg-violet-700 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
@@ -636,6 +670,30 @@ const {
|
||||
<summary class="cursor-pointer text-xs font-semibold text-rose-600 hover:text-rose-800">{{ $t('admin.schedule.testRun.errors', { count: testRunResult.errors.length }) }}</summary>
|
||||
<pre class="mt-1 whitespace-pre-wrap rounded-lg bg-rose-50 p-3 text-xs text-rose-700 font-mono">{{ testRunResult.errors.join('\n') }}</pre>
|
||||
</details>
|
||||
|
||||
<div
|
||||
v-if="testRunKbSyncAttempted"
|
||||
class="rounded-xl border px-4 py-3 text-xs text-secondary"
|
||||
:class="testRunResult.kb_sync_status === 'success' ? 'border-emerald-200 bg-emerald-50/40' : testRunResult.kb_sync_status === 'failed' ? 'border-rose-200 bg-rose-50/40' : 'border-amber-200 bg-amber-50/40'"
|
||||
>
|
||||
<div class="font-bold" :class="testRunResult.kb_sync_status === 'success' ? 'text-emerald-800' : testRunResult.kb_sync_status === 'failed' ? 'text-rose-800' : 'text-amber-800'">
|
||||
{{ $t('admin.schedule.kbSync.title') }}
|
||||
</div>
|
||||
<div v-if="testRunResult.kb_sync_status" class="mt-1">
|
||||
<span class="font-semibold text-muted">{{ $t('admin.schedule.kbSync.status') }}:</span>
|
||||
{{ testRunResult.kb_sync_status }}
|
||||
</div>
|
||||
<div v-else class="mt-1 text-amber-700">
|
||||
{{ $t('admin.schedule.testRun.kbSyncNoStatus') }}
|
||||
</div>
|
||||
<div v-if="testRunResult.kb_document_id" class="mt-1">
|
||||
<span class="font-semibold text-muted">{{ $t('admin.schedule.kbSync.document') }}:</span>
|
||||
{{ testRunResult.kb_document_id }}
|
||||
</div>
|
||||
<div v-if="testRunResult.kb_sync_error" class="mt-1 text-rose-600">
|
||||
{{ testRunResult.kb_sync_error }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -661,12 +719,33 @@ const {
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-secondary">{{ $t('admin.schedule.form.owner') }}</label>
|
||||
<div class="relative">
|
||||
<select v-model="scheduleCreateForm.owner_user_id" class="input-field appearance-none pr-10 !text-sm !leading-5" :disabled="users.length === 0">
|
||||
<option :value="null">{{ users.length === 0 ? $t('admin.schedule.form.noUsers') : $t('admin.schedule.form.selectOwner') }}</option>
|
||||
<option v-for="u in users" :key="u.id" :value="u.id">{{ u.real_name || u.username }}{{ u.employee_id ? '(' + u.employee_id + ')' : '' }}</option>
|
||||
</select>
|
||||
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3">
|
||||
<svg class="h-4 w-4 text-muted" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z" clip-rule="evenodd"/></svg>
|
||||
<input
|
||||
v-model="scheduleOwnerQuery"
|
||||
type="text"
|
||||
class="input-field !text-sm !leading-5"
|
||||
:placeholder="users.length === 0 ? $t('admin.schedule.form.noUsers') : $t('admin.schedule.form.selectOwner')"
|
||||
:disabled="users.length === 0"
|
||||
@focus="scheduleOwnerDropdownOpen = true"
|
||||
@input="handleScheduleOwnerInput"
|
||||
@blur="scheduleCloseOwnerDropdown"
|
||||
/>
|
||||
<div
|
||||
v-if="scheduleOwnerDropdownOpen && users.length > 0"
|
||||
class="admin-dropdown max-h-60 w-full overflow-y-auto"
|
||||
>
|
||||
<button
|
||||
v-for="u in filteredOwnerUsers"
|
||||
:key="u.id"
|
||||
type="button"
|
||||
class="flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition hover:bg-surface-soft"
|
||||
:class="scheduleCreateForm.owner_user_id === u.id ? 'bg-blue-50/50' : ''"
|
||||
@mousedown.prevent="selectScheduleOwner(u.id)"
|
||||
>
|
||||
<span class="text-secondary">{{ u.real_name || u.username }}{{ u.employee_id ? '(' + u.employee_id + ')' : '' }}</span>
|
||||
</button>
|
||||
<div v-if="filteredOwnerUsers.length === 0" class="px-3 py-2 text-sm text-muted">
|
||||
{{ $t('admin.wecom.noData') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -927,6 +1006,21 @@ const {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rounded-2xl border border-emerald-200 bg-emerald-50/40 p-4">
|
||||
<label class="flex items-center gap-2 text-sm font-semibold text-secondary">
|
||||
<input v-model="scheduleCreateForm.kb_sync_enabled" type="checkbox" class="h-4 w-4 rounded border-default text-emerald-600 focus:ring-emerald-300" />
|
||||
{{ $t('admin.schedule.form.kbSyncEnabled') }}
|
||||
</label>
|
||||
<p class="mt-1 text-xs text-muted">{{ $t('admin.schedule.form.kbSyncHint') }}</p>
|
||||
<div v-if="scheduleCreateForm.kb_sync_enabled" class="mt-3">
|
||||
<label class="mb-2 block text-sm font-medium text-secondary">{{ $t('admin.schedule.form.kbGroup') }}</label>
|
||||
<select v-model="scheduleCreateForm.kb_group_id" class="input-field !text-sm !leading-5" :disabled="kbGroups.length === 0">
|
||||
<option :value="null">{{ kbGroups.length === 0 ? $t('admin.schedule.form.noKbGroups') : $t('admin.schedule.form.selectKbGroup') }}</option>
|
||||
<option v-for="group in kbGroups" :key="group.id" :value="group.id">{{ group.name }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="scheduleCreateForm.dify_agent_id" class="rounded-2xl border border-indigo-200 bg-indigo-50/40 p-4">
|
||||
<div class="mb-2">
|
||||
<label class="block text-sm font-medium text-secondary">Dify System Prompt</label>
|
||||
@@ -1045,44 +1139,53 @@ const {
|
||||
</label>
|
||||
<div v-if="scheduleCreateForm.notify_enabled" class="relative flex-1">
|
||||
<div
|
||||
class="min-h-[38px] cursor-pointer input-field px-3 py-2 text-sm flex flex-wrap gap-1.5 items-center focus-within:border-blue-300 focus-within:ring-1 focus-within:ring-blue-200"
|
||||
@click="scheduleNotifyDropdownOpen = !scheduleNotifyDropdownOpen"
|
||||
class="min-h-[38px] input-field px-3 py-2 text-sm flex flex-wrap gap-1.5 items-center focus-within:border-blue-300 focus-within:ring-1 focus-within:ring-blue-200"
|
||||
>
|
||||
<template v-if="scheduleCreateForm.notify_user_ids_json.length > 0">
|
||||
<span
|
||||
v-for="uid in scheduleCreateForm.notify_user_ids_json"
|
||||
:key="uid"
|
||||
class="inline-flex items-center gap-1 rounded-lg bg-blue-50 px-2 py-0.5 text-xs font-medium text-blue-700"
|
||||
>
|
||||
{{ getUserName(uid) }}
|
||||
<button
|
||||
class="ml-0.5 text-blue-400 hover:text-blue-600"
|
||||
@click.stop="removeNotifyUser(uid)"
|
||||
>✕</button>
|
||||
</span>
|
||||
</template>
|
||||
<span v-else class="text-muted">{{ $t('admin.schedule.form.selectNotifyUsers') }}</span>
|
||||
<span
|
||||
v-for="uid in scheduleCreateForm.notify_user_ids_json"
|
||||
:key="uid"
|
||||
class="inline-flex items-center gap-1 rounded-lg bg-blue-50 px-2 py-0.5 text-xs font-medium text-blue-700"
|
||||
>
|
||||
{{ getUserName(uid) }}
|
||||
<button
|
||||
type="button"
|
||||
class="ml-0.5 text-blue-400 hover:text-blue-600"
|
||||
@click.stop="removeNotifyUser(uid)"
|
||||
>✕</button>
|
||||
</span>
|
||||
<input
|
||||
v-model="scheduleNotifyUserQuery"
|
||||
type="text"
|
||||
class="min-w-[120px] flex-1 border-0 bg-transparent p-0 text-sm text-secondary outline-none focus:ring-0"
|
||||
:placeholder="$t('admin.schedule.form.selectNotifyUsers')"
|
||||
@focus="scheduleNotifyDropdownOpen = true"
|
||||
@input="scheduleNotifyDropdownOpen = true"
|
||||
@blur="scheduleCloseNotifyDropdown"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="scheduleNotifyDropdownOpen"
|
||||
class="admin-dropdown w-full"
|
||||
class="admin-dropdown max-h-60 w-full overflow-y-auto"
|
||||
>
|
||||
<div
|
||||
v-for="u in users"
|
||||
<button
|
||||
v-for="u in filteredNotifyUsers"
|
||||
:key="u.id"
|
||||
class="flex cursor-pointer items-center gap-2 px-3 py-2 text-sm transition hover:bg-surface-soft"
|
||||
type="button"
|
||||
class="flex w-full cursor-pointer items-center gap-2 px-3 py-2 text-left text-sm transition hover:bg-surface-soft"
|
||||
:class="scheduleCreateForm.notify_user_ids_json.includes(u.id) ? 'bg-blue-50/50' : ''"
|
||||
@click="toggleNotifyUser(u.id)"
|
||||
@mousedown.prevent="toggleNotifyUser(u.id)"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
class="h-3.5 w-3.5 rounded text-blue-600"
|
||||
class="pointer-events-none h-3.5 w-3.5 rounded text-blue-600"
|
||||
:checked="scheduleCreateForm.notify_user_ids_json.includes(u.id)"
|
||||
@click.stop
|
||||
@change.stop="toggleNotifyUser(u.id)"
|
||||
tabindex="-1"
|
||||
readonly
|
||||
/>
|
||||
<span class="text-secondary">{{ u.real_name || u.username }}{{ u.employee_id ? '(' + u.employee_id + ')' : '' }}</span>
|
||||
</button>
|
||||
<div v-if="filteredNotifyUsers.length === 0" class="px-3 py-2 text-sm text-muted">
|
||||
{{ $t('admin.wecom.noData') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user