branchActive.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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.trim="searchForm">
  15. <el-form-item>
  16. <el-input type="text"
  17. v-model.trim="searchForm.search"
  18. @keyup.enter.native='getList'
  19. placeholder="分部活动名"></el-input>
  20. </el-form-item>
  21. <el-form-item>
  22. <el-select v-model.trim="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.trim="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.trim="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. 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="pageInfo.total"
  96. :page.sync="pageInfo.page"
  97. :limit.sync="pageInfo.limit"
  98. :page-sizes="pageInfo.page_size"
  99. @pagination="getList" />
  100. </div>
  101. </div>
  102. </div>
  103. </template>
  104. <script>
  105. import pagination from '@/components/Pagination/index'
  106. import { courseScheduleRewards } from '@/api/systemManage'
  107. import { vipGroupCategory } from "@/api/vipSeting"
  108. import { getTeacher } from '@/api/buildTeam'
  109. import store from '@/store'
  110. export default {
  111. name: 'branchActive',
  112. components: { pagination },
  113. data () {
  114. return {
  115. searchForm: {
  116. search: null,
  117. rewardMode: null,
  118. vipGroupCategoryId: null,
  119. teacherId: null,
  120. },
  121. organId: null,
  122. searchLsit: [],
  123. tableList: [],
  124. vipGroupCategoryList: [],
  125. teacherList: [],
  126. pageInfo: {
  127. // 分页规则
  128. limit: 10, // 限制显示条数
  129. page: 1, // 当前页
  130. total: 0, // 总条数
  131. page_size: [10, 20, 40, 50] // 选择限制显示条数
  132. },
  133. }
  134. },
  135. created () {
  136. if (this.$route.query.searchForm) {
  137. this.$route.query.searchForm instanceof Object ? this.searchForm = this.$route.query.searchForm : this.searchForm = JSON.parse(this.$route.query.searchForm);
  138. }
  139. if (this.$route.query.rules) {
  140. this.$route.query.rules instanceof Object ? this.pageInfo = this.$route.query.rules : this.pageInfo = JSON.parse(this.$route.query.rules);
  141. }
  142. },
  143. activated() {
  144. this.getList()
  145. },
  146. mounted () {
  147. this.getList() // 获取列表数据
  148. this.__init()
  149. },
  150. methods: {
  151. async __init () {
  152. let vipGroupCategoryList = await vipGroupCategory({ page: 1, rows: 9999 })
  153. if (vipGroupCategoryList.code == 200) {
  154. vipGroupCategoryList.data.forEach(item => {
  155. this.vipGroupCategoryList.push({
  156. label: item.name,
  157. value: item.id
  158. })
  159. })
  160. }
  161. let teacherList = await getTeacher()
  162. if (teacherList.code == 200) {
  163. teacherList.data.forEach(item => {
  164. this.teacherList.push({
  165. label: item.realName,
  166. value: item.id
  167. })
  168. })
  169. }
  170. },
  171. getList () {
  172. let params = this.searchForm
  173. params.rows = this.pageInfo.limit
  174. params.page = this.pageInfo.page
  175. courseScheduleRewards(params).then(res => {
  176. if (res.code == 200 && res.data) {
  177. this.tableList = res.data.rows
  178. this.pageInfo.total = res.data.total
  179. }
  180. })
  181. },
  182. openActive (type, row) {
  183. let pageInfo = JSON.stringify(this.pageInfo)
  184. let searchForm = JSON.stringify(this.searchForm)
  185. let params = {
  186. path: '/vipClassSet/branchActiveOperation',
  187. query: {
  188. type: type,
  189. searchForm,
  190. pageInfo
  191. }
  192. }
  193. if (row) {
  194. params.query.id = row.id
  195. }
  196. this.$router.push(params)
  197. },
  198. onFormClose (formName) { // 关闭弹窗重置验证
  199. this.$refs[formName].clearValidate()
  200. }
  201. }
  202. }
  203. </script>
  204. <style lang="scss">
  205. .el-button--primary {
  206. background: #14928a;
  207. border-color: #14928a;
  208. color: #fff;
  209. &:hover,
  210. &:active,
  211. &:focus {
  212. background: #14928a;
  213. border-color: #14928a;
  214. color: #fff;
  215. }
  216. }
  217. .el-vue-search-box-container {
  218. position: absolute !important;
  219. left: 10px;
  220. margin-top: 10px;
  221. z-index: 99999 !important;
  222. }
  223. </style>