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
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user