arrearsAnalysis.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. xAxis: {
  28. rotateLabel: false,
  29. labelCount: 6
  30. },
  31. yAxis: {
  32. showTitle: true,
  33. splitNumber: 5,
  34. data: [{
  35. title: '元',
  36. titleOffsetY: -5
  37. }]
  38. },
  39. legend: {
  40. show: true
  41. },
  42. dataLabel: false,
  43. extra: {
  44. column: {
  45. width: 20
  46. }
  47. }
  48. }
  49. }
  50. }
  51. },
  52. data() {
  53. return {
  54. chartData: {
  55. categories: [],
  56. series: [{
  57. name: '路段',
  58. data: []
  59. }, {
  60. name: '停车场',
  61. data: []
  62. }]
  63. }
  64. }
  65. },
  66. methods: {
  67. getData({ reportType, queryDate }) {
  68. this.reportType = reportType
  69. this.queryDate = queryDate
  70. this.getArrearsData()
  71. },
  72. getArrearsData() {
  73. this.chartData.categories = []
  74. this.chartData.series[0].data = []
  75. this.chartData.series[1].data = []
  76. uni.$u.api.operationalAnalysisApi.getArrearsDataApi({
  77. reportType: this.reportType,
  78. queryDate: this.queryDate
  79. }).then(res => {
  80. if (res.code === 200) {
  81. if (res.data.itemList && res.data.itemList.length) {
  82. this.chartData.categories = res.data.itemList.map(item => {
  83. return item.statisTime
  84. })
  85. this.chartData.series[0].data = res.data.itemList.map(item => {
  86. return item.amt
  87. })
  88. }
  89. }
  90. })
  91. uni.$u.api.operationalAnalysisApi.getParkingArrearsDataApi({
  92. reportType: this.reportType,
  93. queryDate: this.queryDate
  94. }).then(res => {
  95. if (res.code === 200) {
  96. if (res.data.itemList && res.data.itemList.length) {
  97. this.chartData.categories = res.data.itemList.map(item => {
  98. return item.statisTime
  99. })
  100. this.chartData.series[1].data = res.data.itemList.map(item => {
  101. return item.amt
  102. })
  103. }
  104. }
  105. })
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. .arrears {
  112. background-color: #fff;
  113. border-radius: 5px;
  114. .empty {
  115. padding: 15px;
  116. }
  117. }
  118. </style>