Commit 89b16c2108bb4df5ba3fb45fb994d926ae477f02

Authored by fengwotao
1 parent 887a42a8

fix:DEFECT-1220 客户账号如果有TBOX,远程连接点击要么显示没有权限,要么启用也是灰色按钮不可点击

... ... @@ -12,7 +12,12 @@
12 12 </template>
13 13 </BasicTable>
14 14 <div style="margin-left: 0.44rem">
15   - <a-button type="primary" class="mr-4" :disabled="disabled" @click="handleFrpRemote"
  15 + <a-button
  16 + v-if="isAdmin !== 'CUSTOMER_USER'"
  17 + type="primary"
  18 + class="mr-4"
  19 + :disabled="disabled"
  20 + @click="handleFrpRemote"
16 21 >远程连接</a-button
17 22 >
18 23 </div>
... ... @@ -20,13 +25,15 @@
20 25 </template>
21 26
22 27 <script setup lang="ts">
23   - import { ref, nextTick } from 'vue';
  28 + import { ref, nextTick, computed } from 'vue';
24 29 import { BasicTable, useTable, BasicColumn } from '/@/components/Table';
25 30 import { Switch } from 'ant-design-vue';
26 31 import { h } from 'vue';
27 32 import { Tag } from 'ant-design-vue';
28 33 import { frpGetInfoApi, frpPutInfoApi } from '/@/api/device/deviceConfigApi';
29 34 import { useMessage } from '/@/hooks/web/useMessage';
  35 + import { USER_INFO_KEY } from '/@/enums/cacheEnum';
  36 + import { getAuthCache } from '/@/utils/auth';
30 37
31 38 const props = defineProps({
32 39 deviceDetail: {
... ... @@ -35,6 +42,18 @@
35 42 },
36 43 });
37 44
  45 + const userInfo = getAuthCache(USER_INFO_KEY) as unknown as any;
  46 +
  47 + const isAdmin = computed(() => {
  48 + if (userInfo.roles.includes('TENANT_ADMIN')) {
  49 + return 'TENANT_ADMIN';
  50 + } else if (userInfo.roles.includes('CUSTOMER_USER')) {
  51 + return 'CUSTOMER_USER';
  52 + } else {
  53 + return 'SYS_ADMIN';
  54 + }
  55 + });
  56 +
38 57 const { createMessage } = useMessage();
39 58 const tableData: any = ref([]);
40 59 const checked = ref<boolean>(false);
... ...