Showing
4 changed files
with
27 additions
and
3 deletions
@@ -10,6 +10,7 @@ import { Button } from 'ant-design-vue'; | @@ -10,6 +10,7 @@ import { Button } from 'ant-design-vue'; | ||
10 | import { TypeEnum } from './data'; | 10 | import { TypeEnum } from './data'; |
11 | import { PageEnum } from '/@/enums/pageEnum'; | 11 | import { PageEnum } from '/@/enums/pageEnum'; |
12 | import { useGo } from '/@/hooks/web/usePage'; | 12 | import { useGo } from '/@/hooks/web/usePage'; |
13 | +import { useAuthDeviceDetail } from '../hook/useAuthDeviceDetail'; | ||
13 | 14 | ||
14 | // 设备详情的描述 | 15 | // 设备详情的描述 |
15 | export const descSchema = (emit: EmitType): DescItem[] => { | 16 | export const descSchema = (emit: EmitType): DescItem[] => { |
@@ -34,12 +35,14 @@ export const descSchema = (emit: EmitType): DescItem[] => { | @@ -34,12 +35,14 @@ export const descSchema = (emit: EmitType): DescItem[] => { | ||
34 | label: '产品', | 35 | label: '产品', |
35 | render(val) { | 36 | render(val) { |
36 | const go = useGo(); | 37 | const go = useGo(); |
38 | + const { isCustomer } = useAuthDeviceDetail(); | ||
37 | return h( | 39 | return h( |
38 | Button, | 40 | Button, |
39 | { | 41 | { |
40 | type: 'link', | 42 | type: 'link', |
41 | style: { padding: 0 }, | 43 | style: { padding: 0 }, |
42 | - onClick: () => go(PageEnum.DEVICE_PROFILE + '?name=' + String(val)), | 44 | + onClick: () => |
45 | + !isCustomer ? go(PageEnum.DEVICE_PROFILE + '?name=' + String(val)) : '', | ||
43 | }, | 46 | }, |
44 | { default: () => val } | 47 | { default: () => val } |
45 | ); | 48 | ); |
@@ -49,7 +49,7 @@ | @@ -49,7 +49,7 @@ | ||
49 | </div> | 49 | </div> |
50 | <Description @register="register" class="mt-4" :data="deviceDetail" /> | 50 | <Description @register="register" class="mt-4" :data="deviceDetail" /> |
51 | </div> | 51 | </div> |
52 | - <div class="mt-4"> | 52 | + <div class="mt-4" v-if="!isCustomer"> |
53 | <a-button type="primary" class="mr-4" @click="copyTbDeviceId">复制设备ID</a-button> | 53 | <a-button type="primary" class="mr-4" @click="copyTbDeviceId">复制设备ID</a-button> |
54 | <a-button type="primary" class="mr-4" @click="copyDeviceToken">复制访问令牌</a-button> | 54 | <a-button type="primary" class="mr-4" @click="copyDeviceToken">复制访问令牌</a-button> |
55 | <a-button type="primary" class="mr-4" @click="manageDeviceToken">管理设备凭证</a-button> | 55 | <a-button type="primary" class="mr-4" @click="manageDeviceToken">管理设备凭证</a-button> |
@@ -83,6 +83,7 @@ | @@ -83,6 +83,7 @@ | ||
83 | import { Description, useDescription } from '/@/components/Description'; | 83 | import { Description, useDescription } from '/@/components/Description'; |
84 | import { QuestionCircleOutlined } from '@ant-design/icons-vue'; | 84 | import { QuestionCircleOutlined } from '@ant-design/icons-vue'; |
85 | import { DeviceTypeEnum } from '/@/api/device/model/deviceModel'; | 85 | import { DeviceTypeEnum } from '/@/api/device/model/deviceModel'; |
86 | + import { useAuthDeviceDetail } from '../../hook/useAuthDeviceDetail'; | ||
86 | 87 | ||
87 | import wz from '/@/assets/images/wz.png'; | 88 | import wz from '/@/assets/images/wz.png'; |
88 | import { useAsyncQueue } from '../../../localtion/useAsyncQueue'; | 89 | import { useAsyncQueue } from '../../../localtion/useAsyncQueue'; |
@@ -116,6 +117,7 @@ | @@ -116,6 +117,7 @@ | ||
116 | const mapWrapRef = ref<HTMLDivElement>(); | 117 | const mapWrapRef = ref<HTMLDivElement>(); |
117 | 118 | ||
118 | const { executeFlag, setTask } = useAsyncQueue(); | 119 | const { executeFlag, setTask } = useAsyncQueue(); |
120 | + const { isCustomer } = useAuthDeviceDetail(); | ||
119 | const { toPromise } = useAsyncScript({ src: BAI_DU_MAP_URL }); | 121 | const { toPromise } = useAsyncScript({ src: BAI_DU_MAP_URL }); |
120 | 122 | ||
121 | async function initMap(longitude: number, latitude: number, address: string) { | 123 | async function initMap(longitude: number, latitude: number, address: string) { |
@@ -209,6 +211,7 @@ | @@ -209,6 +211,7 @@ | ||
209 | copyTopic, | 211 | copyTopic, |
210 | remoteConnectiondGateway, | 212 | remoteConnectiondGateway, |
211 | locationImage, | 213 | locationImage, |
214 | + isCustomer, | ||
212 | }; | 215 | }; |
213 | }, | 216 | }, |
214 | }); | 217 | }); |
1 | +import { getAuthCache } from '/@/utils/auth'; | ||
2 | +import { RoleEnum } from '/@/enums/roleEnum'; | ||
3 | +import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | ||
4 | + | ||
5 | +//客户 | ||
6 | +export const useAuthDeviceDetail = () => { | ||
7 | + const userInfo: any = getAuthCache(USER_INFO_KEY); | ||
8 | + | ||
9 | + const role: string = userInfo?.roles[0]; | ||
10 | + | ||
11 | + const isCustomer = role === RoleEnum.CUSTOMER_USER; | ||
12 | + return { | ||
13 | + isCustomer, | ||
14 | + }; | ||
15 | +}; |
@@ -64,7 +64,7 @@ | @@ -64,7 +64,7 @@ | ||
64 | </template> | 64 | </template> |
65 | <template #deviceProfile="{ record }"> | 65 | <template #deviceProfile="{ record }"> |
66 | <Tag.CheckableTag | 66 | <Tag.CheckableTag |
67 | - @click="goDeviceProfile(record.deviceProfile.name)" | 67 | + @click="!isCustomer ? goDeviceProfile(record.deviceProfile.name) : null" |
68 | style="white-space: normal; height: auto; cursor: pointer" | 68 | style="white-space: normal; height: auto; cursor: pointer" |
69 | > | 69 | > |
70 | <span style="color: #377dff">{{ record.deviceProfile.name }}</span> | 70 | <span style="color: #377dff">{{ record.deviceProfile.name }}</span> |
@@ -219,6 +219,7 @@ | @@ -219,6 +219,7 @@ | ||
219 | import { useRoute, useRouter } from 'vue-router'; | 219 | import { useRoute, useRouter } from 'vue-router'; |
220 | import { useBatchOperation } from '/@/utils/useBatchOperation'; | 220 | import { useBatchOperation } from '/@/utils/useBatchOperation'; |
221 | import { useSyncConfirm } from '/@/hooks/component/useSyncConfirm'; | 221 | import { useSyncConfirm } from '/@/hooks/component/useSyncConfirm'; |
222 | + import { useAuthDeviceDetail } from './hook/useAuthDeviceDetail'; | ||
222 | 223 | ||
223 | export default defineComponent({ | 224 | export default defineComponent({ |
224 | name: 'DeviceManagement', | 225 | name: 'DeviceManagement', |
@@ -240,6 +241,7 @@ | @@ -240,6 +241,7 @@ | ||
240 | Button, | 241 | Button, |
241 | }, | 242 | }, |
242 | setup(_) { | 243 | setup(_) { |
244 | + const { isCustomer } = useAuthDeviceDetail(); | ||
243 | const { createMessage } = useMessage(); | 245 | const { createMessage } = useMessage(); |
244 | const go = useGo(); | 246 | const go = useGo(); |
245 | const ROUTER = useRouter(); | 247 | const ROUTER = useRouter(); |
@@ -502,6 +504,7 @@ | @@ -502,6 +504,7 @@ | ||
502 | handleBatchImport, | 504 | handleBatchImport, |
503 | handleImportFinally, | 505 | handleImportFinally, |
504 | handlePublicDevice, | 506 | handlePublicDevice, |
507 | + isCustomer, | ||
505 | }; | 508 | }; |
506 | }, | 509 | }, |
507 | }); | 510 | }); |