arrearsAnalysis.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <!-- 欠费分析 -->
  2. <template>
  3. <view class="arrears">
  4. <view class="arrears-line">
  5. <LineChart v-if="chartData.series[0].data.length" :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: false
  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. name: '路段',
  61. data: []
  62. }, {
  63. name: '停车场',
  64. data: []
  65. }]
  66. }
  67. }
  68. },
  69. methods: {
  70. getData({ reportType, queryDate }) {
  71. this.reportType = reportType
  72. this.queryDate = queryDate
  73. this.getArrearsData()
  74. },
  75. getArrearsData() {
  76. this.chartData.categories = []
  77. this.chartData.series[0].data = []
  78. this.chartData.series[1].data = []
  79. uni.$u.api.operationalAnalysisApi.getArrearsDataApi({
  80. reportType: this.reportType,
  81. queryDate: this.queryDate
  82. }).then(res => {
  83. if (res.code === 200) {
  84. if (res.data.itemList && res.data.itemList.length) {
  85. this.chartData.categories = res.data.itemList.map(item => {
  86. return item.statisTime
  87. })
  88. this.chartData.series[0].data = res.data.itemList.map(item => {
  89. return item.amt
  90. })
  91. }
  92. }
  93. })
  94. uni.$u.api.operationalAnalysisApi.getParkingArrearsDataApi({
  95. reportType: this.reportType,
  96. queryDate: this.queryDate
  97. }).then(res => {
  98. if (res.code === 200) {
  99. if (res.data.itemList && res.data.itemList.length) {
  100. this.chartData.categories = res.data.itemList.map(item => {
  101. return item.statisTime
  102. })
  103. this.chartData.series[1].data = res.data.itemList.map(item => {
  104. return item.amt
  105. })
  106. }
  107. }
  108. })
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. .arrears {
  115. background-color: #fff;
  116. border-radius: 5px;
  117. .empty {
  118. padding: 15px;
  119. }
  120. }
  121. </style>