addCompound.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <div class="fixedBox">
  3. <el-card>
  4. <div class="boxWrap">
  5. <p>临时合课列表<span style="color:red;"> {{compoundList.length}} </span></p>
  6. <el-popover placement="top"
  7. v-model='isLook'
  8. trigger="click">
  9. <div>
  10. <p class="title">临时合课列表 <i class="el-icon-minus minus"
  11. @click="isLook=false"></i></p>
  12. <el-divider></el-divider>
  13. </div>
  14. <el-button type="text"
  15. style="float:right"
  16. @click="clearCom">清空列表</el-button>
  17. <div>
  18. <el-radio-group v-model="radio">
  19. <el-table :data="dataList"
  20. height='300px'
  21. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  22. <el-table-column align='center'
  23. label="主课"
  24. width="110">
  25. <template slot-scope="scope">
  26. <el-radio :label="scope.row.id"></el-radio>
  27. </template>
  28. </el-table-column>
  29. <el-table-column align='center'
  30. width="180px"
  31. label="课程名称"
  32. prop="name"></el-table-column>
  33. <el-table-column align="center"
  34. label="课程类型">
  35. <template slot-scope="scope">
  36. <div>{{ scope.row.type | coursesType}}</div>
  37. </template>
  38. </el-table-column>
  39. <el-table-column align="center"
  40. width="180px"
  41. prop="teacherName"
  42. label="指导老师">
  43. <template slot-scope="scope">
  44. <div>
  45. {{scope.row.teacherName}}({{scope.row.actualTeacherId}})
  46. </div>
  47. </template>
  48. </el-table-column>
  49. <el-table-column align="center"
  50. width="200px"
  51. label="上课时间">
  52. <template slot-scope="scope">{{ scope.row.startClassTime ? scope.row.startClassTime.substr(0, 16) : '' }}-{{ scope.row.endClassTime ? scope.row.endClassTime.substr(11,5) : ''}}</template>
  53. </el-table-column>
  54. <el-table-column align="center"
  55. label="操作">
  56. <template slot-scope="scope">
  57. <el-button type="text"
  58. @click="cancleCom(scope.row)">取消</el-button>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. </el-radio-group>
  63. </div>
  64. <el-button type="primary"
  65. size="mini"
  66. style="float:right;margin-top:20px;"
  67. @click="submitClass">确定</el-button>
  68. <i class="el-icon-copy-document"
  69. slot="reference"></i>
  70. </el-popover>
  71. </div>
  72. </el-card>
  73. <el-dialog :visible.sync="show"
  74. title="临时合课信息"
  75. append-to-body
  76. width="800px">
  77. <compoundClass :show="show"
  78. v-if="show"
  79. @closeReset='closeReset'
  80. :isDisabled='true'
  81. @getList='getList'
  82. :idList='idList'
  83. :id='radio' />
  84. </el-dialog>
  85. </div>
  86. </template>
  87. <script>
  88. import compoundClass from './compoundClass'
  89. export default {
  90. props: ['compoundList'],
  91. components: { compoundClass },
  92. data () {
  93. return {
  94. radio: '',
  95. dataList: this.compoundList,
  96. isLook: false,
  97. show: false,
  98. idList:''
  99. }
  100. },
  101. methods: {
  102. cancleCom (row) {
  103. this.$emit('cancleCompound', row)
  104. },
  105. clearCom () {
  106. this.$emit('clearCom')
  107. },
  108. submitClass () {
  109. if (!this.radio) {
  110. this.$message.error('请选择一节主课')
  111. return
  112. }
  113. let arr = []
  114. let idList = []
  115. this.dataList.forEach(com => {
  116. arr.push(com.type)
  117. idList.push(com.id)
  118. })
  119. arr = [... new Set(arr)]
  120. if (arr.length != 1) {
  121. this.$message.error('请选择相同的课程类型')
  122. return
  123. }
  124. if (this.dataList.length <= 1) {
  125. this.$message.error('请至少选择2节课程')
  126. return
  127. }
  128. // 做判断
  129. this.idList = idList.join(',')
  130. this.show = true;
  131. this.isLook = false
  132. },
  133. getList () {
  134. },
  135. closeReset () {
  136. this.clearCom()
  137. this.show = false
  138. this.$emit('getList')
  139. }
  140. },
  141. watch: {
  142. compoundList (val) {
  143. console.log(val)
  144. this.dataList = val
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .title {
  151. line-height: 44px;
  152. }
  153. .fixedBox {
  154. position: fixed;
  155. bottom: 20px;
  156. right: 10px;
  157. z-index: 100;
  158. width: 200px;
  159. background-color: #fff;
  160. font-size: 14px;
  161. .boxWrap {
  162. display: flex;
  163. flex-direction: row;
  164. justify-content: space-between;
  165. i {
  166. font-size: 18px;
  167. cursor: pointer;
  168. }
  169. }
  170. }
  171. /deep/.el-divider--horizontal {
  172. margin: 0 !important;
  173. }
  174. .minus {
  175. float: right;
  176. line-height: 44px;
  177. padding-right: 20px;
  178. font-size: 20px;
  179. cursor: pointer;
  180. }
  181. </style>