index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <view class="content">
  3. <!-- <div class="bigtitle">
  4. <h2>
  5. {{indexTitle}}
  6. </h2>
  7. </div> -->
  8. <view>
  9. <cyChart v-for="item in echartsData" :key="item.id" :chartType="item.chartType" :chartId="item.id"> </cyChart>
  10. </view>
  11. <u-empty text="暂无数据" icon="../../static/data.png" v-if="!echartsData.length"></u-empty>
  12. </view>
  13. </template>
  14. <script>
  15. import {
  16. nowDate,
  17. timeToDate,
  18. getLastWeek,
  19. getLastMonth,
  20. getLast3Month
  21. } from '../../utils/date.js'
  22. import cyChart from '../../components/cycharts/cyChart.vue';
  23. export default {
  24. components: {
  25. cyChart
  26. },
  27. data() {
  28. return {
  29. indexTitle: '',
  30. queryParams: {
  31. page: 1,
  32. limit: 999
  33. },
  34. //图表数据
  35. echartsData: [],
  36. }
  37. },
  38. created() {
  39. },
  40. mounted() {
  41. this.loadTitle();
  42. this.initData()
  43. },
  44. onPullDownRefresh() {
  45. this.loadTitle()
  46. this.initData()
  47. },
  48. methods: {
  49. //获得首页标题
  50. loadTitle() {
  51. uni.$http.get('/dict/queryByDictKey?dictKeys=title').then(res => {
  52. const data = res.data
  53. if (data.code === 200) {
  54. this.indexTitle = data.data[0].dictValue;
  55. uni.setNavigationBarTitle({
  56. title:this.indexTitle
  57. })
  58. }
  59. })
  60. },
  61. initData() {
  62. uni.removeStorage('sTime')
  63. this.clear = true
  64. this.value = null
  65. this.choiceTime = 0
  66. this.startTime = timeToDate(new Date().getTime())
  67. this.temperature()
  68. },
  69. //用户图表数据
  70. temperature() {
  71. this.echartsData = []
  72. uni.$http.get('/chart/getAllOkChart', this.queryParams).then(res => {
  73. const data = res.data
  74. if (data.code === 200) {
  75. const {
  76. reportTableList
  77. } = data.data
  78. let array = []
  79. for (let i = 0; i < reportTableList.length; i++) {
  80. array.push({
  81. id: reportTableList[i].id,
  82. chartType: reportTableList[i].chartType,
  83. chartName: reportTableList[i].chartName,
  84. })
  85. }
  86. this.echartsData = array
  87. }
  88. })
  89. uni.stopPullDownRefresh()
  90. },
  91. }
  92. };
  93. </script>
  94. <style scoped>
  95. .container {
  96. height: 120vh
  97. }
  98. .title {
  99. margin: 10rpx 0 10rpx 20rpx;
  100. font-size: 28rpx;
  101. color: #666666;
  102. }
  103. ::v-deep .uni-section-content {
  104. width: 50%;
  105. margin-bottom: 20rpx;
  106. }
  107. ::v-deep .uni-list-item__content-title {
  108. font-size: 36rpx;
  109. }
  110. .moreTime {
  111. display: flex;
  112. justify-content: space-between;
  113. align-items: center;
  114. width: 80vw;
  115. margin: auto
  116. }
  117. .bigtitle {
  118. margin: auto;
  119. text-align: center;
  120. }
  121. .bigtitle h2 {}
  122. .bod {
  123. border-bottom: 3px solid #007AFF;
  124. }
  125. .box {
  126. border: 1px solid #007AFF !important;
  127. }
  128. .childTime {
  129. margin: 16rpx 60rpx 0 60rpx;
  130. }
  131. .childTime>div {
  132. display: flex;
  133. justify-content: space-between;
  134. align-items: center;
  135. }
  136. .childTime>div>div {
  137. width: 140rpx;
  138. padding: 10rpx;
  139. border: 1px solid #e6e6e6;
  140. border-radius: 16rpx;
  141. color: #7e7e7e;
  142. font-size: 26rpx;
  143. text-align: center;
  144. }
  145. </style>