From 882ba8911344b3a92d882344a09862370b84ef65 Mon Sep 17 00:00:00 2001 From: Kven <2955163637@qq.com> Date: Fri, 10 Jan 2025 10:40:37 +0800 Subject: [PATCH] =?UTF-8?q?perf(=E6=9D=83=E9=99=90=E6=A8=A1=E5=9D=97):=20?= =?UTF-8?q?=E7=BB=99=E6=89=80=E6=9C=89=E6=A8=A1=E5=9D=97=E5=92=8C=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E6=B7=BB=E5=8A=A0=E6=9D=83=E9=99=90=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/bulletin-mgmt.ts | 2 +- src/api/dept.ts | 2 +- src/hooks/permission.ts | 2 +- src/router/routes/modules/dashboard.ts | 3 +- src/router/routes/modules/iot.ts | 11 +- src/router/routes/modules/notification.ts | 31 +- src/router/routes/modules/system.ts | 50 +- src/store/modules/dept/index.ts | 2 +- src/store/modules/user/types.ts | 2 +- .../workplace/components/data-panel.vue | 4 +- .../iot/device/components/device-edit.vue | 3 +- src/views/iot/device/index.vue | 3 +- .../iot/product/components/product-edit.vue | 3 +- .../iot/product/components/product-tsl.vue | 9 +- src/views/iot/product/index.vue | 1 + .../bulletin/components/bulletin-edit.vue | 3 +- .../bulletin/components/detail.vue | 0 .../bulletin/index.vue | 35 +- src/views/notification/notice/index.vue | 355 ------------- src/views/system/authority/index.vue | 6 + .../system/dept/components/dept-edit.vue | 3 +- src/views/system/dept/index.vue | 16 +- .../message/components/message-edit.vue | 474 ------------------ src/views/system/message/index.vue | 360 ------------- .../system/role/components/role-edit.vue | 3 +- src/views/system/role/index.vue | 4 +- .../system/user/components/user-edit.vue | 3 +- src/views/system/user/index.vue | 2 +- 28 files changed, 106 insertions(+), 1286 deletions(-) rename src/views/{system => notification}/bulletin/components/bulletin-edit.vue (97%) rename src/views/{system => notification}/bulletin/components/detail.vue (100%) rename src/views/{system => notification}/bulletin/index.vue (96%) delete mode 100644 src/views/notification/notice/index.vue delete mode 100644 src/views/system/message/components/message-edit.vue delete mode 100644 src/views/system/message/index.vue diff --git a/src/api/bulletin-mgmt.ts b/src/api/bulletin-mgmt.ts index 39f0c48..8838944 100644 --- a/src/api/bulletin-mgmt.ts +++ b/src/api/bulletin-mgmt.ts @@ -24,7 +24,7 @@ export interface BulletinsRecord { publishTimeEnd?: string[]; total?: number; current: number; - pages: number; + size: number; } export interface AttachmentRecord { diff --git a/src/api/dept.ts b/src/api/dept.ts index d6939eb..70a1ac0 100644 --- a/src/api/dept.ts +++ b/src/api/dept.ts @@ -12,7 +12,7 @@ export interface DeptRecord extends DeptCreateRecord { } // 获取部门树 -export function getAllDeptTree(id: number | string) { +export function getAllDeptTree(id?: number | string) { return axios({ method: 'get', url: '/api/rest/dept/tree', diff --git a/src/hooks/permission.ts b/src/hooks/permission.ts index 4b06284..a95fd90 100644 --- a/src/hooks/permission.ts +++ b/src/hooks/permission.ts @@ -17,7 +17,7 @@ export default function usePermission() { ) ); }, - findFirstPermissionRoute(_routers: any, permissions: string[]) { + findFirstPermissionRoute(_routers: any, permissions: string[] | undefined) { const cloneRouters = [..._routers]; while (cloneRouters.length) { const firstElement = cloneRouters.shift(); diff --git a/src/router/routes/modules/dashboard.ts b/src/router/routes/modules/dashboard.ts index 2073d42..080fcf2 100644 --- a/src/router/routes/modules/dashboard.ts +++ b/src/router/routes/modules/dashboard.ts @@ -11,6 +11,7 @@ const DASHBOARD: AppRouteRecordRaw = { requiresAuth: true, icon: 'icon-dashboard', // 设置图标 order: 0, // 排序路由菜单项。如果设置该值,值越高,越靠前 + permissions: ['dashboard'], }, children: [ { @@ -21,7 +22,7 @@ const DASHBOARD: AppRouteRecordRaw = { locale:'menu.dashboard.workplace', title: '工作台', requiresAuth: true, - permissions: ['*'], + permissions: ['dashboard:workplace'], }, }, ], diff --git a/src/router/routes/modules/iot.ts b/src/router/routes/modules/iot.ts index ec8dca4..c6ec332 100644 --- a/src/router/routes/modules/iot.ts +++ b/src/router/routes/modules/iot.ts @@ -11,6 +11,7 @@ const IOT: AppRouteRecordRaw = { icon: 'icon-empty', requiresAuth: true, order: 1, + permissions: ['iot'], }, children: [ { @@ -21,7 +22,7 @@ const IOT: AppRouteRecordRaw = { locale: 'menu.system.product', title: '产品管理', requiresAuth: true, - permissions: ['*'], + permissions: ['iot:product'], }, }, { @@ -32,7 +33,7 @@ const IOT: AppRouteRecordRaw = { locale: 'menu.system.device', title: '设备管理', requiresAuth: true, - permissions: ['*'], + permissions: ['iot:device'], }, }, { @@ -44,7 +45,7 @@ const IOT: AppRouteRecordRaw = { title: '产品详情', requiresAuth: true, showInMenu: false, - permissions: ['*'], + permissions: ['iot:product:query'], }, }, { @@ -56,7 +57,7 @@ const IOT: AppRouteRecordRaw = { title: '设备详情', requiresAuth: true, showInMenu: false, - permissions: ['*'], + permissions: ['iot:device:query'], }, }, { @@ -68,7 +69,7 @@ const IOT: AppRouteRecordRaw = { title: '物模型', requiresAuth: true, showInMenu: false, - permissions: ['*'], + permissions: ['iot:tsl'], }, } diff --git a/src/router/routes/modules/notification.ts b/src/router/routes/modules/notification.ts index 29ea699..9accd2a 100644 --- a/src/router/routes/modules/notification.ts +++ b/src/router/routes/modules/notification.ts @@ -11,28 +11,39 @@ const NOTIFICATION: AppRouteRecordRaw = { requiresAuth: true, icon: 'icon-message', // 设置图标 order: 0, // 排序路由菜单项。如果设置该值,值越高,越靠前 + permissions: ['message'], }, children: [ { path: 'notice', - name: 'notice', + name: 'Notice', component: () => import('@/views/notification/notice/index.vue'), meta: { - locale: '公告通知', - title: '公告通知', + locale: '消息管理', + title: '消息管理', requiresAuth: true, - permissions: ['*'], + permissions: ['message:notice'], }, }, { - path: 'noticeSet', - name: 'noticeSet', - component: () => import('@/views/notification/noticeSet/index.vue'), - meta: { - locale: '公告管理', + path:'bulletin', + name:'Bulletin', + component: () => import('@/views/notification/bulletin/index.vue'), + meta:{ title: '公告管理', requiresAuth: true, - permissions: ['*'], + permissions: ['message:bulletin'], + }, + }, + { + path: 'bulletinDetail/:id', + name: 'BulletinDetail', + component: () => import('@/views/notification/bulletin/components/detail.vue'), + meta: { + title: '公告详情', + requiresAuth: true, + showInMenu: false, + permissions: ['message:bulletin:query'], }, }, ], diff --git a/src/router/routes/modules/system.ts b/src/router/routes/modules/system.ts index f8aba44..0c848bc 100644 --- a/src/router/routes/modules/system.ts +++ b/src/router/routes/modules/system.ts @@ -10,6 +10,7 @@ const SYSTEM: AppRouteRecordRaw = { icon: 'icon-computer', requiresAuth: true, order: 2, + permissions: ['system'], }, children: [ // { @@ -29,7 +30,7 @@ const SYSTEM: AppRouteRecordRaw = { meta: { title: '角色管理', requiresAuth: true, - permissions: ['*'], + permissions: ['system:role'], }, }, { @@ -39,7 +40,7 @@ const SYSTEM: AppRouteRecordRaw = { meta: { title: '部门管理', requiresAuth: true, - permissions: ['*'], + permissions: ['system:dept'], }, }, { @@ -49,7 +50,7 @@ const SYSTEM: AppRouteRecordRaw = { meta: { title: '用户管理', requiresAuth: true, - permissions: ['*'], + permissions: ['system:user'], }, }, { @@ -59,40 +60,19 @@ const SYSTEM: AppRouteRecordRaw = { meta: { title: '权限管理', requiresAuth: true, - permissions: ['*'], - }, - }, - { - path:'bulletin', - name:'Bulletin', - component: () => import('@/views/system/bulletin/index.vue'), - meta:{ - title: '公告管理', - requiresAuth: true, - permissions: ['*'], - }, - }, - { - path:'message', - name:'Message', - component: () => import('@/views/system/message/index.vue'), - meta:{ - title: '消息管理', - requiresAuth: true, - permissions: ['*'], - }, - }, - { - path: 'detail/:id', - name: 'Detail', - component: () => import('@/views/system/bulletin/components/detail.vue'), - meta: { - title: '公告详情', - requiresAuth: true, - showInMenu: false, - permissions: ['*'], + permissions: ['system:authority'], }, }, + // { + // path:'message', + // name:'Message', + // component: () => import('@/views/system/message/index.vue'), + // meta:{ + // title: '消息管理', + // requiresAuth: true, + // permissions: ['*'], + // }, + // }, ], }; diff --git a/src/store/modules/dept/index.ts b/src/store/modules/dept/index.ts index 039badc..5b28e4d 100644 --- a/src/store/modules/dept/index.ts +++ b/src/store/modules/dept/index.ts @@ -26,7 +26,7 @@ const useDeptStore = defineStore('dept', { }, actions: { // 获取所有部门树 - async getAllDeptTree(id: number | string) { + async getAllDeptTree(id?: number | string) { return getAllDeptTree(id); }, diff --git a/src/store/modules/user/types.ts b/src/store/modules/user/types.ts index 65d3204..9090d82 100644 --- a/src/store/modules/user/types.ts +++ b/src/store/modules/user/types.ts @@ -14,6 +14,6 @@ export interface UserState { role?: RoleRecord; roles?: RoleRecord[]; // permissions?: string[] | '' | '*' | 'admin' | 'user' | 'auditor'; - permissions?: string[]; + permissions?: string[] | undefined; authorities?: string[]; } diff --git a/src/views/dashboard/workplace/components/data-panel.vue b/src/views/dashboard/workplace/components/data-panel.vue index 279bd5a..bc4d614 100644 --- a/src/views/dashboard/workplace/components/data-panel.vue +++ b/src/views/dashboard/workplace/components/data-panel.vue @@ -13,7 +13,7 @@ /> - + 新建 { return { diff --git a/src/views/iot/product/components/product-edit.vue b/src/views/iot/product/components/product-edit.vue index b9b3f26..338b317 100644 --- a/src/views/iot/product/components/product-edit.vue +++ b/src/views/iot/product/components/product-edit.vue @@ -1,9 +1,10 @@