device-card.vue 4.8 KB

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