Procházet zdrojové kódy

管理员账号 屏蔽编辑和删除按钮

zhulu před 1 rokem
rodič
revize
779e4c0866

+ 1 - 0
src/store/getters.js

@@ -8,6 +8,7 @@ const getters = {
   token: state => state.user.token,
   avatar: state => state.user.avatar,
   name: state => state.user.name,
+  isAdmin:state => state.user.isAdmin,
   userId: state => state.user.userId,
   deptId: state => state.user.deptId,
   orgId: state => state.user.orgId,

+ 6 - 0
src/store/modules/user.js

@@ -12,6 +12,7 @@ const user = {
     token: getToken(),
     name: "",
     userId: "",
+    isAdmin:false,
     orgId: "",
     avatar: "",
     roles: [],
@@ -76,6 +77,10 @@ const user = {
     SET_WHOLETREE: (state, val) => {
       state.wholeTree = val;
     },
+    SET_IS_ADMIN: (state, val) => {
+      state.isAdmin = val;
+    },
+    
   },
 
   actions: {
@@ -160,6 +165,7 @@ const user = {
             commit("SET_ORG_NAME", user.orgName);
             commit("SET_ORG_SHORT_NAME", user.orgShortName);
             commit("SET_ORG_TYPE", user.orgType);
+            commit("SET_IS_ADMIN", user.admin);
             resolve(res);
           })
           .catch((error) => {

+ 3 - 2
src/views/system/user/index.vue

@@ -306,6 +306,7 @@
                     size="mini"
                     type="text"
                     icon="el-icon-edit-outline"
+                    v-if="!($store.getters.isAdmin && $store.getters.userId==scope.row.id)"
                     @click="handleUpdate(scope.row)"
                     v-hasPermi="['system:user:edit']"
                     >编辑</el-button
@@ -314,7 +315,7 @@
                     size="mini"
                     type="text"
                     icon="el-icon-delete"
-                    v-if="scope.row.source == 0"
+                    v-if="scope.row.source == 0 && !($store.getters.isAdmin && $store.getters.userId==scope.row.id)"
                     @click="handleDelete(scope.row)"
                     v-hasPermi="['system:user:remove']"
                     >删除</el-button
@@ -323,7 +324,7 @@
                     size="mini"
                     type="text"
                     icon="el-icon-key"
-                    v-if="scope.row.source == 0"
+                    v-if="scope.row.source == 0 && !($store.getters.isAdmin && $store.getters.userId==scope.row.id)"
                     @click="handleRestPassword(scope.row)"
                     v-hasPermi="['system:user:resetPwd']"
                     >重置密码</el-button