device-card.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view class="">
  3. <view class="data" v-for="(item, index) in list" :key="index">
  4. <view class="top">
  5. <view class="left">
  6. <view class="title">
  7. <text>IMEI:{{item.imei}}</text>
  8. <text @click.stop="copy(item.imei)" style="text-decoration: underline;"
  9. class="base-color padding-left-20">复制
  10. </text>
  11. </view>
  12. </view>
  13. <view class="right">
  14. <view v-if="item.defenseStatus==1" style="font-size: 24rpx;" class="radius sm cu-btn line-green">
  15. 已上线
  16. </view>
  17. <view v-if="item.defenseStatus==2" class="radius sm cu-btn line-red">
  18. 已下线
  19. </view>
  20. </view>
  21. </view>
  22. <view class="item">
  23. <view class="left">
  24. <view style="padding: 0 30rpx;">
  25. <view class="contents" style="display: flex; align-items: center;">
  26. <u-icon size="36" name="info-circle-fill" color="#fc5f44"></u-icon>
  27. <text class="text-bold padding-left-sm">设备类型:</text>
  28. <text>{{item.deviceTypeName}}</text>
  29. </view>
  30. <view class="contents" style="display: flex; align-items: center;">
  31. <u-icon size="36" name="bell-fill" color="#81c995"></u-icon>
  32. <text class="text-bold padding-left-sm">设备名称:</text>
  33. <text>{{item.deviceName}}</text>
  34. </view>
  35. <view class="contents" style="display: flex; align-items: center;">
  36. <view style="display: flex; align-items: center;">
  37. <image src="https://szsq.nxzhsq.cn/community/miniofile/xlyq/dianchi.png"
  38. style="width: 36rpx;height: 36rpx;"></image>
  39. <text class="text-bold padding-left-sm">电池电量:</text>
  40. </view>
  41. <view class="striped active cu-progress round " style="width: 60%;">
  42. <view :style="[{ width:loading?item.battery+'%':''}]"
  43. style="background-color: #16c60c;color: #FFFFFF;">
  44. {{item.battery?item.battery:0}}%
  45. </view>
  46. </view>
  47. </view>
  48. <view class="contents" style="display: flex; align-items: center;">
  49. <u-icon size="36" name="map-fill" color="#fd9f8f"></u-icon>
  50. <text class="text-bold padding-left-sm">安装位置:</text>
  51. <text>{{item.deviceInstallAddress}}</text>
  52. </view>
  53. <!-- 电表没有这个字段 -->
  54. <!-- <view class="content" style="display: flex; align-items: center;" v-if="item.deviceType!=100030">
  55. <view style="display: flex; align-items: center;">
  56. <u-icon size="36" name="https://szsq.nxzhsq.cn/community/miniofile/xlyq/wifi.png"></u-icon>
  57. <text class="text-bold padding-left-sm">信号强度:</text>
  58. </view>
  59. <view class="striped active cu-progress round " style="width: 60%;">
  60. <view :style="[{ width:loading?item.signalIntensity+'%':''}]" style="background-color: #fc5f44;color: #FFFFFF;">
  61. {{item.signalIntensity?item.signalIntensity:0}}%
  62. </view>
  63. </view>
  64. </view> -->
  65. <!-- <view class="content" style="display: flex; align-items: center;">
  66. <u-icon size="36" name="backspace"></u-icon>
  67. <text class="text-bold padding-left-sm">更新时间:</text>
  68. <text v-text="item.updateTime?item.updateTime:'未知'"></text>
  69. </view> -->
  70. </view>
  71. </view>
  72. </view>
  73. <view class="bottom">
  74. <!-- <view @click.stop="goDetail(item)" style="font-size: 22rpx;font-weight: 800;" class="cu-btn sm round base-line" >
  75. 查看详情
  76. </view> -->
  77. <!-- <view @click.stop="goAlarm(item)" class="cu-btn sm round base-line" style="margin: 0 20rpx;font-size: 22rpx;font-weight: 800;">
  78. <text>告警记录</text>
  79. </view> -->
  80. </view>
  81. </view>
  82. </view>
  83. </template>
  84. <script>
  85. export default {
  86. name: 'card',
  87. props: {
  88. list: {
  89. type: Array,
  90. default: () => {
  91. []
  92. }
  93. }
  94. },
  95. data() {
  96. return {
  97. loading: false
  98. };
  99. },
  100. created() {
  101. let that = this;
  102. setTimeout(function () {
  103. that.loading = true
  104. }, 500)
  105. },
  106. methods: {
  107. copy(data) {
  108. uni.setClipboardData({
  109. data: data
  110. })
  111. },
  112. goAlarm(item) {
  113. uni.navigateTo({
  114. url: "/pages/device/records?imei=" + item.imei
  115. })
  116. }
  117. }
  118. };
  119. </script>
  120. <style lang="scss" scoped>
  121. .line-green {
  122. border-color: #16aa5d;
  123. color: #16aa5d;
  124. }
  125. .line-red {
  126. border-color: #cf0000;
  127. color: #cf0000;
  128. }
  129. .data {
  130. width: 710 rpx;
  131. background-color: #ffffff;
  132. margin: 20 rpx auto;
  133. border-radius: 6 rpx;
  134. box-sizing: border-box;
  135. padding: 20 rpx 10 rpx;
  136. font-size: 28 rpx;
  137. .top {
  138. display: flex;
  139. justify-content: space-between;
  140. padding-bottom: 20 rpx;
  141. border-bottom: 1 rpx solid $dt-border-color-sm;
  142. .left {
  143. display: flex;
  144. align-items: center;
  145. .title {
  146. margin: 0 10 rpx;
  147. font-size: 30 rpx;
  148. }
  149. }
  150. .right {
  151. margin-right: 20 rpx;
  152. }
  153. }
  154. .item {
  155. margin: 5 rpx 0 20 rpx 0;
  156. .contents {
  157. border-bottom: 1 rpx dashed #DDDDDD;
  158. padding: 30 rpx 0;
  159. }
  160. }
  161. .bottom {
  162. display: flex;
  163. margin-top: 30 rpx;
  164. justify-content: flex-end;
  165. align-items: center;
  166. }
  167. }
  168. </style>