stat.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view>
  3. <view>
  4. <u-row style="padding: 10px;border-bottom: 1px solid #9c9c9c;">
  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="type == 'sc'">
  32. <view class="viewCent">
  33. <u-text :text="item.dosage" size="18"></u-text>
  34. </view>
  35. </u-col>
  36. <u-col span="6" v-if="type == 'nh'">
  37. <view class="viewCent">
  38. <u-text :text="(parseFloat(item.remark) * nhBz).toFixed(2) +' kWh'" size="18"></u-text>
  39. </view>
  40. </u-col>
  41. <u-col span="2" @click="toStatDayPage(item)">
  42. <view class="viewCent">
  43. <u-text text="详细" size="12" color="#26a495"></u-text>
  44. </view>
  45. </u-col>
  46. </u-row>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. dataList: [],
  55. type: '',
  56. nhBz: 0
  57. }
  58. },
  59. onLoad(option) {
  60. if (option && option.type) {
  61. console.log(option.type)
  62. this.type = option.type
  63. }
  64. this.nhBz = parseFloat(uni.getStorageSync('deviceInfo').energyConsumption)
  65. this.getList()
  66. },
  67. methods: {
  68. async getList() {
  69. const {
  70. data: res
  71. } = await this.$httpRequest({
  72. url: '/api/control/statList?useNoId=' + uni.getStorageSync('deviceInfo').deviceUseNo,
  73. method: 'get'
  74. });
  75. if (res.code === 200) {
  76. this.dataList = res.data
  77. } else {
  78. }
  79. },
  80. toStatDayPage(item) {
  81. uni.setStorageSync('yearMonth', item.createTimeVo)
  82. this.$goto('statDay?type=' + this.type)
  83. }
  84. }
  85. }
  86. </script>
  87. <style scoped>
  88. .viewCent {
  89. margin: 0 auto;
  90. }
  91. </style>