equipmentElectricity.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <view>
  3. <view class="navbar-c">
  4. <view class="back" @click="backStatistics">
  5. <u-icon name="arrow-left" color="#101010" size="36"></u-icon>
  6. </view>
  7. <view class="title">
  8. 设备用电量<image class="img" src="@/assets/img/refresh-line.svg"></image>
  9. </view>
  10. </view>
  11. <!-- 标签 -->
  12. <view class="tabs-box">
  13. <view class="tabs">
  14. <u-tabs :list="list" :is-scroll="false" inactive-color="#999999" active-color="#666666" :current="current" @change="change"></u-tabs>
  15. </view>
  16. <view class="icon">
  17. <u-icon name="arrow-down" color="#999999"></u-icon>
  18. </view>
  19. </view>
  20. <!-- 用电量 -->
  21. <view class="main">
  22. <view class="item" v-for="(item, index) in kWhList" :key="index" @click="toElectronicMonitoring(item)">
  23. <view class="icon">
  24. <image class="img" src="@/assets/img/energyMeter.svg" mode=""></image>
  25. </view>
  26. <view class="equipment">
  27. <view class="equipment1">
  28. {{item.name}}
  29. </view>
  30. <view class="equipment2">
  31. {{item.companyName}}
  32. </view>
  33. </view>
  34. <view class="electricity">
  35. <view class="electricity-item">
  36. <view class="number">
  37. {{item.yesterdayKwh}}
  38. </view>
  39. <view class="date">
  40. 昨日
  41. </view>
  42. </view>
  43. <view class="electricity-item">
  44. <view class="number">
  45. {{item.thisMonthKwh}}
  46. </view>
  47. <view class="date">
  48. 本月
  49. </view>
  50. </view>
  51. <view class="electricity-item">
  52. <view class="number">
  53. {{item.lastMonthKwh}}
  54. </view>
  55. <view class="date">
  56. 上月
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. import * as API from '@/apis/pagejs/energy/index.js'
  66. export default {
  67. data() {
  68. return {
  69. kWhList: [],
  70. companyId: '',
  71. pageIndex: 1,
  72. recordsTotal: 0,
  73. list: [{
  74. name: '全部'
  75. }, {
  76. name: '荆鹏集团'
  77. }, {
  78. name: '青少年宫',
  79. }, {
  80. name: '荆州院子',
  81. }],
  82. current: 0
  83. }
  84. },
  85. onReady() {
  86. this.getList()
  87. },
  88. onReachBottom() {
  89. if (this.deviceList.length < this.recordsTotal) {
  90. this.myLoadmore();
  91. }
  92. },
  93. methods: {
  94. myLoadmore() {
  95. this.pageIndex += 1;
  96. this.getList();
  97. },
  98. getList(bl) {
  99. uni.showLoading({
  100. title: "加载中",
  101. mask: true,
  102. })
  103. if (bl) {
  104. this.kWhList = [];
  105. this.pageIndex = 1;
  106. }
  107. var data = {
  108. pageIndex: this.pageIndex,
  109. pageSize: 5,
  110. companyId: this.companyId
  111. };
  112. API.homePageKwh(data).then((res) => {
  113. uni.hideLoading()
  114. this.kWhList = [
  115. ...this.kWhList,
  116. ...res.data.data
  117. ];
  118. this.recordsTotal = res.data.recordsTotal;
  119. }).catch(error => {
  120. uni.showToast({
  121. title: error,
  122. icon: "none"
  123. })
  124. })
  125. },
  126. change(index) {
  127. this.current = index;
  128. },
  129. backStatistics() {
  130. uni.navigateBack()
  131. },
  132. toElectronicMonitoring() {
  133. uni.navigateTo({
  134. url: '/pages/equipmentDataMonitoring/electronicMonitoring'
  135. })
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .back {
  142. z-index: 999;
  143. width: 200rpx;
  144. }
  145. .tabs-box{
  146. background-color: #fff;
  147. display: flex;
  148. align-items: center;
  149. .tabs{
  150. width: 80%;
  151. }
  152. .icon{
  153. margin-left: auto;
  154. margin-right: 24rpx;
  155. }
  156. }
  157. // 用电量
  158. .main{
  159. background-color: #fff;
  160. .item{
  161. padding: 32rpx;
  162. display: flex;
  163. align-items: center;
  164. border-bottom: 1px solid rgba(245,245,245,1);
  165. .icon{
  166. width: 72rpx;
  167. height: 72rpx;
  168. border-radius: 4px;
  169. background-color: rgba(219,234,255,1);
  170. display: flex;
  171. align-items: center;
  172. justify-content: center;
  173. .img{
  174. width: 48rpx;
  175. height: 48rpx;
  176. }
  177. }
  178. .equipment{
  179. margin-left: 16rpx;
  180. .equipment1{
  181. color: rgba(51,51,51,1);
  182. font-size: 32rpx;
  183. font-weight: bold;
  184. }
  185. .equipment2{
  186. color: rgba(119,119,119,1);
  187. }
  188. }
  189. .electricity{
  190. display: flex;
  191. justify-content: space-between;
  192. flex: 1;
  193. margin-left: 48rpx;
  194. text-align: center;
  195. .electricity-item{
  196. .number{
  197. color: rgba(51,51,51,1);
  198. font-size: 32rpx;
  199. font-weight: bold;
  200. }
  201. .date{
  202. color: rgba(119,119,119,1);
  203. margin-top: 4rpx;
  204. }
  205. }
  206. }
  207. }
  208. }
  209. </style>