Michael Wang 4 سال پیش
والد
کامیت
119cd47241
1فایلهای تغییر یافته به همراه23 افزوده شده و 0 حذف شده
  1. 23 0
      src/modules/basic/view/user_copy_previllege_dialog.vue

+ 23 - 0
src/modules/basic/view/user_copy_previllege_dialog.vue

@@ -105,6 +105,8 @@
 
 <script>
 import { CORE_API } from "@/constants/constants";
+import { mapState } from "vuex";
+
 export default {
   name: "UserCopyPrevillegeDialog",
   props: {
@@ -127,9 +129,30 @@ export default {
       total: 10,
     };
   },
+  computed: {
+    ...mapState({
+      user: (state) => state.user,
+    }),
+    isOrgAdminNotSuperAdmin() {
+      return (
+        this.user.roleList.some((role) => role.roleCode == "ORG_ADMIN") &&
+        !this.user.roleList.some((role) => role.roleCode == "SUPER_ADMIN")
+      );
+    },
+    isSuperAdminOrOrgAdmin() {
+      return this.user.roleList.some(
+        (role) => role.roleCode == "SUPER_ADMIN" || role.roleCode == "ORG_ADMIN"
+      );
+    },
+  },
   methods: {
     async search() {
       var param = new URLSearchParams(this.form);
+      if (!this.isSuperAdminOrOrgAdmin)
+        param.append("ignoreRoleCodes", "SUPER_ADMIN,ORG_ADMIN");
+      else if (this.isOrgAdminNotSuperAdmin) {
+        param.append("ignoreRoleCodes", "SUPER_ADMIN");
+      }
       var url =
         CORE_API +
         "/user/all/" +