elective-generation-master.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <div class="fx-column">
  3. <evaluation-empty v-if="isUnPassedStep" :shadow="false" :title="emptyTitle"></evaluation-empty>
  4. <template v-else>
  5. <slot :name="activeKey+'-header'" v-bind="chartBinding"></slot>
  6. <slot :name="activeKey" v-bind="chartBinding">
  7. <elective-generation-table :chart-binding="chartBinding"></elective-generation-table>
  8. </slot>
  9. <slot :name="activeKey+'-footer'" v-bind="chartBinding"></slot>
  10. </template>
  11. </div>
  12. </template>
  13. <script>
  14. import ElectiveGenerationTable from '@/views/elective/generation/components/elective-generation-table'
  15. export default {
  16. name: 'elective-generation-master',
  17. components: { ElectiveGenerationTable },
  18. props: {
  19. generation: {
  20. type: Object
  21. }
  22. },
  23. data() {
  24. return {
  25. emptyTitle: ''
  26. }
  27. },
  28. computed: {
  29. activeKey() {
  30. return this.generation.activeOpt?.key || ''
  31. },
  32. isUnPassedStep() {
  33. if (!this.generation.activeOpt) return false
  34. this.emptyTitle = this.generation.currentOpt == this.generation.options.init
  35. ? '选科还未开启'
  36. : `正在进行${this.generation.currentOpt.title || '{未知进程}'}, 还未进行至${this.generation.activeOpt.title}`
  37. return this.generation.active > this.generation.current
  38. },
  39. categories() {
  40. // summary - categories for display in table
  41. return this.generation.summary.filter(item => item.generation <= this.generation.active)
  42. },
  43. accumulates() {
  44. // summary - accumulate for display in charts
  45. return this.generation.summary.find(item => item.generation == this.generation.active && item.accumulates?.length)
  46. || this.generation.summary.find(item => item.generation == this.generation.active - 1)
  47. },
  48. chartBinding() {
  49. return {
  50. generation: this.generation,
  51. tableData: this.categories,
  52. chartData: this.accumulates
  53. }
  54. }
  55. },
  56. methods: {}
  57. }
  58. </script>
  59. <style scoped>
  60. </style>