gemercheung 1 anno fa
parent
commit
a3dbe5cf5f
3 ha cambiato i file con 29 aggiunte e 10 eliminazioni
  1. 7 7
      src/router.ts
  2. 8 1
      src/view/layout/slide/index.vue
  3. 14 2
      src/view/organization.vue

+ 7 - 7
src/router.ts

@@ -218,13 +218,13 @@ router.beforeEach((to, _, next) => {
     return;
     return;
   }
   }
   // organization
   // organization
-  if (to.name === "organization") {
-    console.log('isSuper-organization', isSuper.value)
-    if (!isSuper.value) {
-      router.replace({ name: "scene" });
-      return
-    }
-  }
+  // if (to.name === "organization") {
+  //   console.log('isSuper-organization', isSuper.value)
+  //   if (!isSuper.value) {
+  //     router.replace({ name: "scene" });
+  //     return
+  //   }
+  // }
 
 
   if (to.name === "map") {
   if (to.name === "map") {
     router.replace({ name: COORD_NAME, params: to.params });
     router.replace({ name: COORD_NAME, params: to.params });

+ 8 - 1
src/view/layout/slide/index.vue

@@ -26,7 +26,14 @@ const isSuper = computed(
   () =>
   () =>
     user.value.roles.filter((item) => item.roleKey === "super_admin").length > 0
     user.value.roles.filter((item) => item.roleKey === "super_admin").length > 0
 );
 );
-const normal_name = ["scene", "relics", "device", "users", "no-persession"];
+const normal_name = [
+  "scene",
+  "relics",
+  "device",
+  "organization",
+  "users",
+  "no-persession",
+];
 const super_names = [
 const super_names = [
   "scene",
   "scene",
   "relics",
   "relics",

+ 14 - 2
src/view/organization.vue

@@ -30,7 +30,9 @@
             >
             >
               重置
               重置
             </el-button>
             </el-button>
-            <el-button type="primary" @click="addHandler"> 新增单位 </el-button>
+            <el-button v-if="!isNotSuper" type="primary" @click="addHandler">
+              新增单位
+            </el-button>
           </el-form-item>
           </el-form-item>
         </el-form>
         </el-form>
       </div>
       </div>
@@ -70,6 +72,7 @@
             <el-button
             <el-button
               link
               link
               type="danger"
               type="danger"
+              v-if="!isNotSuper" 
               @click="delOrganization(row)"
               @click="delOrganization(row)"
               size="small"
               size="small"
             >
             >
@@ -94,7 +97,7 @@
 </template>
 </template>
 
 
 <script lang="ts" setup>
 <script lang="ts" setup>
-import { onActivated, ref, watch } from "vue";
+import { onActivated, ref, watch, computed } from "vue";
 import {
 import {
   getOrgListFetch,
   getOrgListFetch,
   addOrgFetch,
   addOrgFetch,
@@ -106,6 +109,7 @@ import type { OrganizationType } from "@/request/organization";
 import { OrganizationTypeDesc } from "@/store/organization";
 import { OrganizationTypeDesc } from "@/store/organization";
 import { organizationAdd, organizationEdit } from "./quisk";
 import { organizationAdd, organizationEdit } from "./quisk";
 import { debounce } from "@/util";
 import { debounce } from "@/util";
+import { user } from "@/store/user";
 import { ElMessageBox } from "element-plus";
 import { ElMessageBox } from "element-plus";
 import { openLoading, closeLoading } from "@/helper/loading";
 import { openLoading, closeLoading } from "@/helper/loading";
 
 
@@ -120,6 +124,14 @@ const pageProps = ref({ ...initProps });
 const total = ref<number>(0);
 const total = ref<number>(0);
 const relicsArray = ref<any[]>([]);
 const relicsArray = ref<any[]>([]);
 
 
+const isNotSuper = computed(
+  () =>
+    user.value.roles.filter(
+      (item) =>
+        item.roleKey === "system_admin" || item.roleKey === "system_common"
+    ).length > 0
+);
+
 // 1省级 2市级 3县级 4服务商
 // 1省级 2市级 3县级 4服务商
 
 
 const refresh = debounce(async () => {
 const refresh = debounce(async () => {