round-history.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <div>
  3. <el-button @click="historyVisible=true" size="small" icon="el-icon-alarm-clock">打开选科历史</el-button>
  4. <el-drawer :visible.sync="historyVisible" title="选科历史" size="60%">
  5. <mx-condition :query-params="queryParams" :require-fields="requireFields" @query="handleQuery"
  6. @invalid="handleInvalidQuery"></mx-condition>
  7. <div class="mt20 pl20 pr20">
  8. <mx-table-dynamic :local-data="tableData"></mx-table-dynamic>
  9. </div>
  10. </el-drawer>
  11. </div>
  12. </template>
  13. <script>
  14. import MxCondition from '@/components/MxCondition/mx-condition'
  15. import MxTableDynamic from '@/components/MxTableDynamic/index'
  16. import { getSelectHistory } from '@/api/webApi/selection'
  17. import { mapGetters } from 'vuex'
  18. export default {
  19. name: 'round-history',
  20. components: { MxTableDynamic, MxCondition },
  21. data() {
  22. return {
  23. historyVisible: false,
  24. requireFields: ['year', 'roundId'],
  25. queryParams: {
  26. year: '',
  27. roundId: ''
  28. },
  29. tableData: {
  30. columns: [],
  31. rows: []
  32. }
  33. }
  34. },
  35. computed: {
  36. ...mapGetters(['isFrontMaster'])
  37. },
  38. beforeMount() {
  39. if (this.isFrontMaster) {
  40. this.queryParams = {
  41. ...this.queryParams,
  42. classGradeId: '',
  43. classId: ''
  44. }
  45. }
  46. },
  47. methods: {
  48. handleInvalidQuery() {
  49. this.tableData = {
  50. ...this.tableData,
  51. rows: []
  52. }
  53. },
  54. handleQuery(model) {
  55. getSelectHistory({
  56. year: model.year,
  57. roundId: model.roundId,
  58. gradeIds: model.classGradeId,
  59. classIds: model.classId
  60. }).then(res => {
  61. this.tableData = res.data
  62. })
  63. }
  64. }
  65. }
  66. </script>
  67. <style scoped>
  68. </style>