feat(shipping-notice): 新增货代客户管理功能,支持客户导入、识别证据管理与客户确认
This commit is contained in:
1 parent
b595e157e9
commit
4fbaed2b4c
176 files changed
+14011
-994
No files matched your search
@@ -1,28 +1,34 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/workspace/components/WorkspaceSidebar.vue
|
||||
* 工作台左侧导航:子路由链接、返回聊天与退出登录。
|
||||
* 工作台左侧导航:业务一级/二级目录、返回聊天与退出登录。
|
||||
*/
|
||||
import { inject } from 'vue';
|
||||
import { computed, inject, ref, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import {
|
||||
LayoutGrid, Bot, FileText, User, LogOut, Edit, Megaphone, Clock, Package, PanelLeftClose, PanelLeftOpen,
|
||||
ChevronDown, ChevronRight, ContactRound, ListChecks,
|
||||
} from 'lucide-vue-next';
|
||||
import { WORKSPACE_PATHS } from '../constants/routes';
|
||||
import { WORKSPACE_KEY } from '../composables/workspace.context';
|
||||
|
||||
defineProps<{
|
||||
const props = defineProps<{
|
||||
collapsed?: boolean;
|
||||
}>();
|
||||
|
||||
const ws = inject(WORKSPACE_KEY)! as any;
|
||||
const route = useRoute();
|
||||
const shippingRouteNames = ['workspace-shipping-customers', 'workspace-shipping-tasks'] as const;
|
||||
const shippingExpanded = ref(false);
|
||||
const isAdmin = computed(() => String(ws.currentUser?.role || '').trim().toLowerCase() === 'admin');
|
||||
|
||||
const linkItems = [
|
||||
const primaryLinkItems = [
|
||||
{ path: WORKSPACE_PATHS.profile, labelKey: 'workspace.nav.profile', icon: User, match: ['workspace-profile'] },
|
||||
{ path: WORKSPACE_PATHS.applications, labelKey: 'workspace.nav.applications', icon: LayoutGrid, match: ['workspace-applications'] },
|
||||
{ path: WORKSPACE_PATHS.scheduleRuns, labelKey: 'workspace.nav.scheduleRuns', icon: Clock, match: ['workspace-schedule-runs'] },
|
||||
{ path: WORKSPACE_PATHS.shippingNotice, labelKey: 'workspace.nav.shippingNotice', icon: Package, match: ['workspace-shipping-notice'] },
|
||||
] as const;
|
||||
|
||||
const secondaryLinkItems = [
|
||||
{ path: WORKSPACE_PATHS.feedback, labelKey: 'workspace.nav.feedback', icon: Edit, match: ['workspace-feedback'] },
|
||||
{ path: WORKSPACE_PATHS.updates, labelKey: 'workspace.nav.updates', icon: Megaphone, match: ['workspace-updates'] },
|
||||
] as const;
|
||||
@@ -30,6 +36,26 @@ const linkItems = [
|
||||
function isActive(match: readonly string[]) {
|
||||
return match.includes(String(route.name || ''));
|
||||
}
|
||||
|
||||
/** 当前路由进入货代子页面时自动展开一级菜单,保证激活项可见。 */
|
||||
watch(
|
||||
() => route.name,
|
||||
(routeName) => {
|
||||
if (shippingRouteNames.includes(String(routeName || '') as typeof shippingRouteNames[number])) {
|
||||
shippingExpanded.value = true;
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
/** 展开或收起货代发货目录;侧栏折叠时图标直接进入发货任务。 */
|
||||
const toggleShippingMenu = (): void => {
|
||||
if (props.collapsed) {
|
||||
void ws.router.push(WORKSPACE_PATHS.shippingNoticeTasks);
|
||||
return;
|
||||
}
|
||||
shippingExpanded.value = !shippingExpanded.value;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -75,7 +101,56 @@ function isActive(match: readonly string[]) {
|
||||
<div class="flex-1 py-4">
|
||||
<nav class="space-y-2">
|
||||
<RouterLink
|
||||
v-for="item in linkItems"
|
||||
v-for="item in primaryLinkItems"
|
||||
:key="item.path"
|
||||
:to="item.path"
|
||||
class="ws-nav-btn"
|
||||
:class="[
|
||||
{ 'ws-nav-btn--active': isActive(item.match) },
|
||||
collapsed ? 'justify-center px-0' : '',
|
||||
]"
|
||||
:title="$t(item.labelKey)"
|
||||
>
|
||||
<component :is="item.icon" class="h-[18px] w-[18px]" />
|
||||
<span v-if="!collapsed">{{ $t(item.labelKey) }}</span>
|
||||
</RouterLink>
|
||||
<div>
|
||||
<button
|
||||
type="button"
|
||||
class="ws-nav-btn w-full"
|
||||
:class="[
|
||||
{ 'ws-nav-btn--active': isActive(shippingRouteNames) },
|
||||
collapsed ? 'justify-center px-0' : '',
|
||||
]"
|
||||
:title="$t('workspace.nav.shippingNotice')"
|
||||
@click="toggleShippingMenu"
|
||||
>
|
||||
<Package class="h-[18px] w-[18px]" />
|
||||
<span v-if="!collapsed" class="flex-1">{{ $t('workspace.nav.shippingNotice') }}</span>
|
||||
<component v-if="!collapsed" :is="shippingExpanded ? ChevronDown : ChevronRight" class="h-4 w-4" />
|
||||
</button>
|
||||
<div v-if="!collapsed && shippingExpanded" class="mt-1 space-y-1 pl-5">
|
||||
<RouterLink
|
||||
v-if="isAdmin"
|
||||
:to="WORKSPACE_PATHS.shippingNoticeCustomers"
|
||||
class="ws-nav-btn py-2.5 text-[13px]"
|
||||
:class="{ 'ws-nav-btn--active': isActive(['workspace-shipping-customers']) }"
|
||||
>
|
||||
<ContactRound class="h-4 w-4" />
|
||||
<span>{{ $t('workspace.nav.shippingCustomers') }}</span>
|
||||
</RouterLink>
|
||||
<RouterLink
|
||||
:to="WORKSPACE_PATHS.shippingNoticeTasks"
|
||||
class="ws-nav-btn py-2.5 text-[13px]"
|
||||
:class="{ 'ws-nav-btn--active': isActive(['workspace-shipping-tasks']) }"
|
||||
>
|
||||
<ListChecks class="h-4 w-4" />
|
||||
<span>{{ $t('workspace.nav.shippingTasks') }}</span>
|
||||
</RouterLink>
|
||||
</div>
|
||||
</div>
|
||||
<RouterLink
|
||||
v-for="item in secondaryLinkItems"
|
||||
:key="item.path"
|
||||
:to="item.path"
|
||||
class="ws-nav-btn"
|
||||
|
||||
@@ -19,7 +19,8 @@ const ROUTE_NAME_TO_SIDEBAR: Record<string, WorkspaceSidebarItem> = {
|
||||
'workspace-knowledge-base': 'knowledge_base',
|
||||
'workspace-knowledge-base-group': 'knowledge_base',
|
||||
'workspace-schedule-runs': 'schedule_runs',
|
||||
'workspace-shipping-notice': 'shipping_notice',
|
||||
'workspace-shipping-customers': 'shipping_notice',
|
||||
'workspace-shipping-tasks': 'shipping_notice',
|
||||
'workspace-feedback': 'feedback',
|
||||
'workspace-history': 'history',
|
||||
};
|
||||
|
||||
@@ -9,7 +9,9 @@ export const WORKSPACE_PATHS = {
|
||||
updates: '/workspace/updates',
|
||||
knowledgeBase: '/workspace/knowledge-base',
|
||||
scheduleRuns: '/workspace/schedule-runs',
|
||||
shippingNotice: '/workspace/shipping-notice',
|
||||
shippingNotice: '/workspace/shipping-notice/tasks',
|
||||
shippingNoticeCustomers: '/workspace/shipping-notice/customers',
|
||||
shippingNoticeTasks: '/workspace/shipping-notice/tasks',
|
||||
feedback: '/workspace/feedback',
|
||||
history: '/workspace/history',
|
||||
} as const;
|
||||
|
||||
Reference in new issue
Block a user