card.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="">
  3. <view @click="goDetail(item)" 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="content flex">
  24. <u-icon size="36" name="http://139.9.103.171:1888/miniofile/xlyq/xiaofangshuang.png"></u-icon>
  25. <text class="text-bold padding-left-10">设备名称:</text>
  26. <text>{{item.deviceName}}</text>
  27. </view>
  28. <view v-if="item.deviceType==100030" class="content flex align-center justify-start">
  29. <u-icon size="36" name="home" color="#fd9510"></u-icon>
  30. <text class="text-bold padding-left-10">所属企业:</text>
  31. <text v-text="item.enterpriseNames?item.enterpriseNames:'未知'" style="padding-top: 8rpx;" ></text>
  32. </view>
  33. <view class="content flex">
  34. <view class="flex">
  35. <u-icon size="36" name="http://139.9.103.171:1888/miniofile/xlyq/dianchi.png"></u-icon>
  36. <text class="text-bold padding-left-10">电池电量:</text>
  37. </view>
  38. <view class="striped active cu-progress round margin-top-sm " 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. <!-- 电表没有这个字段 -->
  45. <view class="content flex" v-if="item.deviceType!=100030">
  46. <view class="flex">
  47. <u-icon size="36" name="http://139.9.103.171:1888/miniofile/xlyq/wifi.png"></u-icon>
  48. <text class="text-bold padding-left-10">信号强弱:</text>
  49. </view>
  50. <view class="striped active cu-progress round margin-top-sm " style="width: 60%;">
  51. <view :style="[{ width:loading?item.signalIntensity+'%':''}]" style="background-color: #fc5f44;color: #FFFFFF;">
  52. {{item.signalIntensity?item.signalIntensity:0}}%
  53. </view>
  54. </view>
  55. </view>
  56. <view class="content flex">
  57. <u-icon size="36" name="http://139.9.103.171:1888/miniofile/xlyq/updateTime2.png"></u-icon>
  58. <text class="text-bold padding-left-10">更新时间:</text>
  59. <text style="padding-top: 8rpx;" v-text="item.updateTime?item.updateTime:'未知'"></text>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="bottom flex" >
  65. <view @click.stop="goDetail(item)" style="font-size: 22rpx;font-weight: 800;" class="cu-btn sm round base-line" >
  66. 查看详情
  67. </view>
  68. <view @click.stop="goAlarm(item)" class="cu-btn sm round base-line" style="margin: 0 20rpx;font-size: 22rpx;font-weight: 800;">
  69. <text v-if="item.deviceType==100030">抄表记录</text>
  70. <text v-else>告警记录</text>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. export default {
  78. name: 'card',
  79. props:{
  80. list:{
  81. type:Array,
  82. default:()=>{
  83. []
  84. }
  85. }
  86. },
  87. data() {
  88. return {
  89. loading:false
  90. };
  91. },
  92. created() {
  93. let that = this;
  94. setTimeout(function() {
  95. that.loading = true
  96. }, 500)
  97. },
  98. methods:{
  99. copy(data){
  100. uni.setClipboardData({
  101. data:data
  102. })
  103. },
  104. goDetail(item){
  105. getApp().globalData.fireHydrantDetail=item
  106. uni.navigateTo({
  107. url:'/pages/index/fire/detail'
  108. })
  109. },
  110. goAlarm(item){
  111. uni.navigateTo({
  112. url:"/pages/index/fire/alarm-record?imei="+item.imei
  113. })
  114. }
  115. }
  116. };
  117. </script>
  118. <style lang="scss">
  119. .line-green{
  120. border-color: #16aa5d;
  121. color: #16aa5d;
  122. }
  123. .line-red{
  124. border-color: #cf0000;
  125. color: #cf0000;
  126. }
  127. .data {
  128. width: 710rpx;
  129. background-color: #ffffff;
  130. margin: 20rpx auto;
  131. border-radius: 6rpx;
  132. box-sizing: border-box;
  133. padding: 20rpx 10rpx;
  134. font-size: 28rpx;
  135. .top {
  136. display: flex;
  137. justify-content: space-between;
  138. padding-bottom: 20rpx;
  139. border-bottom: 1rpx solid $dt-border-color-sm;
  140. .left {
  141. display: flex;
  142. align-items: center;
  143. .title {
  144. margin: 0 10rpx;
  145. font-size: 30rpx;
  146. }
  147. }
  148. .right{
  149. margin-right: 20rpx;
  150. }
  151. }
  152. .item {
  153. margin: 5rpx 0 20rpx 0;
  154. .content {
  155. border-bottom: 1rpx dashed #DDDDDD;
  156. padding: 30rpx 0;
  157. }
  158. }
  159. .bottom {
  160. display: flex;
  161. margin-top: 30rpx;
  162. justify-content: flex-end;
  163. align-items: center;
  164. }
  165. }
  166. </style>