branchActive.vue 6.8 KB

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