arrearsAnalysis.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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: false
  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. }
  61. }
  62. },
  63. methods: {
  64. getData({ reportType, queryDate }) {
  65. this.reportType = reportType
  66. this.queryDate = queryDate
  67. this.getArrearsData()
  68. },
  69. getArrearsData() {
  70. uni.$u.api.operationalAnalysisApi.getArrearsDataApi({
  71. reportType: this.reportType,
  72. queryDate: this.queryDate
  73. }).then(res => {
  74. console.log(res)
  75. if (res.code === 200) {
  76. if (res.data.itemList && res.data.itemList.length) {
  77. this.chartData.categories = res.data.itemList.map(item => {
  78. return item.statisTime
  79. })
  80. this.chartData.series[0].data = res.data.itemList.map(item => {
  81. return item.amt
  82. })
  83. } else {
  84. this.chartData.categories = []
  85. this.chartData.series[0].data = []
  86. }
  87. }
  88. })
  89. }
  90. }
  91. }
  92. </script>
  93. <style lang="scss" scoped>
  94. .arrears {
  95. background-color: #fff;
  96. border-radius: 5px;
  97. .empty {
  98. padding: 15px;
  99. }
  100. }
  101. </style>