农经大屏
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

index.js 1.8 KiB

1 miesiąc temu
1 miesiąc temu
1 miesiąc temu
1 miesiąc temu
1 miesiąc temu
1 miesiąc temu
1 miesiąc temu
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import Pannel from '@/components/pannel/index.vue';
  2. import ScrollTable from '@/components/scroll-table/index.vue';
  3. import PannelTabs from '@/components/pannel-tabs/index.vue';
  4. import { mapGetters } from 'vuex';
  5. import { analysisOfAmountRanking } from '../../../../api/index.js';
  6. export default {
  7. components: {
  8. PannelTabs,
  9. ScrollTable,
  10. Pannel
  11. },
  12. computed: {
  13. ...mapGetters(['year', 'deptId'])
  14. },
  15. watch: {
  16. year: {
  17. handler () {
  18. this.getData();
  19. },
  20. immediate: true, // 立即执行
  21. },
  22. deptId: {
  23. handler () {
  24. this.getData();
  25. },
  26. immediate: true, // 立即执行
  27. }
  28. },
  29. data () {
  30. return {
  31. tabIndex: '1',
  32. isLoad: false,
  33. headers: ['部门名称', '数量', '排名'],
  34. pannelTabData: [
  35. {
  36. id: '1',
  37. name: '数量'
  38. },
  39. {
  40. id: '2',
  41. name: '金额'
  42. }
  43. ],
  44. data: []
  45. };
  46. },
  47. methods: {
  48. getData () {
  49. if (this.year, this.deptId) {
  50. this.isLoad = false;
  51. analysisOfAmountRanking(this.deptId, this.year).then(res => {
  52. if (this.tabIndex == 1) {
  53. this.headers = ['部门名称', '数量(个)', '排名'];
  54. let data = res.data.sl.map(item => {
  55. return [item.name, item.value, item.index]
  56. })
  57. this.data = data
  58. } else if (this.tabIndex == 2) {
  59. this.headers = ['部门名称', '金额(万元)', '排名'];
  60. let data = res.data.je.map(item => {
  61. return [item.name, item.value, item.index]
  62. })
  63. this.data = data
  64. }
  65. this.isLoad = true;
  66. })
  67. }
  68. },
  69. tabChange (info) {
  70. this.tabIndex = info.id;
  71. this.getData();
  72. }
  73. }
  74. };