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