tollCollectorPerformance.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!-- 收费员业绩 -->
  2. <template>
  3. <view class="performance">
  4. <template v-if="type === 'table'">
  5. <TableRanking :loading="loading" :title="title" :tableTh="tableTh" :tableData="tableData" @pageChange="pageChange"/>
  6. </template>
  7. <template v-else>
  8. <LineChart v-if="chartData.series[0].data.length" :chartData="chartData" :title="title" :opts="opts"/>
  9. <view class="empty" v-else>
  10. <u-empty></u-empty>
  11. </view>
  12. </template>
  13. </view>
  14. </template>
  15. <script>
  16. import TableRanking from '@/components/tableRanking.vue'
  17. import LineChart from '@/components/lineChart.vue'
  18. export default {
  19. components: {
  20. TableRanking,
  21. LineChart
  22. },
  23. props: {
  24. type: {
  25. type: String,
  26. default: 'table'
  27. },
  28. title: {
  29. type: String,
  30. default: ''
  31. },
  32. tableTh: {
  33. type: Array,
  34. default: () => [
  35. { width: 100, field: '工号', key: 'payeeNo' },
  36. { width: 100, field: '姓名', key: 'payeeName' },
  37. { width: 100, field: '收益(元)', key: 'amt' }
  38. ]
  39. },
  40. },
  41. data() {
  42. return {
  43. chartData: {
  44. categories: [],
  45. series: [{
  46. name: '',
  47. data: []
  48. }]
  49. },
  50. tableData: {
  51. current: 1,
  52. total: 0,
  53. list: []
  54. },
  55. reportType: '',
  56. queryDate: '',
  57. loading: false,
  58. opts: {
  59. enableScroll: true,
  60. xAxis: {
  61. rotateLabel: true,
  62. scrollShow: true,
  63. itemCount: 8
  64. },
  65. yAxis: {
  66. showTitle: true,
  67. splitNumber: 5,
  68. data: [{
  69. title: '元',
  70. titleOffsetY: -3
  71. }]
  72. },
  73. legend: {
  74. show: false
  75. },
  76. dataLabel: false,
  77. padding: [20, 10, 10, 10],
  78. extra: {
  79. column: {
  80. width: 20
  81. }
  82. }
  83. }
  84. }
  85. },
  86. methods: {
  87. getData({ reportType, queryDate }) {
  88. if (this.type === 'table') {
  89. this.tableData.current = 1
  90. this.getTableData({ reportType, queryDate })
  91. } else {
  92. this.getChartData({ reportType, queryDate })
  93. }
  94. },
  95. getTableData({ reportType, queryDate }) {
  96. this.loading = true
  97. uni.$u.api.operationalAnalysisApi.getTollCollectorPerformanceApi({
  98. pageNum: this.tableData.current,
  99. pageSize: 10,
  100. reportType,
  101. queryDate
  102. }).then(res => {
  103. if (res.code === 200) {
  104. this.tableData.list = res.rows
  105. this.tableData.total = res.total
  106. }
  107. this.loading = false
  108. }).catch(() => {
  109. this.loading = false
  110. })
  111. },
  112. getChartData({ reportType, queryDate }) {
  113. uni.$u.api.operationalAnalysisApi.getTollCollectorPerformanceApi({
  114. reportType,
  115. queryDate
  116. }).then(res => {
  117. if (res.code === 200) {
  118. if (res.rows && res.rows.length) {
  119. this.chartData.categories = res.rows.map(item => {
  120. return item.payeeName
  121. })
  122. this.chartData.series[0].data = res.rows.map(item => {
  123. return item.amt
  124. })
  125. } else {
  126. this.chartData.categories = []
  127. this.chartData.series[0].data = []
  128. }
  129. }
  130. })
  131. },
  132. pageChange(current) {
  133. this.tableData.current = current
  134. this.getTableData()
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. .performance {
  141. background-color: #fff;
  142. border-radius: 5px;
  143. .empty {
  144. padding: 15px;
  145. }
  146. }
  147. </style>