refactor(frontend): 重构前端第二版
This commit is contained in:
1 parent
2631f78b00
commit
4b562cfa82
205 files changed
+15399
-12015
No files matched your search
@@ -0,0 +1,178 @@
|
||||
/**
|
||||
* features/admin/api/admin.api.ts
|
||||
* 管理后台 HTTP API:用户、部门、Agent、权限、报表、企业微信、公告等。
|
||||
*/
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import { requestJson } from '@/shared/api/client';
|
||||
import type { AdminDashboardBadges, AdminDashboardSummary } from '../types/dashboard.types';
|
||||
|
||||
const auth = () => ({ headers: getAuthHeaders() });
|
||||
const jsonAuth = () => ({ headers: { 'Content-Type': 'application/json', ...getAuthHeaders() } });
|
||||
|
||||
// Users
|
||||
export const listAdminUsers = () => requestJson<any[]>('/api/admin/users', auth());
|
||||
export const createAdminUser = (payload: Record<string, unknown>) =>
|
||||
requestJson('/api/admin/users', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const updateAdminUser = (id: number, payload: Record<string, unknown>) =>
|
||||
requestJson(`/api/admin/users/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const approveAdminUser = (id: number) =>
|
||||
requestJson(`/api/admin/users/${id}/approve`, { method: 'POST', ...auth() });
|
||||
export const rejectAdminUser = (id: number) =>
|
||||
requestJson(`/api/admin/users/${id}/reject`, { method: 'POST', ...auth() });
|
||||
export const cleanupRejectedAdminUsers = () =>
|
||||
requestJson<{ deleted_count: number }>('/api/admin/users/cleanup-rejected', { method: 'POST', ...auth() });
|
||||
export const batchDeleteAdminUsers = (userIds: number[]) =>
|
||||
requestJson<{ deleted_count: number }>('/api/admin/users/batch-delete', {
|
||||
method: 'POST',
|
||||
...jsonAuth(),
|
||||
body: JSON.stringify({ user_ids: userIds }),
|
||||
});
|
||||
export const batchUpdateAdminUsers = (userIds: number[], data: Record<string, unknown>) =>
|
||||
requestJson('/api/admin/users/batch', {
|
||||
method: 'PUT',
|
||||
...jsonAuth(),
|
||||
body: JSON.stringify({ user_ids: userIds, data }),
|
||||
});
|
||||
export const updateAdminUserPermissions = (userId: number, agentIds: number[]) =>
|
||||
requestJson(`/api/admin/users/${userId}/permissions`, {
|
||||
method: 'POST',
|
||||
...jsonAuth(),
|
||||
body: JSON.stringify({ agent_ids: agentIds }),
|
||||
});
|
||||
|
||||
// Departments
|
||||
export const listAdminDepartments = () => requestJson<any[]>('/api/admin/departments', auth());
|
||||
export const createAdminDepartment = (payload: Record<string, unknown>) =>
|
||||
requestJson('/api/admin/departments', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const updateAdminDepartment = (id: number, payload: Record<string, unknown>) =>
|
||||
requestJson(`/api/admin/departments/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const deleteAdminDepartment = (id: number) =>
|
||||
requestJson(`/api/admin/departments/${id}`, { method: 'DELETE', ...auth() });
|
||||
|
||||
// Agents
|
||||
export const listAdminAgents = () => requestJson<any[]>('/api/admin/agents', auth());
|
||||
export const createAdminAgent = (payload: Record<string, unknown>) =>
|
||||
requestJson('/api/admin/agents', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const updateAdminAgent = (id: number, payload: Record<string, unknown>) =>
|
||||
requestJson(`/api/admin/agents/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const deleteAdminAgent = (id: number) =>
|
||||
requestJson(`/api/admin/agents/${id}`, { method: 'DELETE', ...auth() });
|
||||
|
||||
// Agent Guides
|
||||
export const listAdminAgentGuides = (agentId?: number) => {
|
||||
const url = agentId ? `/api/admin/guides?agent_id=${agentId}` : '/api/admin/guides';
|
||||
return requestJson<any[]>(url, auth());
|
||||
};
|
||||
|
||||
export const createAdminAgentGuide = (payload: Record<string, unknown>) =>
|
||||
requestJson('/api/admin/guides', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
|
||||
export const updateAdminAgentGuide = (id: number, payload: Record<string, unknown>) =>
|
||||
requestJson(`/api/admin/guides/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
|
||||
export const deleteAdminAgentGuide = (id: number) =>
|
||||
requestJson(`/api/admin/guides/${id}`, { method: 'DELETE', ...auth() });
|
||||
|
||||
export const uploadAdminAgentGuideFile = async (file: File) => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const response = await fetch('/api/admin/guides/upload', {
|
||||
method: 'POST',
|
||||
headers: getAuthHeaders(),
|
||||
body: formData,
|
||||
});
|
||||
if (!response.ok) {
|
||||
const error = await response.json().catch(() => ({}));
|
||||
throw new Error(error.message || 'Upload failed');
|
||||
}
|
||||
return response.json();
|
||||
};
|
||||
export const testAdminAgent = (id: number) =>
|
||||
requestJson<any>(`/api/admin/agents/${id}/test`, { method: 'POST', ...auth() });
|
||||
export const saveAdminAgentPermissions = (agentId: number, userIds: number[]) =>
|
||||
requestJson(`/api/admin/agents/${agentId}/permissions`, {
|
||||
method: 'POST',
|
||||
...jsonAuth(),
|
||||
body: JSON.stringify({ user_ids: userIds }),
|
||||
});
|
||||
|
||||
// Permission requests
|
||||
export const listAdminPermissionRequests = () =>
|
||||
requestJson<any[]>('/api/admin/permission-requests', auth());
|
||||
export const approveAdminPermissionRequest = (id: number) =>
|
||||
requestJson(`/api/admin/permission-requests/${id}/approve`, { method: 'POST', ...auth() });
|
||||
export const rejectAdminPermissionRequest = (id: number) =>
|
||||
requestJson(`/api/admin/permission-requests/${id}/reject`, { method: 'POST', ...auth() });
|
||||
export const batchUpdateAdminPermissions = (payload: Record<string, unknown>) =>
|
||||
requestJson('/api/admin/permissions/batch', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const importAdminPermissions = (formData: FormData) =>
|
||||
requestJson('/api/admin/permissions/import', { method: 'POST', ...auth(), body: formData });
|
||||
|
||||
// Dashboard
|
||||
/** 仪表盘四张卡片:Agent 数、用户数、对话总数、平均评分 */
|
||||
export const getAdminDashboardSummary = () =>
|
||||
requestJson<AdminDashboardSummary>('/api/admin/dashboard/summary', auth());
|
||||
|
||||
/** 侧栏角标:待审批用户数、待处理权限申请数 */
|
||||
export const getAdminDashboardBadges = () =>
|
||||
requestJson<AdminDashboardBadges>('/api/admin/dashboard/badges', auth());
|
||||
|
||||
// Reports
|
||||
export const getAdminUsageReport = () => requestJson<any>('/api/admin/reports/usage', auth());
|
||||
export const getAdminFeedbackReport = () => requestJson<any>('/api/admin/reports/feedback', auth());
|
||||
export const getAdminReportTable = (url: string) => requestJson<any[]>(url, auth());
|
||||
export const getAdminReportTableCount = (url: string) => requestJson<{ total: number }>(url, auth());
|
||||
export const batchDeleteAdminChatLogs = (ids: number[]) =>
|
||||
requestJson<{ deleted_count: number }>('/api/admin/database/chat_logs/batch-delete', {
|
||||
method: 'POST',
|
||||
...jsonAuth(),
|
||||
body: JSON.stringify({ ids }),
|
||||
});
|
||||
|
||||
// WeCom admin
|
||||
export const listAdminWecomBindings = (boundOnly: boolean) =>
|
||||
requestJson<any[]>(`/api/admin/wecom/bindings?bound_only=${boundOnly ? 'true' : 'false'}`, auth());
|
||||
export const listAdminWecomLoginAudits = (query: string) =>
|
||||
requestJson<any[]>(`/api/admin/wecom/login-audits?${query}`, auth());
|
||||
export const getAdminWecomSystemSettings = () =>
|
||||
requestJson<any>('/api/admin/wecom/system-settings', auth());
|
||||
export const getAdminWecomIntegrationManifest = () =>
|
||||
requestJson<any>('/api/admin/wecom/integration-manifest', auth());
|
||||
export const saveAdminWecomSystemSettings = (payload: Record<string, unknown>) =>
|
||||
requestJson<any>('/api/admin/wecom/system-settings', {
|
||||
method: 'PUT',
|
||||
...jsonAuth(),
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
export const getAdminWecomNotifySettings = () =>
|
||||
requestJson<any>('/api/admin/wecom/notify-settings', auth());
|
||||
export const saveAdminWecomNotifySettings = (payload: Record<string, unknown>) =>
|
||||
requestJson<any>('/api/admin/wecom/notify-settings', {
|
||||
method: 'PUT',
|
||||
...jsonAuth(),
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
export const getAdminWecomNotifyMetrics = () =>
|
||||
requestJson<any>('/api/admin/wecom/notify-metrics', auth());
|
||||
export const bindAdminWecomUser = (payload: Record<string, unknown>) =>
|
||||
requestJson('/api/admin/wecom/bind', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const unbindAdminWecomUser = (userId: number) =>
|
||||
requestJson('/api/admin/wecom/unbind', {
|
||||
method: 'POST',
|
||||
...jsonAuth(),
|
||||
body: JSON.stringify({ user_id: userId }),
|
||||
});
|
||||
|
||||
// Announcements (admin module uses user endpoints)
|
||||
export const listAnnouncements = () => requestJson<any[]>('/api/user/announcements', auth());
|
||||
export const createAnnouncement = (payload: Record<string, unknown>) =>
|
||||
requestJson('/api/user/announcements', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const deleteAnnouncement = (id: number) =>
|
||||
requestJson(`/api/user/announcements/${id}`, { method: 'DELETE', ...auth() });
|
||||
|
||||
// Quick questions
|
||||
export const listAdminQuickQuestions = () => requestJson<any[]>('/api/admin/quick-questions', auth());
|
||||
export const saveAdminQuickQuestion = (url: string, method: string, payload: Record<string, unknown>) =>
|
||||
requestJson(url, { method, ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const deleteAdminQuickQuestion = (id: number) =>
|
||||
requestJson(`/api/admin/quick-questions/${id}`, { method: 'DELETE', ...auth() });
|
||||
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* features/admin/api/schedule.api.ts
|
||||
* 管理后台定时任务 HTTP API:任务 CRUD、配置、测试执行、运行记录。
|
||||
*/
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import { requestJson } from '@/shared/api/client';
|
||||
import type {
|
||||
DifyExecutionSnapshot,
|
||||
ScheduleRun,
|
||||
ScheduleTask,
|
||||
StepLog,
|
||||
TestScheduleRunResult,
|
||||
TestScheduleSqlResult,
|
||||
} from '@/shared/types/schedule.types';
|
||||
|
||||
async function getJson<T>(url: string): Promise<T> {
|
||||
return requestJson<T>(url, { headers: getAuthHeaders() });
|
||||
}
|
||||
|
||||
export const listAdminSchedules = () =>
|
||||
getJson<ScheduleTask[]>('/api/admin/schedules');
|
||||
|
||||
export const getAdminSchedule = (taskId: number) =>
|
||||
getJson<ScheduleTask>(`/api/admin/schedules/${taskId}`);
|
||||
|
||||
export const exportAdminScheduleUrl = (taskId: number) => `/api/admin/schedules/${taskId}/export`;
|
||||
|
||||
export const importAdminSchedules = async (payload: any) => {
|
||||
return requestJson('/api/admin/schedules/import', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
};
|
||||
|
||||
export const getAdminScheduleTaskConfig = (taskId: number) =>
|
||||
getJson<{ data_source_type: string; config: Record<string, any> | null }>(`/api/admin/schedule-config/${taskId}`);
|
||||
|
||||
export const updateAdminScheduleTaskConfig = (taskId: number, payload: Record<string, any>) =>
|
||||
requestJson(`/api/admin/schedule-config/${taskId}`, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
export const testAdminScheduleSql = (taskId: number, payload: { fetch_where_conditions?: string; fetch_order_by?: string; limit?: number }) =>
|
||||
requestJson<TestScheduleSqlResult>(`/api/admin/schedule-config/${taskId}/test-sql`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
export const testAdminScheduleRun = (
|
||||
taskId: number,
|
||||
payload: {
|
||||
fetch_where_conditions?: string;
|
||||
fetch_order_by?: string;
|
||||
limit?: number;
|
||||
kb_sync_enabled?: boolean;
|
||||
},
|
||||
) =>
|
||||
requestJson<TestScheduleRunResult>(`/api/admin/schedule-config/${taskId}/test-run`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
export const createAdminSchedule = (payload: Partial<ScheduleTask> & { config?: Record<string, any> }) =>
|
||||
requestJson('/api/admin/schedules', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
export const updateAdminSchedule = (id: number, payload: Partial<ScheduleTask> & { config?: Record<string, any> }) =>
|
||||
requestJson(`/api/admin/schedules/${id}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json', ...getAuthHeaders() },
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
export const deleteAdminSchedule = (id: number) =>
|
||||
requestJson(`/api/admin/schedules/${id}`, {
|
||||
method: 'DELETE',
|
||||
headers: getAuthHeaders(),
|
||||
});
|
||||
|
||||
export const runAdminSchedule = (id: number) =>
|
||||
requestJson(`/api/admin/schedules/${id}/run`, { method: 'POST', headers: getAuthHeaders() });
|
||||
|
||||
export const toggleAdminSchedule = (id: number, enabled: boolean) =>
|
||||
requestJson(`/api/admin/schedules/${id}/${enabled ? 'enable' : 'disable'}`, { method: 'POST', headers: getAuthHeaders() });
|
||||
|
||||
export const listAdminScheduleRuns = (taskId: number, params?: { status?: string; started_after?: string; started_before?: string }) => {
|
||||
const sp = new URLSearchParams();
|
||||
if (params?.status) sp.set('status', params.status);
|
||||
if (params?.started_after) sp.set('started_after', params.started_after);
|
||||
if (params?.started_before) sp.set('started_before', params.started_before);
|
||||
const qs = sp.toString();
|
||||
return getJson<ScheduleRun[]>(`/api/admin/schedules/${taskId}/runs${qs ? '?' + qs : ''}`);
|
||||
};
|
||||
|
||||
export const adminRunExcelUrl = (runId: number) => `/api/admin/schedule-runs/${runId}/excel`;
|
||||
|
||||
export type { DifyExecutionSnapshot, ScheduleRun, ScheduleTask, StepLog, TestScheduleRunResult, TestScheduleSqlResult };
|
||||
@@ -8,3 +8,5 @@ export { default as AdminLayout } from './views/AdminLayout.vue';
|
||||
export { useAdminNavStore } from './stores/admin-nav.store';
|
||||
export { adminModulePath, ADMIN_MODULE_METAS } from './constants/modules';
|
||||
export type { AdminModuleId } from './types/admin.types';
|
||||
export * from './api/admin.api';
|
||||
export * from './api/schedule.api';
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/agents/AgentsPage.vue
|
||||
*
|
||||
* Agent 管理独立页面(Phase 1 首个拆分模块)。
|
||||
@@ -9,7 +9,7 @@
|
||||
import { onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Bot, Plus, Trash2, Users } from 'lucide-vue-next';
|
||||
import DeleteConfirmDialog from '@/components/DeleteConfirmDialog.vue';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import AgentPermissionModal from './components/AgentPermissionModal.vue';
|
||||
import AgentTestModal from './components/AgentTestModal.vue';
|
||||
import { useAgentsAdmin } from './composables/useAgentsAdmin';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/agents/composables/useAgentsAdmin.ts
|
||||
*
|
||||
* Agent 管理模块的业务逻辑:列表 CRUD、连通性测试、权限分配。
|
||||
@@ -15,8 +15,8 @@ import {
|
||||
saveAdminAgentPermissions,
|
||||
testAdminAgent,
|
||||
updateAdminAgent,
|
||||
} from '@/api/admin';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
} from '@/features/admin/api/admin.api';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type { AdminUserRow } from '@/features/admin/types/admin.types';
|
||||
import type { AgentFormState, AgentRow, AgentSuggestedQuestionItem, AgentTestResult } from '@/features/admin/types/agent.types';
|
||||
import { createEmptyAgentForm } from '@/features/admin/types/agent.types';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/announcements/AnnouncementsPage.vue
|
||||
* 公告管理独立页面。路由:/admin/announcements
|
||||
*/
|
||||
@@ -6,7 +6,7 @@
|
||||
import { onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Trash2 } from 'lucide-vue-next';
|
||||
import DeleteConfirmDialog from '@/components/DeleteConfirmDialog.vue';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import { useAnnouncementsAdmin } from './composables/useAnnouncementsAdmin';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/announcements/composables/useAnnouncementsAdmin.ts
|
||||
* 公告管理:列表、发布、删除。
|
||||
*/
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { createAnnouncement, deleteAnnouncement, listAnnouncements } from '@/api/admin';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
import { createAnnouncement, deleteAnnouncement, listAnnouncements } from '@/features/admin/api/admin.api';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type { AdminAnnouncementRow } from '@/features/admin/types/admin.types';
|
||||
import {
|
||||
createEmptyAnnouncementForm,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/approvals/ApprovalsPage.vue
|
||||
* 用户注册审批独立页面。路由:/admin/approvals
|
||||
*/
|
||||
@@ -6,7 +6,7 @@
|
||||
import { onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ShieldCheck, Trash2 } from 'lucide-vue-next';
|
||||
import DeleteConfirmDialog from '@/components/DeleteConfirmDialog.vue';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import { useApprovalsAdmin } from './composables/useApprovalsAdmin';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/approvals/composables/useApprovalsAdmin.ts
|
||||
* 用户注册审批:待审列表、通过、拒绝。
|
||||
*/
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { approveAdminUser, listAdminUsers, rejectAdminUser } from '@/api/admin';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
import { approveAdminUser, listAdminUsers, rejectAdminUser } from '@/features/admin/api/admin.api';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { useAdminNavBadges } from '@/features/admin/composables/useAdminNavBadges';
|
||||
import type { AdminUserRow } from '@/features/admin/types/admin.types';
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/dashboard/composables/useDashboardAdmin.ts
|
||||
* 仪表盘概览:单次 summary 接口获取四个指标。
|
||||
*/
|
||||
import { ref } from 'vue';
|
||||
import { getAdminDashboardSummary } from '@/api/admin';
|
||||
import { getAdminDashboardSummary } from '@/features/admin/api/admin.api';
|
||||
|
||||
export function useDashboardAdmin() {
|
||||
const agentCount = ref(0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/departments/DepartmentsPage.vue
|
||||
* 部门管理独立页面。路由:/admin/departments
|
||||
*/
|
||||
@@ -6,7 +6,7 @@
|
||||
import { onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Edit, Trash2 } from 'lucide-vue-next';
|
||||
import DeleteConfirmDialog from '@/components/DeleteConfirmDialog.vue';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import { useDepartmentsAdmin } from './composables/useDepartmentsAdmin';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/departments/composables/useDepartmentsAdmin.ts
|
||||
* 部门管理:列表、创建、编辑、删除。
|
||||
*/
|
||||
@@ -9,8 +9,8 @@ import {
|
||||
deleteAdminDepartment,
|
||||
listAdminDepartments,
|
||||
updateAdminDepartment,
|
||||
} from '@/api/admin';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
} from '@/features/admin/api/admin.api';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type { AdminDepartmentRow } from '@/features/admin/types/admin.types';
|
||||
import {
|
||||
createEmptyDepartmentForm,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/knowledge-base/KnowledgeBasePage.vue
|
||||
* 知识库管理独立页面。路由:/admin/knowledge-base
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import KbAdminPanel from '@/components/kb/KbAdminPanel.vue';
|
||||
import KbAdminPanel from '@/shared/components/kb/KbAdminPanel.vue';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/permissions/composables/usePermissionsAdmin.ts
|
||||
* 用户权限矩阵:筛选、单格切换、批量分配、CSV 导入导出。
|
||||
*/
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
listAdminAgents,
|
||||
listAdminUsers,
|
||||
updateAdminUserPermissions,
|
||||
} from '@/api/admin';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
} from '@/features/admin/api/admin.api';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type { AdminAgentOption, AdminUserRow } from '@/features/admin/types/admin.types';
|
||||
import {
|
||||
createEmptyPermissionFilters,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Plus, Trash2, Edit2, Play, FileText, Image as ImageIcon } from 'lucide-vue-next';
|
||||
import { listAdminAgents, listAdminAgentGuides, createAdminAgentGuide, updateAdminAgentGuide, deleteAdminAgentGuide, uploadAdminAgentGuideFile } from '@/api/admin';
|
||||
import { listAdminAgents, listAdminAgentGuides, createAdminAgentGuide, updateAdminAgentGuide, deleteAdminAgentGuide, uploadAdminAgentGuideFile } from '@/features/admin/api/admin.api';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/questions/QuestionsPage.vue
|
||||
* 常用问题管理独立页面。路由:/admin/questions
|
||||
*/
|
||||
@@ -6,7 +6,7 @@
|
||||
import { onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Edit, Trash2 } from 'lucide-vue-next';
|
||||
import DeleteConfirmDialog from '@/components/DeleteConfirmDialog.vue';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import { useQuestionsAdmin } from './composables/useQuestionsAdmin';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/questions/composables/useQuestionsAdmin.ts
|
||||
* 常用问题管理:列表、创建、编辑、删除。
|
||||
*/
|
||||
@@ -9,8 +9,8 @@ import {
|
||||
listAdminAgents,
|
||||
listAdminQuickQuestions,
|
||||
saveAdminQuickQuestion,
|
||||
} from '@/api/admin';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
} from '@/features/admin/api/admin.api';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type { AdminAgentOption } from '@/features/admin/types/admin.types';
|
||||
import {
|
||||
createEmptyQuestionForm,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/reports/ReportsPage.vue
|
||||
* 管理后台报表独立页面。路由:/admin/reports/:table?
|
||||
*/
|
||||
@@ -6,7 +6,7 @@
|
||||
import { onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { BarChart2, Download, Settings2 } from 'lucide-vue-next';
|
||||
import DeleteConfirmDialog from '@/components/DeleteConfirmDialog.vue';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import { useReportsAdmin } from './composables/useReportsAdmin';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/reports/composables/useReportsAdmin.ts
|
||||
* 管理后台报表:多表浏览、筛选、排序、chat_logs 批量删除与用量图表。
|
||||
*/
|
||||
@@ -11,9 +11,9 @@ import {
|
||||
getAdminReportTable,
|
||||
getAdminReportTableCount,
|
||||
getAdminUsageReport,
|
||||
} from '@/api/admin';
|
||||
import { loadReportLayoutPref, saveReportLayoutPref } from '@/composables/useReportLayoutStorage';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
} from '@/features/admin/api/admin.api';
|
||||
import { loadReportLayoutPref, saveReportLayoutPref } from '@/shared/composables/useReportLayoutStorage';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { ADMIN_REPORT_TABLES } from '@/features/admin/constants/modules';
|
||||
import type {
|
||||
ChatLogsLayoutPref,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/requests/composables/useRequestsAdmin.ts
|
||||
* 权限申请管理:列表、通过、拒绝。
|
||||
*/
|
||||
@@ -8,8 +8,8 @@ import {
|
||||
approveAdminPermissionRequest,
|
||||
listAdminPermissionRequests,
|
||||
rejectAdminPermissionRequest,
|
||||
} from '@/api/admin';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
} from '@/features/admin/api/admin.api';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { useAdminNavBadges } from '@/features/admin/composables/useAdminNavBadges';
|
||||
import type { AdminPermissionRequestRow } from '@/features/admin/types/request.types';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/schedules/SchedulesPage.vue
|
||||
* 定时任务管理独立页面。路由:/admin/schedules
|
||||
*/
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
ArrowLeft, ChevronDown, ChevronUp, Download, Edit3, Eye, FlaskConical,
|
||||
Plus, Power, PowerOff, RefreshCw, Rocket, Settings2, Trash2,
|
||||
} from 'lucide-vue-next';
|
||||
import DeleteConfirmDialog from '@/components/DeleteConfirmDialog.vue';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import { useSchedulesAdmin } from './composables/useSchedulesAdmin';
|
||||
|
||||
const admin = useSchedulesAdmin();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/schedules/composables/useSchedulesAdmin.ts
|
||||
* 定时任务管理:概览、工作台、创建/编辑、试运行。
|
||||
*/
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { listAdminAgents, listAdminUsers } from '@/api/admin';
|
||||
import { listAdminAgents, listAdminUsers } from '@/features/admin/api/admin.api';
|
||||
import { getKbGroups, type KbGroup } from '@/api/kb';
|
||||
import {
|
||||
createAdminSchedule,
|
||||
@@ -21,9 +21,9 @@ import {
|
||||
type ScheduleRun,
|
||||
type ScheduleTask,
|
||||
type TestScheduleRunResult,
|
||||
} from '@/api/schedule';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
import { getAuthHeaders } from '@/utils/auth';
|
||||
} from '@/features/admin/api/schedule.api';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import type { AdminAgentOption, AdminUserRow } from '@/features/admin/types/admin.types';
|
||||
|
||||
export function useSchedulesAdmin() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/users/UsersPage.vue
|
||||
* 用户管理独立页面。路由:/admin/users
|
||||
*/
|
||||
@@ -6,7 +6,7 @@
|
||||
import { onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Edit, Plus, Trash2, Users } from 'lucide-vue-next';
|
||||
import DeleteConfirmDialog from '@/components/DeleteConfirmDialog.vue';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import BatchEditUserModal from './components/BatchEditUserModal.vue';
|
||||
import BatchPermissionModal from './components/BatchPermissionModal.vue';
|
||||
import UserFormModal from './components/UserFormModal.vue';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/users/composables/useUsersAdmin.ts
|
||||
* 用户管理模块业务逻辑:CRUD、筛选、批量操作。
|
||||
*/
|
||||
@@ -14,8 +14,8 @@ import {
|
||||
listAdminDepartments,
|
||||
listAdminUsers,
|
||||
updateAdminUser,
|
||||
} from '@/api/admin';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
} from '@/features/admin/api/admin.api';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type { AdminAgentOption, AdminDepartmentRow, AdminUserRow } from '@/features/admin/types/admin.types';
|
||||
import {
|
||||
createEmptyUserFilters,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/wecom/WecomPage.vue
|
||||
* 企业微信管理独立页面。路由:/admin/wecom
|
||||
*/
|
||||
@@ -6,7 +6,7 @@
|
||||
import { onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { CircleHelp, Download, Link2, RefreshCw, Unlink2 } from 'lucide-vue-next';
|
||||
import DeleteConfirmDialog from '@/components/DeleteConfirmDialog.vue';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import { useWecomAdmin } from './composables/useWecomAdmin';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/modules/wecom/composables/useWecomAdmin.ts
|
||||
* 企业微信:绑定、系统配置、通知、登录审计。
|
||||
*/
|
||||
@@ -17,8 +17,8 @@ import {
|
||||
saveAdminWecomNotifySettings,
|
||||
saveAdminWecomSystemSettings,
|
||||
unbindAdminWecomUser,
|
||||
} from '@/api/admin';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
} from '@/features/admin/api/admin.api';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type { AdminUserRow } from '@/features/admin/types/admin.types';
|
||||
import {
|
||||
createDefaultWecomSystemSettings,
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
type WecomNotifySettings,
|
||||
type WecomSystemSettings,
|
||||
} from '@/features/admin/types/wecom.types';
|
||||
import { buildWecomAuditMeta, formatWecomAuditReason } from '@/utils/wecom';
|
||||
import { buildWecomAuditMeta, formatWecomAuditReason } from '@/shared/utils/wecom';
|
||||
|
||||
export function useWecomAdmin() {
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/stores/admin-nav.store.ts
|
||||
* 管理后台导航 UI 状态(侧栏折叠、报表展开、角标)。
|
||||
*
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
import { defineStore } from 'pinia';
|
||||
import { ref } from 'vue';
|
||||
import { getAdminDashboardBadges } from '@/api/admin';
|
||||
import { getAdminDashboardBadges } from '@/features/admin/api/admin.api';
|
||||
import type { AdminModuleId } from '../types/admin.types';
|
||||
|
||||
/** 角标缓存有效期(毫秒):此时间内 ensureBadges 直接复用内存中的计数 */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/views/AdminLayout.vue
|
||||
* 管理后台壳层:顶栏 + AdminNav + 子路由出口。
|
||||
* 角标仅在 Layout 首次挂载时 ensureBadges(store 内 60s TTL 缓存)。
|
||||
@@ -8,7 +8,7 @@ import { onMounted } from 'vue';
|
||||
import { ArrowLeft } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import AppHeaderTools from '@/layouts/AppHeaderTools.vue';
|
||||
import AppHeaderTools from '@/shared/layouts/AppHeaderTools.vue';
|
||||
import AdminNav from '../components/AdminNav.vue';
|
||||
import { useAdminNavStore } from '../stores/admin-nav.store';
|
||||
|
||||
|
||||
Reference in new issue
Block a user