فهرست منبع

feat: 暂时放开用户管理的按钮权限控制

louhangfei 11 ماه پیش
والد
کامیت
e97a05e1c0
3فایلهای تغییر یافته به همراه18 افزوده شده و 10 حذف شده
  1. 4 1
      src/main.ts
  2. 2 1
      src/router/generator-routers.ts
  3. 12 8
      src/views/system/user/user.vue

+ 4 - 1
src/main.ts

@@ -4,7 +4,7 @@ import { setupStore } from '@/store';
 import './main.scss';
 import 'element-plus/dist/index.css';
 import App from './App.vue';
-import { setupElement } from '@/plugins';
+import { setupElement, setupDirectives } from '@/plugins';
 import dayjs from 'dayjs';
 import 'dayjs/locale/zh-cn';
 
@@ -18,6 +18,9 @@ async function bootstrap() {
   // 全局完整引入 element 组件
   setupElement(app);
 
+  // 注册全局自定义指令,如:v-permission权限指令
+  setupDirectives(app);
+
   // 挂载状态管理
   setupStore(app);
   //优先挂载一下 Provider 解决路由守卫,Axios中可使用,Dialog,Message 等之类组件

+ 2 - 1
src/router/generator-routers.ts

@@ -43,7 +43,8 @@ export const routerGenerator = (routerMap, parent?): any[] => {
     // 是否有子菜单,并递归处理
     if (item.children && item.children.length > 0) {
       //如果未定义 redirect 默认第一个子路由为 redirect
-      !item.redirect && (currentRouter.redirect = `${item.path}/${item.children[0].path}`);
+      !item.redirect &&
+        (currentRouter.redirect = `${parent?.path ? parent?.path + '/' : ''}${item.path}/${item.children[0].path}`);
       // Recursion
       currentRouter.children = routerGenerator(item.children, currentRouter);
     }

+ 12 - 8
src/views/system/user/user.vue

@@ -10,7 +10,7 @@
     <el-card>
       <template #header>
         <el-space align="center">
-          <el-button @click="openAddAdminDrawer" v-if="!isSysTenant && isCanAddTenant && hasAddPermission()">
+          <el-button @click="openAddAdminDrawer" v-if="true || (!isSysTenant && isCanAddTenant && hasAddPermission())">
             <template #icon>
               <el-icon>
                 <Plus />
@@ -18,7 +18,8 @@
             </template>
             添加租户管理员
           </el-button>
-          <el-button type="primary" @click="openAddSingleDrawer" v-permission="{ action: [PERM_USER.ACCOUNT_ADD] }">
+          <!-- <el-button type="primary" @click="openAddSingleDrawer" v-permission="{ action: [PERM_USER.ACCOUNT_ADD] }"> -->
+          <el-button type="primary" @click="openAddSingleDrawer">
             <template #icon>
               <el-icon>
                 <Plus />
@@ -26,13 +27,14 @@
             </template>
             添加用户
           </el-button>
-          <el-button
+          <!-- <el-button
             color="#1890FF"
             @click="openAddMultipleDrawer"
             style="margin-left: 18px"
             plain
             v-permission="{ action: [PERM_USER.ACCOUNT_ADD] }"
-          >
+          > -->
+          <el-button color="#1890FF" @click="openAddMultipleDrawer" style="margin-left: 18px" plain>
             <template #icon>
               <el-icon>
                 <DocumentAdd />
@@ -100,18 +102,20 @@
           <template #default="scope">
             <el-space v-if="scope.row.roleType !== RoleTypeEnum.SUPER_ADMIN">
               <div class="el-space el-space--horizontal">
-                <div
+                <!-- <div
                   class="el-space__item"
                   @click="handleEdit(scope.row)"
                   v-permission="{ action: [PERM_USER.ACCOUNT_EDIT] }"
-                >
+                > -->
+                <div class="el-space__item" @click="handleEdit(scope.row)">
                   <div><img :src="editIcon" class="el-tooltip__trigger" /></div>
                 </div>
-                <div
+                <!-- <div
                   class="el-space__item"
                   @click="handleDelete(scope.row)"
                   v-permission="{ action: [PERM_USER.ACCOUNT_DELETE] }"
-                >
+                > -->
+                <div class="el-space__item" @click="handleDelete(scope.row)">
                   <div><img :src="deleteIcon" class="el-tooltip__trigger" /></div>
                 </div>
                 <div