branchActive.vue 6.4 KB

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