fix(admin): 删除用户审批功能并更新图标
This commit is contained in:
1 parent
55c6467d83
commit
07e83132c0
11 files changed
+141
-153
No files matched your search
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
/**
|
||||
* app/router/routes/admin.routes.ts
|
||||
* 管理后台嵌套路由;全部 admin 模块已独立拆分。
|
||||
* 依赖:vue-router;meta.title 存 i18n key(如 admin.nav.*),由 guards 解析为 document.title。
|
||||
* 逻辑:AdminLayout 嵌套各管理页;企微为三级子路由。
|
||||
* 绠$悊鍚庡彴宓屽璺敱锛涘叏閮?admin 妯″潡宸茬嫭绔嬫媶鍒嗐€?
|
||||
* 渚濊禆锛歷ue-router锛沵eta.title 瀛?i18n key锛堝 admin.nav.*锛夛紝鐢?guards 瑙f瀽涓?document.title銆?
|
||||
* 閫昏緫锛欰dminLayout 宓屽鍚勭鐞嗛〉锛涗紒寰负涓夌骇瀛愯矾鐢便€?
|
||||
*/
|
||||
|
||||
import type { RouteRecordRaw } from "vue-router";
|
||||
@@ -17,9 +17,6 @@ const UsersPage = () => import("@/features/admin/modules/users/UsersPage.vue");
|
||||
const DepartmentsPage = () =>
|
||||
import("@/features/admin/modules/departments/DepartmentsPage.vue");
|
||||
|
||||
const ApprovalsPage = () =>
|
||||
import("@/features/admin/modules/approvals/ApprovalsPage.vue");
|
||||
|
||||
const AnnouncementsPage = () =>
|
||||
import("@/features/admin/modules/announcements/AnnouncementsPage.vue");
|
||||
|
||||
@@ -116,17 +113,7 @@ export const adminRoutes: RouteRecordRaw[] = [
|
||||
component: WecomAuditsPage,
|
||||
meta: { requiresAdmin: true, adminModule: "wecom", title: "admin.wecom.nav.auditsPage" },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "approvals",
|
||||
name: "AdminApprovals",
|
||||
component: ApprovalsPage,
|
||||
meta: {
|
||||
requiresAdmin: true,
|
||||
adminModule: "approvals",
|
||||
title: "admin.nav.approvals",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "agents",
|
||||
@@ -233,3 +220,7 @@ export const adminRoutes: RouteRecordRaw[] = [
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
+28
-26
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
/**
|
||||
* config.ts
|
||||
* 用途:前端应用级开关与默认配置(登录模式、工作台模块、管理模块可见性)。
|
||||
* 依赖:无运行时依赖;应用标题通过 common.app.title i18n key 解析。
|
||||
* 逻辑:main.ts / router guards 使用 i18n.t(config.appTitleKey) 设置 document.title。
|
||||
* 鐢ㄩ€旓細鍓嶇搴旂敤绾у紑鍏充笌榛樿閰嶇疆锛堢櫥褰曟ā寮忋€佸伐浣滃彴妯″潡銆佺鐞嗘ā鍧楀彲瑙佹€э級銆?
|
||||
* 渚濊禆锛氭棤杩愯鏃朵緷璧栵紱搴旂敤鏍囬閫氳繃 common.app.title i18n key 瑙f瀽銆?
|
||||
* 閫昏緫锛歮ain.ts / router guards 浣跨敤 i18n.t(config.appTitleKey) 璁剧疆 document.title銆?
|
||||
*/
|
||||
export const config = {
|
||||
/** Browser title base name — resolve via i18n `t(config.appTitleKey)`. */
|
||||
/** Browser title base name 鈥?resolve via i18n `t(config.appTitleKey)`. */
|
||||
appTitleKey: 'common.app.title',
|
||||
auth: {
|
||||
// Login mode switch:
|
||||
@@ -19,7 +19,7 @@ export const config = {
|
||||
passwordLoginApi: '/api/user/casdoor/password-login',
|
||||
refreshApi: '/api/user/casdoor/refresh',
|
||||
callbackPath: '/casdoor-callback',
|
||||
// Casdoor Provider「Name」字段须一致(当前 IdP:wecom)。留空则仅用后端 CASDOOR_WECOM_PROVIDER_HINT。
|
||||
// Casdoor Provider銆孨ame銆嶅瓧娈甸』涓€鑷达紙褰撳墠 IdP锛歸ecom锛夈€傜暀绌哄垯浠呯敤鍚庣 CASDOOR_WECOM_PROVIDER_HINT銆?
|
||||
wecomProviderHint: 'wecom',
|
||||
},
|
||||
wecom: {
|
||||
@@ -35,15 +35,15 @@ export const config = {
|
||||
}
|
||||
},
|
||||
workspace: {
|
||||
// true 显示评分区;false 隐藏评分区
|
||||
// true 鏄剧ず璇勫垎鍖猴紱false 闅愯棌璇勫垎鍖?
|
||||
showChatRating: true,
|
||||
// 聊天窗口“源文件展示”开关配置
|
||||
// 鑱婂ぉ绐楀彛鈥滄簮鏂囦欢灞曠ず鈥濆紑鍏抽厤缃?
|
||||
sourceFiles: {
|
||||
// 是否显示源文件区域(包含上方文件按钮 + 下方“源文档”详情)
|
||||
// 鏄惁鏄剧ず婧愭枃浠跺尯鍩燂紙鍖呭惈涓婃柟鏂囦欢鎸夐挳 + 涓嬫柟鈥滄簮鏂囨。鈥濊鎯咃級
|
||||
showSourceFiles: true,
|
||||
// 是否显示 MD 源文件(文件名后缀为 .md/.markdown)
|
||||
// 鏄惁鏄剧ず MD 婧愭枃浠讹紙鏂囦欢鍚嶅悗缂€涓?.md/.markdown锛?
|
||||
showMdFiles: false,
|
||||
// 当 showMdFiles=true 时,MD 源文件是否默认展开“源文档”详情
|
||||
// 褰?showMdFiles=true 鏃讹紝MD 婧愭枃浠舵槸鍚﹂粯璁ゅ睍寮€鈥滄簮鏂囨。鈥濊鎯?
|
||||
expandMdByDefault: false,
|
||||
},
|
||||
modules: {
|
||||
@@ -57,21 +57,23 @@ export const config = {
|
||||
admin: {
|
||||
modules: {
|
||||
dashboard: true, // 仪表盘
|
||||
approvals: true, // 用户审批
|
||||
users: true, // 用户管理
|
||||
departments: true, // 部门管理
|
||||
agents: true, // 应用管理
|
||||
knowledge_base: true, // 知识库管理
|
||||
announcements: true, // 公告管理
|
||||
questions: true, // 常用问题
|
||||
wecom: true, // 企业微信
|
||||
linked_services: true, // 关联服务(侧栏跳转入口)
|
||||
permissions: true, // 应用权限
|
||||
platform_apps: true, // 平台应用说明
|
||||
requests: true, // 审批权限
|
||||
reports: true, // 数据报表
|
||||
schedules: true, // 定时任务
|
||||
procurement_contract: true, // 采购合同审查(模板库 + 历史)
|
||||
users: true, // 鐢ㄦ埛绠$悊
|
||||
departments: true, // 閮ㄩ棬绠$悊
|
||||
agents: true, // 搴旂敤绠$悊
|
||||
knowledge_base: true, // 鐭ヨ瘑搴撶鐞?
|
||||
announcements: true, // 鍏憡绠$悊
|
||||
questions: true, // 甯哥敤闂
|
||||
wecom: true, // 浼佷笟寰俊
|
||||
linked_services: true, // 鍏宠仈鏈嶅姟锛堜晶鏍忚烦杞叆鍙o級
|
||||
permissions: true, // 搴旂敤鏉冮檺
|
||||
platform_apps: true, // 骞冲彴搴旂敤璇存槑
|
||||
requests: true, // 瀹℃壒鏉冮檺
|
||||
reports: true, // 鏁版嵁鎶ヨ〃
|
||||
schedules: true, // 瀹氭椂浠诲姟
|
||||
procurement_contract: true, // 閲囪喘鍚堝悓瀹℃煡锛堟ā鏉垮簱 + 鍘嗗彶锛?
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/components/AdminNav.vue
|
||||
* 管理后台左侧导航,使用子路由跳转。
|
||||
* 依赖:admin-nav.store、modules 常量、vue-router。
|
||||
* 逻辑:报表/企微子菜单默认折叠;当前路由落在对应模块时自动展开以便看到激活项。
|
||||
* 绠$悊鍚庡彴宸︿晶瀵艰埅锛屼娇鐢ㄥ瓙璺敱璺宠浆銆?
|
||||
* 渚濊禆锛歛dmin-nav.store銆乵odules 甯搁噺銆乿ue-router銆?
|
||||
* 閫昏緫锛氭姤琛?浼佸井瀛愯彍鍗曢粯璁ゆ姌鍙狅紱褰撳墠璺敱钀藉湪瀵瑰簲妯″潡鏃惰嚜鍔ㄥ睍寮€浠ヤ究鐪嬪埌婵€娲婚」銆?
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import {
|
||||
LayoutDashboard, UserPlus, UserCog, Building, Bot, FileText,
|
||||
import { LayoutDashboard, UserCog, Building, Bot, FileText,
|
||||
Settings2, Megaphone, MessageCircleQuestion, Link2, Users, ShieldCheck, BarChart2, AppWindow,
|
||||
ScrollText, ExternalLink,
|
||||
} from 'lucide-vue-next';
|
||||
@@ -26,7 +25,6 @@ const navStore = useAdminNavStore();
|
||||
|
||||
const iconMap: Record<AdminModuleId, Component> = {
|
||||
dashboard: LayoutDashboard,
|
||||
approvals: UserPlus,
|
||||
users: UserCog,
|
||||
departments: Building,
|
||||
agents: Bot,
|
||||
@@ -83,7 +81,7 @@ const navigateReport = (table: string): void => {
|
||||
};
|
||||
|
||||
/**
|
||||
* 进入报表/企微模块时自动展开子菜单,避免当前页在折叠状态下不可见。
|
||||
* 杩涘叆鎶ヨ〃/浼佸井妯″潡鏃惰嚜鍔ㄥ睍寮€瀛愯彍鍗曪紝閬垮厤褰撳墠椤靛湪鎶樺彔鐘舵€佷笅涓嶅彲瑙併€?
|
||||
*/
|
||||
watch(
|
||||
isReportsActive,
|
||||
@@ -195,3 +193,4 @@ watch(
|
||||
</nav>
|
||||
</aside>
|
||||
</template>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/constants/modules.ts
|
||||
* 管理后台模块元数据,AdminNav 与子路由共用。
|
||||
* 绠$悊鍚庡彴妯″潡鍏冩暟鎹紝AdminNav 涓庡瓙璺敱鍏辩敤銆?
|
||||
*/
|
||||
|
||||
import type { AdminModuleId, AdminReportTableId } from '../types/admin.types';
|
||||
@@ -13,14 +13,13 @@ export interface AdminModuleMeta {
|
||||
configKey: keyof typeof import('@/config').config.admin.modules;
|
||||
}
|
||||
|
||||
/** 已独立拆分的模块(全部 admin 模块均已拆分) */
|
||||
/** 宸茬嫭绔嬫媶鍒嗙殑妯″潡锛堝叏閮?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', 'announcements', 'questions', 'requests', 'permissions', 'schedules', 'knowledge_base', 'wecom', 'linked_services', 'platform_apps', 'procurement_contract', 'reports',
|
||||
]);
|
||||
|
||||
export const ADMIN_MODULE_METAS: AdminModuleMeta[] = [
|
||||
{ id: 'dashboard', routeName: 'AdminDashboard', path: 'dashboard', labelKey: 'admin.nav.dashboard', configKey: 'dashboard' },
|
||||
{ id: 'approvals', routeName: 'AdminApprovals', path: 'approvals', labelKey: 'admin.nav.approvals', configKey: 'approvals' },
|
||||
{ id: 'users', routeName: 'AdminUsers', path: 'users', labelKey: 'admin.nav.users', configKey: 'users' },
|
||||
{ id: 'departments', routeName: 'AdminDepartments', path: 'departments', labelKey: 'admin.nav.departments', configKey: 'departments' },
|
||||
{ id: 'agents', routeName: 'AdminAgents', path: 'agents', labelKey: 'admin.nav.agents', configKey: 'agents' },
|
||||
@@ -53,3 +52,4 @@ export const adminModulePath = (moduleId: AdminModuleId | string): string => {
|
||||
if (meta) return `/admin/${meta.path}`;
|
||||
return `/admin/${LEGACY_MODULE_QUERY_TO_PATH[moduleId] || moduleId}`;
|
||||
};
|
||||
|
||||
@@ -21,7 +21,6 @@ export const useAdminNavStore = defineStore('adminNav', () => {
|
||||
/** 企业微信子菜单:默认折叠 */
|
||||
const wecomExpanded = ref(false);
|
||||
/** 「用户审批」导航角标:pending 注册用户数 */
|
||||
const pendingApprovalsCount = ref(0);
|
||||
/** 「权限申请」导航角标:pending 权限申请数 */
|
||||
const pendingRequestsCount = ref(0);
|
||||
|
||||
@@ -34,13 +33,11 @@ export const useAdminNavStore = defineStore('adminNav', () => {
|
||||
sidebarCollapsed.value = !sidebarCollapsed.value;
|
||||
};
|
||||
|
||||
const setBadgeCounts = (approvals: number, requests: number): void => {
|
||||
pendingApprovalsCount.value = approvals;
|
||||
const setBadgeCounts = (_approvals: number, requests: number): void => {
|
||||
pendingRequestsCount.value = requests;
|
||||
};
|
||||
|
||||
const badgeForModule = (moduleId: AdminModuleId): number | undefined => {
|
||||
if (moduleId === 'approvals' && pendingApprovalsCount.value > 0) return pendingApprovalsCount.value;
|
||||
if (moduleId === 'requests' && pendingRequestsCount.value > 0) return pendingRequestsCount.value;
|
||||
return undefined;
|
||||
};
|
||||
@@ -66,7 +63,7 @@ export const useAdminNavStore = defineStore('adminNav', () => {
|
||||
badgesInFlight = (async () => {
|
||||
try {
|
||||
const data = await getAdminDashboardBadges();
|
||||
setBadgeCounts(data.pending_approvals, data.pending_requests);
|
||||
setBadgeCounts(0, data.pending_requests);
|
||||
badgesFetchedAt = Date.now();
|
||||
} catch {
|
||||
setBadgeCounts(0, 0);
|
||||
@@ -88,7 +85,6 @@ export const useAdminNavStore = defineStore('adminNav', () => {
|
||||
sidebarCollapsed,
|
||||
reportsExpanded,
|
||||
wecomExpanded,
|
||||
pendingApprovalsCount,
|
||||
pendingRequestsCount,
|
||||
toggleSidebar,
|
||||
setBadgeCounts,
|
||||
@@ -97,3 +93,4 @@ export const useAdminNavStore = defineStore('adminNav', () => {
|
||||
refreshBadges,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/types/admin.types.ts
|
||||
* 管理后台域公共类型。
|
||||
* 绠$悊鍚庡彴鍩熷叕鍏辩被鍨嬨€?
|
||||
*/
|
||||
|
||||
export type AdminModuleId =
|
||||
| 'dashboard'
|
||||
| 'approvals'
|
||||
| 'users'
|
||||
| 'departments'
|
||||
| 'agents'
|
||||
@@ -67,3 +66,4 @@ export interface AdminAnnouncementRow {
|
||||
content: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ export interface AdminDashboardSummary {
|
||||
|
||||
/** GET /api/admin/dashboard/badges — 侧栏「用户审批」「权限申请」角标 */
|
||||
export interface AdminDashboardBadges {
|
||||
pending_approvals: number;
|
||||
pending_requests: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,15 @@ import { storeToRefs } from 'pinia';
|
||||
import { ExternalLink } from 'lucide-vue-next';
|
||||
import { useLinkedNavStore } from '../stores/linked-nav.store';
|
||||
|
||||
/**
|
||||
* 判断关联入口是否为图纸标注。
|
||||
* 图纸标注入口使用产品提供的尺规图标,其余入口继续使用统一的外链图标。
|
||||
*/
|
||||
function isDrawingAnnotationEntry(displayName: string): boolean {
|
||||
const normalized = String(displayName || '').trim();
|
||||
return normalized.includes('图纸标注') || normalized.includes('标注');
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
compact?: boolean;
|
||||
showLabel?: boolean;
|
||||
@@ -56,7 +65,13 @@ onMounted(() => {
|
||||
:title="entry.display_name"
|
||||
@click="linkedNav.openItem(entry)"
|
||||
>
|
||||
<ExternalLink :class="resolvedIconClass" />
|
||||
<img
|
||||
v-if="isDrawingAnnotationEntry(entry.display_name)"
|
||||
src="/icons/drawing-annotation.png"
|
||||
alt=""
|
||||
:class="[resolvedIconClass, 'object-contain']"
|
||||
/>
|
||||
<ExternalLink v-else :class="resolvedIconClass" />
|
||||
<span v-if="showLabel && !compact" class="truncate">{{ entry.display_name }}</span>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
Reference in new issue
Block a user