set-classcount.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <el-dialog
  3. title="设定人数"
  4. :visible.sync="setShow"
  5. :close-on-click-modal="false"
  6. width="50%"
  7. >
  8. <div>
  9. <p style="margin-bottom: 10px;">组合人数为:{{roundGroup.number}}</p>
  10. <el-table
  11. :data="formatSetting"
  12. style="width: 100%"
  13. >
  14. <el-table-column
  15. prop="className"
  16. label="组合"
  17. width="180"
  18. >
  19. <template>
  20. {{roundGroup.groupName}}
  21. </template>
  22. </el-table-column>
  23. <el-table-column
  24. prop="className"
  25. label="班级名称"
  26. width="180"
  27. >
  28. </el-table-column>
  29. <el-table-column
  30. prop="date"
  31. label="人数"
  32. >
  33. <template slot-scope="scope">
  34. <el-input-number :min="0" :max="roundGroup.number?setPubMax(scope.$index):Infinity" v-model="scope.row.actualCount" @change="countEdit(scope.row,scope.$index)" ></el-input-number>
  35. </template>
  36. </el-table-column>
  37. <el-table-column
  38. label="操作"
  39. >
  40. <template slot-scope="scope">
  41. <el-switch
  42. v-model="scope.row.active"
  43. active-color=""
  44. active-text="按排名"
  45. inactive-text="随机"
  46. inactive-color="#ff4949"
  47. >
  48. </el-switch>
  49. </template>
  50. </el-table-column>
  51. </el-table>
  52. </div>
  53. <span slot="footer" class="dialog-footer">
  54. <el-button @click="setShow = false">取 消</el-button>
  55. <el-button type="primary" @click="setShow = false">确 定</el-button>
  56. </span>
  57. </el-dialog>
  58. </template>
  59. <script>
  60. import MxClassTreeTranslateMixin from '@/components/Cache/modules/mx-classTree-translate-mixin.js'
  61. export default {
  62. name: 'set-classcount',
  63. mixins: [MxClassTreeTranslateMixin],
  64. data() {
  65. return {
  66. setShow: false,
  67. settingContainer: [],
  68. roundGroup: {}
  69. }
  70. },
  71. computed: {
  72. // input-number设置公用max
  73. setPubMax() {
  74. return (data) => {
  75. let allSelect = 0
  76. let maxQuantit = this.roundGroup.number
  77. this.settingContainer.forEach((item, index) => {
  78. if (index !== data) {
  79. allSelect += item.actualCount
  80. }
  81. })
  82. return maxQuantit-allSelect
  83. }
  84. },
  85. formatSetting() {
  86. return this.settingContainer.map(item => {
  87. return {
  88. actualCount: item.actualCount,
  89. classId: item.classId,
  90. className: this.getClassName(item.classId),
  91. }
  92. })
  93. },
  94. },
  95. methods: {
  96. open(roundGroup, settingContainer) {
  97. console.log(roundGroup)
  98. console.log(settingContainer)
  99. this.setShow = true
  100. this.roundGroup = roundGroup
  101. this.settingContainer = settingContainer.filter(item => item.groupId == roundGroup.groupId)
  102. },
  103. countEdit(newVal,index){
  104. console.log(newVal)
  105. console.log(index)
  106. this.settingContainer[index].actualCount = newVal.actualCount
  107. },
  108. confirm() {
  109. this.show = false
  110. // int groupId; // 组合ID
  111. // int classId; // 班级
  112. },
  113. }
  114. }
  115. </script>
  116. <style scoped>
  117. </style>