deviceIn.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <!-- 接入方式 -->
  3. <div class="title">{{ $t('message.device.formI18nLabel.transportProtocol') }}</div>
  4. <div class="text">{{ data.name }}</div>
  5. <!-- 消息协议 -->
  6. <div class="title">{{ $t('message.device.formI18nLabel.messageProtocol') }}</div>
  7. <div class="text">{{ data.protocol }}</div>
  8. <!-- 认证说明 -->
  9. <div class="title">{{ $t('message.device.formI18nLabel.authDescription') }}</div>
  10. <div class="text">{{ data.description }}</div>
  11. <!-- 链接信息 -->
  12. <div class="title">{{ $t('message.device.formI18nLabel.linkInfo') }}</div>
  13. <div class="text">{{ data.link }}</div>
  14. <!-- 认证配置 -->
  15. <div class="title">{{ $t('message.device.formI18nLabel.authConfig') }}</div>
  16. <!-- 请联系管理员 -->
  17. <template v-if="!isAdmin">{{ $t('message.device.formI18nLabel.contactAdmin') }}</template>
  18. <template v-else-if="data.authType === 1 || data.authType === 2">
  19. <!-- 认证方式 -->
  20. <el-form-item :label="$t('message.device.formI18nLabel.authType')" prop="authType" label-width="80px" style="margin-bottom: 0;">
  21. {{ data.authType === 1 ? 'Basic' : 'AccessToken' }}
  22. </el-form-item>
  23. <template v-if="data.authType === 1">
  24. <!-- 用户名 -->
  25. <el-form-item :label="$t('message.device.formI18nLabel.authUser')" prop="authUser" label-width="80px" style="margin-bottom: 0;">
  26. {{ data.authUser }}
  27. </el-form-item>
  28. <!-- 密码 -->
  29. <el-form-item :label="$t('message.device.formI18nLabel.authPasswd')" prop="authPasswd" label-width="80px">
  30. {{ data.authPasswd }}
  31. </el-form-item>
  32. </template>
  33. <template v-else>
  34. <!-- Aceess Token -->
  35. <el-form-item label="Aceess Token" prop="accessToken">
  36. {{ data.accessToken }}
  37. </el-form-item>
  38. </template>
  39. </template>
  40. <template v-else-if="data.authType === 3">
  41. <!-- 认证证书 -->
  42. <el-form-item :label="$t('message.device.formI18nLabel.certificateId')" prop="certificateName">
  43. {{ data.certificateName }}
  44. </el-form-item>
  45. </template>
  46. </template>
  47. <script lang="ts" setup>
  48. import { reactive } from 'vue';
  49. import api from '/@/api/device';
  50. import { useRoute } from 'vue-router';
  51. const route = useRoute();
  52. const isAdmin = localStorage.userId == '1'
  53. const data = reactive({
  54. "name": "",
  55. "protocol": "",
  56. "description": "",
  57. "link": "",
  58. "authType": 0,
  59. "authUser": "",
  60. "authPasswd": "",
  61. "accessToken": "",
  62. "certificateName": "",
  63. "certificateId": 0
  64. })
  65. api.product.connect_intro(route.params.id as string).then((res: any) => {
  66. Object.assign(data, res.data)
  67. })
  68. </script>
  69. <style lang="scss" scoped>
  70. .title {
  71. font-weight: bold;
  72. line-height: 1.2;
  73. border-left: 4px solid #409eff;
  74. padding-left: 8px;
  75. margin: 20px 0 14px;
  76. }
  77. </style>