set-classcount.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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-popover
  42. placement="bottom"
  43. title="标题"
  44. width="200"
  45. trigger="click"
  46. content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
  47. <el-switch
  48. v-model="scope.row.active"
  49. active-color=""
  50. active-text="按排名"
  51. inactive-text="随机"
  52. inactive-color="#ff4949"
  53. slot="reference">
  54. </el-switch>
  55. </el-popover>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. </div>
  60. <span slot="footer" class="dialog-footer">
  61. <el-button @click="setShow = false">取 消</el-button>
  62. <el-button type="primary" @click="setShow = false">确 定</el-button>
  63. </span>
  64. </el-dialog>
  65. </template>
  66. <script>
  67. import MxClassTreeTranslateMixin from '@/components/Cache/modules/mx-classTree-translate-mixin.js'
  68. export default {
  69. name: 'set-classcount',
  70. mixins: [MxClassTreeTranslateMixin],
  71. data() {
  72. return {
  73. setShow: false,
  74. settingContainer: [],
  75. roundGroup: {}
  76. }
  77. },
  78. computed: {
  79. // input-number设置公用max
  80. setPubMax() {
  81. return (data) => {
  82. let allSelect = 0
  83. let maxQuantit = this.roundGroup.number
  84. this.settingContainer.forEach((item, index) => {
  85. if (index !== data) {
  86. allSelect += item.actualCount
  87. }
  88. })
  89. return maxQuantit-allSelect
  90. }
  91. },
  92. formatSetting() {
  93. return this.settingContainer.map(item => {
  94. return {
  95. actualCount: item.actualCount,
  96. classId: item.classId,
  97. className: this.getClassName(item.classId),
  98. }
  99. })
  100. },
  101. },
  102. methods: {
  103. open(roundGroup, settingContainer) {
  104. console.log(roundGroup)
  105. console.log(settingContainer)
  106. this.setShow = true
  107. this.roundGroup = roundGroup
  108. this.settingContainer = settingContainer.filter(item => item.groupId == roundGroup.groupId)
  109. },
  110. countEdit(newVal,index){
  111. console.log(newVal)
  112. console.log(index)
  113. this.settingContainer[index].actualCount = newVal.actualCount
  114. },
  115. confirm() {
  116. this.show = false
  117. // int groupId; // 组合ID
  118. // int classId; // 班级
  119. },
  120. }
  121. }
  122. </script>
  123. <style scoped>
  124. </style>