branchActive.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div class='m-container'>
  3. <h2>
  4. <div class="squrt"></div>VIP分部活动列表
  5. </h2>
  6. <div class="m-core">
  7. <el-button type="primary" @click="openActive('create')" style="margin-bottom: 20px"
  8. v-permission="'/branchActiveOperationAdd'" >新建</el-button>
  9. <!-- 搜索类型 -->
  10. <save-form :inline="true"
  11. ref="searchForm"
  12. @submit.native.prevent
  13. @submit="onSearch"
  14. @reset="onReset"
  15. :model.sync="searchForm">
  16. <el-form-item prop="search">
  17. <el-input type="text"
  18. v-model.trim="searchForm.search"
  19. @keyup.enter.native='getList'
  20. placeholder="分部活动名"></el-input>
  21. </el-form-item>
  22. <el-form-item prop="rewardMode">
  23. <el-select v-model.trim="searchForm.rewardMode"
  24. clearable
  25. placeholder="分部活动类型">
  26. <el-option v-for="(item,index) in rewardModeTypeList"
  27. :key="index"
  28. :label="item.label"
  29. :value="item.value"></el-option>
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item prop="teacherId">
  33. <el-select v-model.trim="searchForm.teacherId"
  34. clearable
  35. filterable
  36. placeholder="适用老师">
  37. <el-option v-for="item in selects.teachers"
  38. :key="item.id"
  39. :label="item.realName"
  40. :value="item.id"></el-option>
  41. </el-select>
  42. </el-form-item>
  43. <el-form-item prop="vipGroupCategoryId">
  44. <el-select v-model.trim="searchForm.vipGroupCategoryId"
  45. filterable
  46. clearable
  47. placeholder="课程类型">
  48. <el-option v-for="item in selects.vipGroupCategory"
  49. :key="item.id"
  50. :label="item.name"
  51. :value="item.id"></el-option>
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item>
  55. <el-button native-type="submit" type="danger">搜索</el-button>
  56. <el-button native-type="reset" type="primary">重置</el-button>
  57. </el-form-item>
  58. </save-form>
  59. <!-- 列表 -->
  60. <div class="tableWrap">
  61. <el-table :data='tableList'
  62. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  63. <el-table-column align='center'
  64. prop='name'
  65. label="分部活动名">
  66. </el-table-column>
  67. <el-table-column align='center'
  68. prop='rewardMode'
  69. label="分部活动类型">
  70. <template slot-scope="scope">
  71. {{ scope.row.rewardMode | rewardModeTypeFormat }}
  72. </template>
  73. </el-table-column>
  74. <el-table-column align='center'
  75. label="适用老师">
  76. <template slot-scope="scope">
  77. <span style="max-height: 68px;display: block;"
  78. :title="scope.row.teacherNames | joinArray(',')">{{ scope.row.teacherNames | joinArray(',') }}</span>
  79. </template>
  80. </el-table-column>
  81. <el-table-column align='center'
  82. prop='vipGroupCategoryNameList'
  83. label="课程类型">
  84. </el-table-column>
  85. <el-table-column align='center'
  86. label="操作"
  87. width='100'>
  88. <template slot-scope="scope">
  89. <el-button @click="openActive('update', scope.row)"
  90. v-permission="'/branchActiveOperationUpdate'"
  91. type="text">修改</el-button>
  92. </template>
  93. </el-table-column>
  94. </el-table>
  95. <pagination :total.sync="pageInfo.total"
  96. :page.sync="pageInfo.page"
  97. :limit.sync="pageInfo.limit"
  98. sync
  99. :page-sizes="pageInfo.page_size"
  100. @pagination="getList" />
  101. </div>
  102. </div>
  103. </div>
  104. </template>
  105. <script>
  106. import pagination from '@/components/Pagination/index'
  107. import { courseScheduleRewards } from '@/api/systemManage'
  108. import { rewardModeTypeList } from "@/utils/searchArray";
  109. export default {
  110. name: 'branchActive',
  111. components: { pagination },
  112. data () {
  113. return {
  114. rewardModeTypeList,
  115. searchForm: {
  116. search: null,
  117. rewardMode: null,
  118. vipGroupCategoryId: null,
  119. teacherId: null,
  120. },
  121. organId: null,
  122. tableList: [],
  123. pageInfo: {
  124. // 分页规则
  125. limit: 10, // 限制显示条数
  126. page: 1, // 当前页
  127. total: 0, // 总条数
  128. page_size: [10, 20, 40, 50] // 选择限制显示条数
  129. },
  130. }
  131. },
  132. mounted () {
  133. this.getList() // 获取列表数据
  134. this.__init()
  135. },
  136. methods: {
  137. async __init () {
  138. // 获取类型
  139. this.$store.dispatch('setVipGroupCategory')
  140. this.$store.dispatch('setTeachers')
  141. },
  142. getList () {
  143. let params = this.searchForm
  144. params.rows = this.pageInfo.limit
  145. params.page = this.pageInfo.page
  146. courseScheduleRewards(params).then(res => {
  147. if (res.code == 200 && res.data) {
  148. this.tableList = res.data.rows
  149. this.pageInfo.total = res.data.total
  150. }
  151. })
  152. },
  153. openActive (type, row) {
  154. let params = {
  155. path: '/vipClassSet/branchActiveOperation',
  156. query: {
  157. type: type
  158. },
  159. }
  160. let tagTitle = '新建'
  161. if (row) {
  162. params.query.id = row.id
  163. tagTitle = '修改'
  164. }
  165. this.$router.push(params, (route) => {
  166. route.meta.title = tagTitle + 'VIP分部活动'
  167. })
  168. },
  169. onFormClose (formName) { // 关闭弹窗重置验证
  170. this.$refs[formName].clearValidate()
  171. },
  172. onSearch() {
  173. this.$refs.searchForm.validate(valid => {
  174. this.pageInfo.page = 1
  175. this.getList()
  176. })
  177. },
  178. onReset() {
  179. this.$refs.searchForm.resetFields()
  180. this.onSearch()
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss">
  186. .el-button--primary {
  187. background: #14928a;
  188. border-color: #14928a;
  189. color: #fff;
  190. &:hover,
  191. &:active,
  192. &:focus {
  193. background: #14928a;
  194. border-color: #14928a;
  195. color: #fff;
  196. }
  197. }
  198. .el-vue-search-box-container {
  199. position: absolute !important;
  200. left: 10px;
  201. margin-top: 10px;
  202. z-index: 99999 !important;
  203. }
  204. </style>