feat(shipping, admin, workspace, docs): 迭代货代模块、补充文档并处理合并冲突问题
This commit is contained in:
1 parent
4587b56900
commit
3c0e08377c
94 files changed
+29222
-1218
No files matched your search
@@ -9,6 +9,7 @@ import { requestJson } from '@/shared/api/client';
|
||||
import type { AdminUserRow } from '../types/admin.types';
|
||||
import type { AdminDashboardBadges, AdminDashboardSummary } from '../types/dashboard.types';
|
||||
import type { PaginatedResult } from '@/shared/types/pagination.types';
|
||||
import type { AdminLinkedServiceRow } from '../types/linked-service.types';
|
||||
import type {
|
||||
ApplicationReport,
|
||||
ApplicationSortKey,
|
||||
@@ -21,24 +22,6 @@ import type {
|
||||
const auth = () => ({ headers: getAuthHeaders() });
|
||||
const jsonAuth = () => ({ headers: { 'Content-Type': 'application/json', ...getAuthHeaders() } });
|
||||
|
||||
export type LinkedServicePayload = {
|
||||
name: string;
|
||||
url: string;
|
||||
description?: string;
|
||||
icon?: string;
|
||||
sort_order?: number;
|
||||
enabled?: boolean;
|
||||
is_enabled?: boolean;
|
||||
};
|
||||
|
||||
export const listLinkedServices = () => requestJson<any[]>('/api/admin/linked-services', auth());
|
||||
export const createLinkedService = (payload: LinkedServicePayload) =>
|
||||
requestJson<any>('/api/admin/linked-services', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const updateLinkedService = (id: number, payload: LinkedServicePayload) =>
|
||||
requestJson<any>(`/api/admin/linked-services/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const deleteLinkedService = (id: number) =>
|
||||
requestJson<void>(`/api/admin/linked-services/${id}`, { method: 'DELETE', ...auth() });
|
||||
|
||||
export type ShippingInventoryReadinessCheck = {
|
||||
code: string;
|
||||
status: 'passed' | 'pending' | 'failed' | 'stale' | 'empty';
|
||||
@@ -791,6 +774,16 @@ export const updateAnnouncement = (id: number, payload: Record<string, unknown>)
|
||||
export const deleteAnnouncement = (id: number) =>
|
||||
requestJson(`/api/admin/announcements/${id}`, { method: 'DELETE', ...auth() });
|
||||
|
||||
// Linked services(关联服务:侧栏跳转入口)
|
||||
export const listLinkedServices = () =>
|
||||
requestJson<AdminLinkedServiceRow[]>('/api/admin/linked-services', auth());
|
||||
export const createLinkedService = (payload: Record<string, unknown>) =>
|
||||
requestJson('/api/admin/linked-services', { method: 'POST', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const updateLinkedService = (id: number, payload: Record<string, unknown>) =>
|
||||
requestJson(`/api/admin/linked-services/${id}`, { method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload) });
|
||||
export const deleteLinkedService = (id: number) =>
|
||||
requestJson(`/api/admin/linked-services/${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>) =>
|
||||
|
||||
@@ -5,17 +5,21 @@
|
||||
* 逻辑:报表/企微子菜单默认折叠;当前路由落在对应模块时自动展开以便看到激活项。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, watch } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import {
|
||||
LayoutDashboard, UserPlus, UserCog, Building, Bot, FileText,
|
||||
Settings2, Megaphone, MessageCircleQuestion, Link2, Users, ShieldCheck, BarChart2, AppWindow,
|
||||
ScrollText, ExternalLink,
|
||||
ScrollText, ExternalLink, PackageSearch,
|
||||
} from 'lucide-vue-next';
|
||||
import type { Component } from 'vue';
|
||||
import { config } from '@/config';
|
||||
import { ADMIN_MODULE_METAS, ADMIN_REPORT_TABLES } from '../constants/modules';
|
||||
import {
|
||||
ADMIN_MODULE_METAS,
|
||||
ADMIN_REPORT_TABLES,
|
||||
SHIPPING_CONFIG_SUB_MODULE_METAS,
|
||||
} from '../constants/modules';
|
||||
import { useAdminNavStore } from '../stores/admin-nav.store';
|
||||
import type { AdminModuleId } from '../types/admin.types';
|
||||
|
||||
@@ -41,6 +45,7 @@ const iconMap: Record<AdminModuleId, Component> = {
|
||||
procurement_contract: ScrollText,
|
||||
requests: ShieldCheck,
|
||||
reports: BarChart2,
|
||||
shipping_inventory: PackageSearch,
|
||||
};
|
||||
|
||||
const visibleModules = computed(() =>
|
||||
@@ -48,7 +53,7 @@ const visibleModules = computed(() =>
|
||||
);
|
||||
|
||||
const standardModules = computed(() =>
|
||||
visibleModules.value.filter((item) => item.id !== 'wecom'),
|
||||
visibleModules.value.filter((item) => item.id !== 'wecom' && item.id !== 'shipping_inventory'),
|
||||
);
|
||||
|
||||
const isModuleActive = (moduleId: AdminModuleId): boolean =>
|
||||
@@ -56,6 +61,24 @@ const isModuleActive = (moduleId: AdminModuleId): boolean =>
|
||||
|
||||
const isReportsActive = computed(() => route.meta.adminModule === 'reports');
|
||||
const isWecomActive = computed(() => route.meta.adminModule === 'wecom');
|
||||
const isShippingActive = computed(() => route.meta.adminModule === 'shipping_inventory');
|
||||
|
||||
const shippingGroups = computed(() => [...new Set(SHIPPING_CONFIG_SUB_MODULE_METAS.map((item) => item.groupKey))]);
|
||||
const shippingExpanded = ref<Record<string, boolean>>({});
|
||||
|
||||
const isShippingSubActive = (sub: (typeof SHIPPING_CONFIG_SUB_MODULE_METAS)[number]): boolean => {
|
||||
if (route.name !== sub.routeName) return false;
|
||||
if (!sub.query) return true;
|
||||
return route.query.section === sub.query.section;
|
||||
};
|
||||
|
||||
const toggleShippingGroup = (groupKey: string): void => {
|
||||
shippingExpanded.value[groupKey] = !shippingExpanded.value[groupKey];
|
||||
};
|
||||
|
||||
const navigateShipping = (sub: (typeof SHIPPING_CONFIG_SUB_MODULE_METAS)[number]): void => {
|
||||
router.push({ name: sub.routeName, query: sub.query });
|
||||
};
|
||||
|
||||
const wecomSubRoutes = [
|
||||
{ name: 'AdminWecomSettings', labelKey: 'admin.wecom.nav.settings' },
|
||||
@@ -100,6 +123,23 @@ watch(
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
watch(
|
||||
isShippingActive,
|
||||
(active) => {
|
||||
if (!active) return;
|
||||
let matched = false;
|
||||
for (const groupKey of shippingGroups.value) {
|
||||
const groupHasActiveSub = SHIPPING_CONFIG_SUB_MODULE_METAS.some(
|
||||
(item) => item.groupKey === groupKey && isShippingSubActive(item),
|
||||
);
|
||||
shippingExpanded.value[groupKey] = groupHasActiveSub;
|
||||
matched = matched || groupHasActiveSub;
|
||||
}
|
||||
if (!matched && shippingGroups.value[0]) shippingExpanded.value[shippingGroups.value[0]] = true;
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -164,6 +204,43 @@ watch(
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="config.admin.modules.shipping_inventory !== false" class="flex flex-col flex-shrink-0">
|
||||
<button
|
||||
type="button"
|
||||
class="admin-nav-btn group justify-between"
|
||||
:class="{ 'admin-nav-btn--active': isShippingActive }"
|
||||
@click="navigateModule('AdminShippingInventory')"
|
||||
>
|
||||
<div class="flex items-center gap-3">
|
||||
<PackageSearch class="w-5 h-5 flex-shrink-0" :class="isShippingActive ? 'text-brand-600' : 'text-muted'" />
|
||||
<span :class="navStore.sidebarCollapsed ? 'md:hidden' : ''">{{ t('admin.nav.shippingConfig') }}</span>
|
||||
</div>
|
||||
</button>
|
||||
<div v-if="isShippingActive && !navStore.sidebarCollapsed" class="pl-4 space-y-1 mt-1 border-l-2 border-subtle ml-6">
|
||||
<div v-for="groupKey in shippingGroups" :key="groupKey" class="flex flex-col">
|
||||
<button
|
||||
type="button"
|
||||
class="admin-nav-subitem text-left font-medium"
|
||||
@click="toggleShippingGroup(groupKey)"
|
||||
>
|
||||
{{ t(groupKey) }}
|
||||
</button>
|
||||
<div v-if="shippingExpanded[groupKey]" class="pl-3 space-y-1">
|
||||
<button
|
||||
v-for="sub in SHIPPING_CONFIG_SUB_MODULE_METAS.filter((item) => item.groupKey === groupKey)"
|
||||
:key="sub.id"
|
||||
type="button"
|
||||
class="admin-nav-subitem text-left"
|
||||
:class="{ 'admin-nav-subitem--active': isShippingSubActive(sub) }"
|
||||
@click="navigateShipping(sub)"
|
||||
>
|
||||
{{ t(sub.labelKey) }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="config.admin.modules.reports !== false" class="flex flex-col flex-shrink-0">
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* 管理后台模块元数据,AdminNav 与子路由共用。
|
||||
*/
|
||||
|
||||
import type { AdminModuleId, AdminReportTableId } from '../types/admin.types';
|
||||
import type { AdminModuleId, AdminReportTableId, ShippingConfigSubModuleId } from '../types/admin.types';
|
||||
|
||||
export interface AdminModuleMeta {
|
||||
id: AdminModuleId;
|
||||
@@ -13,9 +13,36 @@ export interface AdminModuleMeta {
|
||||
configKey: keyof typeof import('@/config').config.admin.modules;
|
||||
}
|
||||
|
||||
export interface ShippingConfigSubModuleMeta {
|
||||
id: ShippingConfigSubModuleId;
|
||||
routeName:
|
||||
| 'AdminShippingInventory'
|
||||
| 'AdminShippingFieldAssets'
|
||||
| 'AdminShippingOrderSchema'
|
||||
| 'AdminShippingIdentityRules'
|
||||
| 'AdminShippingOrderExtractionRuns'
|
||||
| 'AdminShippingAudit'
|
||||
| 'AdminShippingProcessGates'
|
||||
| 'AdminShippingLegacyStpJobs'
|
||||
| 'AdminShippingOrderDocumentProfiles';
|
||||
path:
|
||||
| 'shipping-notice'
|
||||
| 'shipping-field-assets'
|
||||
| 'shipping-order-schema'
|
||||
| 'shipping-identity-rules'
|
||||
| 'shipping-order-extraction-runs'
|
||||
| 'shipping-audit'
|
||||
| 'shipping-process-gates'
|
||||
| 'shipping-legacy-stp-jobs'
|
||||
| 'shipping-order-document-profiles';
|
||||
labelKey: string;
|
||||
groupKey: 'admin.nav.shippingOrderRecognition' | 'admin.nav.shippingInventoryManagement' | 'admin.nav.shippingRunAudit';
|
||||
query?: { section: 'parsing' | 'profiles' | 'sources' | 'mappings' | 'rules' | 'templates' | 'snapshots' | 'exports' };
|
||||
}
|
||||
|
||||
/** 已独立拆分的模块(全部 admin 模块均已拆分) */
|
||||
export const STANDALONE_ADMIN_MODULES = new Set<AdminModuleId>([
|
||||
'dashboard', 'agents', 'users', 'departments', 'approvals', 'announcements', 'questions', 'requests', 'permissions', 'schedules', 'knowledge_base', 'wecom', 'linked_services', 'platform_apps', 'procurement_contract', 'reports',
|
||||
'dashboard', 'agents', 'users', 'departments', 'approvals', 'announcements', 'questions', 'requests', 'permissions', 'schedules', 'knowledge_base', 'wecom', 'linked_services', 'platform_apps', 'shipping_inventory', 'procurement_contract', 'reports',
|
||||
]);
|
||||
|
||||
export const ADMIN_MODULE_METAS: AdminModuleMeta[] = [
|
||||
@@ -26,6 +53,7 @@ export const ADMIN_MODULE_METAS: AdminModuleMeta[] = [
|
||||
{ id: 'agents', routeName: 'AdminAgents', path: 'agents', labelKey: 'admin.nav.agents', configKey: 'agents' },
|
||||
{ id: 'knowledge_base', routeName: 'AdminKnowledgeBase', path: 'knowledge-base', labelKey: 'admin.nav.knowledgeBase', configKey: 'knowledge_base' },
|
||||
{ id: 'schedules', routeName: 'AdminSchedules', path: 'schedules', labelKey: 'admin.nav.schedules', configKey: 'schedules' },
|
||||
{ id: 'shipping_inventory', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.nav.shippingConfig', configKey: 'shipping_inventory' },
|
||||
{ id: 'announcements', routeName: 'AdminAnnouncements', path: 'announcements', labelKey: 'admin.nav.announcements', configKey: 'announcements' },
|
||||
{ id: 'questions', routeName: 'AdminQuestions', path: 'questions', labelKey: 'admin.nav.questions', configKey: 'questions' },
|
||||
{ id: 'wecom', routeName: 'AdminWecom', path: 'wecom', labelKey: 'admin.nav.wecom', configKey: 'wecom' },
|
||||
@@ -36,6 +64,25 @@ export const ADMIN_MODULE_METAS: AdminModuleMeta[] = [
|
||||
{ id: 'requests', routeName: 'AdminRequests', path: 'requests', labelKey: 'admin.nav.requests', configKey: 'requests' },
|
||||
];
|
||||
|
||||
/** 货代管理的业务导航唯一真相源;按基础定义、适配规则、运行任务的依赖顺序排列。 */
|
||||
export const SHIPPING_CONFIG_SUB_MODULE_METAS: ShippingConfigSubModuleMeta[] = [
|
||||
{ id: 'field_assets', routeName: 'AdminShippingFieldAssets', path: 'shipping-field-assets', labelKey: 'admin.nav.shippingFieldAssets', groupKey: 'admin.nav.shippingOrderRecognition' },
|
||||
{ id: 'order_schema', routeName: 'AdminShippingOrderSchema', path: 'shipping-order-schema', labelKey: 'admin.nav.shippingOrderSchema', groupKey: 'admin.nav.shippingOrderRecognition' },
|
||||
{ id: 'order_document_profiles', routeName: 'AdminShippingOrderDocumentProfiles', path: 'shipping-order-document-profiles', labelKey: 'admin.nav.shippingOrderDocumentProfiles', groupKey: 'admin.nav.shippingOrderRecognition' },
|
||||
{ id: 'identity_rules', routeName: 'AdminShippingIdentityRules', path: 'shipping-identity-rules', labelKey: 'admin.nav.shippingIdentityRules', groupKey: 'admin.nav.shippingOrderRecognition' },
|
||||
{ id: 'order_extraction_runs', routeName: 'AdminShippingOrderExtractionRuns', path: 'shipping-order-extraction-runs', labelKey: 'admin.nav.shippingOrderExtractionRuns', groupKey: 'admin.nav.shippingOrderRecognition' },
|
||||
{ id: 'inventory_fields', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.parsingProfiles', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'parsing' } },
|
||||
{ id: 'connections', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.connections', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'profiles' } },
|
||||
{ id: 'inventory_sites', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.sources', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'sources' } },
|
||||
{ id: 'warehouse_mappings', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.externalMappings', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'mappings' } },
|
||||
{ id: 'routing_rules', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.rules', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'rules' } },
|
||||
{ id: 'shipping_templates', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.excelTemplates', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'templates' } },
|
||||
{ id: 'shipping_audit', routeName: 'AdminShippingAudit', path: 'shipping-audit', labelKey: 'admin.nav.shippingAudit', groupKey: 'admin.nav.shippingRunAudit' },
|
||||
{ id: 'process_gates', routeName: 'AdminShippingProcessGates', path: 'shipping-process-gates', labelKey: 'admin.nav.shippingProcessGates', groupKey: 'admin.nav.shippingRunAudit' },
|
||||
{ id: 'inventory_snapshots', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.snapshots', groupKey: 'admin.nav.shippingRunAudit', query: { section: 'snapshots' } },
|
||||
{ id: 'export_records', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.exports', groupKey: 'admin.nav.shippingRunAudit', query: { section: 'exports' } },
|
||||
];
|
||||
|
||||
export const ADMIN_REPORT_TABLES: AdminReportTableId[] = [
|
||||
'usage_analysis',
|
||||
'chat_logs',
|
||||
|
||||
@@ -207,6 +207,7 @@ watch(
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
watch(
|
||||
() => props.form.is_aggregate,
|
||||
(enabled) => {
|
||||
@@ -301,7 +302,6 @@ const handleTrainingQuestionTypeChange = (form: AgentFormState, index: number) =
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<template v-if="showDifyFields">
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-bold text-muted uppercase tracking-wider">{{ t('admin.agent.fields.difyAppType') }}</label>
|
||||
|
||||
@@ -9,6 +9,7 @@ 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 '@/features/admin/api/admin.api';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -34,6 +35,8 @@ const form = ref({
|
||||
|
||||
const isUploading = ref(false);
|
||||
const uploadError = ref('');
|
||||
const deleteDialogOpen = ref(false);
|
||||
const pendingDeleteGuideId = ref<number | null>(null);
|
||||
|
||||
/**
|
||||
* 拉取 Agent 列表并默认选中第一项,再加载其指南。
|
||||
@@ -169,17 +172,26 @@ const submitForm = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const deleteGuide = (id: number) => {
|
||||
pendingDeleteGuideId.value = id;
|
||||
deleteDialogOpen.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 确认后删除指南。
|
||||
* @param id - 指南主键
|
||||
* 确认后删除指南(由 DeleteConfirmDialog 的 @confirm 触发)。
|
||||
* @param id - 指南主键,取自 pendingDeleteGuideId
|
||||
*/
|
||||
const deleteGuide = async (id: number) => {
|
||||
if (!confirm(t('admin.platformApps.confirmDelete'))) return;
|
||||
const confirmDeleteGuide = async () => {
|
||||
const id = pendingDeleteGuideId.value;
|
||||
if (!id) return;
|
||||
try {
|
||||
await deleteAdminAgentGuide(id);
|
||||
await fetchGuides();
|
||||
} catch (error) {
|
||||
console.error('Failed to delete guide:', error);
|
||||
} finally {
|
||||
pendingDeleteGuideId.value = null;
|
||||
deleteDialogOpen.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -391,5 +403,6 @@ const getIcon = (type: string) => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<DeleteConfirmDialog v-model="deleteDialogOpen" title="{{ t('admin.platformApps.deleteGuide') }}" message="{{ t('admin.platformApps.confirmDelete') }}" confirm-tone="danger" @confirm="confirmDeleteGuide" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -18,9 +18,29 @@ export type AdminModuleId =
|
||||
| 'permissions'
|
||||
| 'requests'
|
||||
| 'platform_apps'
|
||||
| 'shipping_inventory'
|
||||
| 'procurement_contract'
|
||||
| 'reports';
|
||||
|
||||
/** 货代管理领域下可由侧栏展示和高亮的稳定业务页面。 */
|
||||
export type ShippingConfigSubModuleId =
|
||||
| 'field_assets'
|
||||
| 'order_schema'
|
||||
| 'order_document_profiles'
|
||||
| 'identity_rules'
|
||||
| 'order_extraction_runs'
|
||||
| 'shipping_audit'
|
||||
| 'process_gates'
|
||||
| 'legacy_stp_jobs'
|
||||
| 'inventory_fields'
|
||||
| 'connections'
|
||||
| 'inventory_sites'
|
||||
| 'warehouse_mappings'
|
||||
| 'routing_rules'
|
||||
| 'shipping_templates'
|
||||
| 'inventory_snapshots'
|
||||
| 'export_records';
|
||||
|
||||
export type AdminReportTableId =
|
||||
| 'usage_analysis'
|
||||
| 'users'
|
||||
|
||||
Reference in new issue
Block a user