arrearsAnalysis.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <!-- 欠费分析 -->
  2. <template>
  3. <view class="arrears">
  4. <view class="arrears-line">
  5. <LineChart v-if="hasData" :chartData="chartData" :title="title" :opts="opts" />
  6. <view class="empty" v-else>
  7. <u-empty></u-empty>
  8. </view>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. import LineChart from '@/components/lineChart.vue'
  14. export default {
  15. components: {
  16. LineChart
  17. },
  18. props: {
  19. title: {
  20. type: String,
  21. default: ''
  22. },
  23. opts: {
  24. type: Object,
  25. default: () => {
  26. return {
  27. enableScroll: true,
  28. xAxis: {
  29. rotateLabel: true,
  30. scrollShow: true,
  31. itemCount: 8
  32. },
  33. yAxis: {
  34. showTitle: true,
  35. splitNumber: 5,
  36. data: [{
  37. title: '元',
  38. titleOffsetY: -3
  39. }]
  40. },
  41. legend: {
  42. show: true
  43. },
  44. dataLabel: false,
  45. padding: [10, 0, 10, 0],
  46. extra: {
  47. column: {
  48. width: 20
  49. }
  50. }
  51. }
  52. }
  53. }
  54. },
  55. data() {
  56. return {
  57. chartData: {
  58. categories: [],
  59. series: []
  60. },
  61. hasData: false
  62. }
  63. },
  64. methods: {
  65. getData({
  66. reportType,
  67. queryDate
  68. }) {
  69. this.hasData = false
  70. this.chartData.categories = []
  71. this.chartData.series = []
  72. this.getRoadData({
  73. reportType,
  74. queryDate
  75. })
  76. },
  77. getRoadData({
  78. reportType,
  79. queryDate
  80. }) {
  81. uni.$u.api.operationalAnalysisApi.getArrearsDataApi({
  82. reportType,
  83. queryDate
  84. }).then(res => {
  85. if (res.code === 200) {
  86. if (res.data.itemList && res.data.itemList.length) {
  87. this.chartData.series[0] = {
  88. name: '路段',
  89. data: []
  90. }
  91. this.chartData.categories = res.data.itemList.map(item => {
  92. return item.statisTime
  93. })
  94. this.chartData.series[0].data = res.data.itemList.map(item => {
  95. return item.amt
  96. })
  97. }
  98. this.getParkingData({
  99. reportType,
  100. queryDate
  101. })
  102. }
  103. })
  104. },
  105. getParkingData({
  106. reportType,
  107. queryDate
  108. }) {
  109. uni.$u.api.operationalAnalysisApi.getParkingArrearsDataApi({
  110. reportType,
  111. queryDate
  112. }).then(res => {
  113. if (res.code === 200) {
  114. if (res.data.itemList && res.data.itemList.length) {
  115. if (this.chartData.series.length) {
  116. this.chartData.series[1] = {
  117. name: '停车场',
  118. data: []
  119. }
  120. this.chartData.series[1].data = res.data.itemList.map(item => {
  121. return item.amt
  122. })
  123. } else {
  124. this.chartData.series[0] = {
  125. name: '停车场',
  126. data: []
  127. }
  128. this.chartData.series[0].data = res.data.itemList.map(item => {
  129. return item.amt
  130. })
  131. }
  132. if (!this.chartData.categories.length) {
  133. this.chartData.categories = res.data.itemList.map(item => {
  134. return item.statisTime
  135. })
  136. }
  137. this.hasData = true
  138. } else if (this.chartData.series.length === 1) {
  139. this.hasData = true
  140. } else if (!this.chartData.series.length) {
  141. this.hasData = false
  142. }
  143. }
  144. })
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .arrears {
  151. background-color: #fff;
  152. border-radius: 5px;
  153. .empty {
  154. padding: 15px;
  155. }
  156. }
  157. </style>