statDay.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view>
  3. <view>
  4. <u-row style="padding: 10px;border-bottom: 1px solid #000000;">
  5. <u-col span="4">
  6. <view class="viewCent">
  7. <u-text text="日期" size="14"></u-text>
  8. </view>
  9. </u-col>
  10. <u-col span="6" v-if="type == 'sc'">
  11. <view class="viewCent">
  12. <u-text text="运行时间" size="14"></u-text>
  13. </view>
  14. </u-col>
  15. <u-col span="6" v-if="type == 'nh'">
  16. <view class="viewCent">
  17. <u-text text="电量消耗 (预估)" size="14"></u-text>
  18. </view>
  19. </u-col>
  20. <u-col span="2">
  21. </u-col>
  22. </u-row>
  23. </view>
  24. <view v-for="item in dataList">
  25. <u-row style="padding: 10px;border-bottom: 1px solid #aaaaaa;">
  26. <u-col span="4">
  27. <view class="viewCent">
  28. <u-text :text="item.createTimeVo" size="18"></u-text>
  29. </view>
  30. </u-col>
  31. <u-col span="6" v-if="">
  32. <view class="viewCent">
  33. <u-text v-if="item.isStat === 0 && type == 'sc'" :text="item.dosage" size="18"></u-text>
  34. <u-text v-if="item.isStat === 0 && type == 'nh'"
  35. :text="(parseFloat(item.remark) * nhBz).toFixed(2) +' kWh'" size="18"></u-text>
  36. <u-text v-if="item.isStat === 1" text="统计中" color="#1c81df" size="18"></u-text>
  37. <u-text v-if="item.isStat === 2" text="未使用" color="#ffaa00" size="18"></u-text>
  38. </view>
  39. </u-col>
  40. <u-col span="2" @click="toStatDayPage(item)">
  41. <view class="viewCent">
  42. <u-text text="日志" size="12" color="#26a495"></u-text>
  43. </view>
  44. </u-col>
  45. </u-row>
  46. </view>
  47. <u-popup :show="show" @close="close" @open="open">
  48. <view style="padding: 20px 20px 0 20px;">
  49. <view>
  50. <u-row style="padding: 10px;border-bottom: 1px solid #aaaaaa;">
  51. <u-col span="9">
  52. <view class="viewCent">
  53. <u-text text="时间" size="18"></u-text>
  54. </view>
  55. </u-col>
  56. <u-col span="3">
  57. <view class="viewCent">
  58. <u-text text="操作" size="18"></u-text>
  59. </view>
  60. </u-col>
  61. </u-row>
  62. <view v-if="logList.length === 0" style="text-align: center;margin-top: 40px;">
  63. 暂无数据
  64. </view>
  65. <view>
  66. <u-list style="height:400px;">
  67. <u-list-item v-for="item in logList">
  68. <view>
  69. <u-row style="padding: 10px;border-bottom: 1px solid #aaaaaa;">
  70. <u-col span="9">
  71. <view class="viewCent">
  72. <u-text :text="item.createTime" size="16"></u-text>
  73. </view>
  74. </u-col>
  75. <u-col span="3">
  76. <view class="viewCent">
  77. <u-text v-if="item.useDescribe === '打开'" :text="item.useDescribe"
  78. color="#00cb62" size="18"></u-text>
  79. <u-text v-else color="#cf0000" :text="item.useDescribe" size="18">
  80. </u-text>
  81. </view>
  82. </u-col>
  83. </u-row>
  84. </view>
  85. </u-list-item>
  86. </u-list>
  87. </view>
  88. </view>
  89. <view style="text-align: center; margin-top: 20px;position: absolute;top: -10px;right: 15px;">
  90. <view @click="show = false;">
  91. <u-icon name="close" size="18"></u-icon>
  92. </view>
  93. </view>
  94. </view>
  95. </u-popup>
  96. </view>
  97. </template>
  98. <script>
  99. export default {
  100. data() {
  101. return {
  102. show: false,
  103. dataList: [],
  104. logList: [],
  105. type: '',
  106. nhBz: 0
  107. }
  108. },
  109. onLoad(option) {
  110. if (option && option.type) {
  111. console.log(option.type)
  112. this.type = option.type
  113. }
  114. this.nhBz = parseFloat(uni.getStorageSync('deviceInfo').energyConsumption)
  115. console.log(this.nhBz)
  116. this.getList()
  117. },
  118. methods: {
  119. async getList() {
  120. const {
  121. data: res
  122. } = await this.$httpRequest({
  123. url: '/api/control/statDayList?useNoId=' + uni.getStorageSync('deviceInfo').deviceUseNo +
  124. '&yearMonth=' + uni.getStorageSync('yearMonth'),
  125. method: 'get'
  126. });
  127. if (res.code === 200) {
  128. this.dataList = res.data
  129. console.log(this.dataList)
  130. } else {
  131. }
  132. },
  133. toStatDayPage(item) {
  134. this.show = true
  135. this.getLogList(item)
  136. },
  137. async getLogList(item) {
  138. this.logList = []
  139. const {
  140. data: res
  141. } = await this.$httpRequest({
  142. url: '/api/control/useLogList?useNoId=' + item.useNoId +
  143. '&date=' + item.createTime.substr(0, 10),
  144. method: 'get'
  145. });
  146. if (res.code === 200) {
  147. this.logList = res.data
  148. console.log(this.logList)
  149. } else {
  150. }
  151. },
  152. open() {
  153. // console.log('open');
  154. },
  155. close() {
  156. this.show = false
  157. // console.log('close');
  158. }
  159. }
  160. }
  161. </script>
  162. <style scoped>
  163. .viewCent {
  164. margin: 0 auto;
  165. }
  166. </style>