arrearsAnalysis.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. <u-loading-page :loading="loading" loading-text="loading..."></u-loading-page>
  11. </view>
  12. </template>
  13. <script>
  14. import LineChart from '@/components/lineChart.vue';
  15. export default {
  16. components: {
  17. LineChart
  18. },
  19. props: {
  20. title: {
  21. type: String,
  22. default: ''
  23. },
  24. opts: {
  25. type: Object,
  26. default: () => {
  27. return {
  28. enableScroll: true,
  29. xAxis: {
  30. rotateLabel: true,
  31. scrollShow: true,
  32. itemCount: 8
  33. },
  34. yAxis: {
  35. showTitle: true,
  36. splitNumber: 5,
  37. data: [
  38. {
  39. title: '元',
  40. titleOffsetY: -3
  41. }
  42. ]
  43. },
  44. legend: {
  45. show: true
  46. },
  47. dataLabel: false,
  48. padding: [20, 0, 10, 0],
  49. extra: {
  50. column: {
  51. width: 20
  52. }
  53. }
  54. };
  55. }
  56. }
  57. },
  58. data() {
  59. return {
  60. chartData: {
  61. categories: [],
  62. series: []
  63. },
  64. hasData: false,
  65. loading: false
  66. };
  67. },
  68. methods: {
  69. getData({ reportType, queryDate }) {
  70. this.hasData = false;
  71. this.chartData.categories = [];
  72. this.chartData.series = [];
  73. this.getParkingData({
  74. reportType,
  75. queryDate
  76. });
  77. },
  78. getParkingData({ reportType, queryDate }) {
  79. this.loading = true;
  80. uni.$u.api.operationalAnalysisApi
  81. .getParkingArrearsDataApi({
  82. reportType,
  83. queryDate
  84. })
  85. .then((res) => {
  86. if (res.code === 200) {
  87. if (res.data.itemList && res.data.itemList.length) {
  88. this.chartData.series[0] = {
  89. name: '停车场',
  90. data: []
  91. };
  92. this.chartData.series[0].data = res.data.itemList.map((item) => {
  93. return item.amt;
  94. });
  95. if (!this.chartData.categories.length) {
  96. this.chartData.categories = res.data.itemList.map((item) => {
  97. return item.statisTime;
  98. });
  99. }
  100. this.hasData = true;
  101. } else {
  102. this.hasData = false;
  103. }
  104. }
  105. this.loading = false;
  106. });
  107. }
  108. }
  109. };
  110. </script>
  111. <style lang="scss" scoped>
  112. .arrears {
  113. background-color: #fff;
  114. border-radius: 5px;
  115. .empty {
  116. padding: 15px;
  117. }
  118. }
  119. </style>