index.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <div class="pa-3 white fullscreen border-box">
  3. <StatisticsList ref="second" :apis="apis" :search-items="searchConfig"></StatisticsList>
  4. </div>
  5. </template>
  6. <script>
  7. import {
  8. getAccumulatePointStatisticsSummary,
  9. getAccumulatePointStatisticsTop
  10. } from '@/api/accumulatePoint'
  11. import StatisticsList from '@/components/StatisticsList'
  12. import { mapGetters } from 'vuex'
  13. export default {
  14. name: 'accumulatePointsStatistics',
  15. components: {
  16. StatisticsList
  17. },
  18. data () {
  19. return {
  20. apis: [
  21. (query) => {
  22. return new Promise((resolve, reject) => {
  23. getAccumulatePointStatisticsSummary({ avge: false, ...query }).then(resolve).catch(reject)
  24. })
  25. },
  26. (query) => {
  27. return new Promise((resolve, reject) => {
  28. getAccumulatePointStatisticsSummary({ avge: true, ...query }).then(resolve).catch(reject)
  29. })
  30. }
  31. ]
  32. }
  33. },
  34. computed: {
  35. ...mapGetters(['organizationTree']),
  36. searchConfig () {
  37. return [
  38. {
  39. label: '上级机构',
  40. type: 'cascader',
  41. prop: 'parentOrganizationNo',
  42. options: {
  43. filterable: true,
  44. clearable: false,
  45. placeholder: '请选择上级机构',
  46. options: this.organizationTree,
  47. showAllLevels: false,
  48. props: {
  49. emitPath: false,
  50. checkStrictly: true,
  51. value: 'organizationNo',
  52. label: 'organizationName',
  53. children: 'child'
  54. }
  55. }
  56. }
  57. ]
  58. }
  59. },
  60. mounted () {
  61. this.$refs.second.onSetValue({
  62. parentOrganizationNo: this.organizationTree[0].organizationNo
  63. })
  64. this.$refs.second.onInit((items) => {
  65. return new Promise((resolve, reject) => {
  66. items.forEach(ele => {
  67. ele.drillFn = this.drillFn
  68. })
  69. resolve()
  70. })
  71. })
  72. },
  73. methods: {
  74. drillFn (e) {
  75. return new Promise((resolve, reject) => {
  76. getAccumulatePointStatisticsTop({
  77. organizationNo: e.data.organizationNo
  78. }).then(resolve).catch(reject)
  79. })
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. </style>