appPage.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div>
  3. <!-- 搜索标题 -->
  4. <div @click="openTeaching('create')"
  5. class='newBand'>新建</div>
  6. <!-- 搜索标题 -->
  7. <save-form :inline="true"
  8. class="searchForm"
  9. saveKey="contentAppPage"
  10. @submit="search"
  11. :model="searchForm">
  12. <el-form-item prop="organIdList">
  13. <el-select class="multiple"
  14. v-model.trim="searchForm.organIdList" clearable
  15. filterable
  16. collapse-tags
  17. multiple
  18. placeholder="请选择分部">
  19. <el-option v-for="(item,index) in selects.branchs"
  20. :key="index"
  21. :label="item.name"
  22. :value="item.id"></el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item>
  26. <el-button native-type="submit" type="danger">搜索</el-button>
  27. </el-form-item>
  28. </save-form>
  29. <!-- 列表 -->
  30. <div class="tableWrap">
  31. <el-table :data='tableList'
  32. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  33. <el-table-column align='center'
  34. label="轮播图">
  35. <template slot-scope="scope">
  36. <img class="bannerImg"
  37. :src="scope.row.coverImage"
  38. alt="">
  39. </template>
  40. </el-table-column>
  41. <el-table-column align='center'
  42. prop="title"
  43. label="标题">
  44. </el-table-column>
  45. <el-table-column align='center'
  46. label="跳转连接">
  47. <template slot-scope="scope">
  48. <overflow-text :text="scope.row.linkUrl"></overflow-text>
  49. <!-- {{ scope.row.linkUrl }} -->
  50. </template>
  51. </el-table-column>
  52. <el-table-column align='center'
  53. prop="remark"
  54. label="是否使用">
  55. <template slot-scope="scope">
  56. {{ scope.row.status == 1 ? '是' : '否' }}
  57. </template>
  58. </el-table-column>
  59. <el-table-column align='center'
  60. prop="memo"
  61. label="版本号">
  62. <template slot-scope="scope">
  63. {{ scope.row.memo ? scope.row.memo : '--' }}
  64. </template>
  65. </el-table-column>
  66. <el-table-column align='center'
  67. prop="order"
  68. label="排序">
  69. </el-table-column>
  70. <el-table-column align="center"
  71. prop="remark"
  72. label="适用分部">
  73. <template slot-scope="scope">
  74. <overflow-text :text="scope.row.organNameList"></overflow-text>
  75. </template>
  76. </el-table-column>
  77. <el-table-column align='center'
  78. label="操作">
  79. <template slot-scope="scope">
  80. <el-button @click="openTeaching('update', scope.row)"
  81. type="text">修改</el-button>
  82. <el-button v-if="scope.row.status == 1"
  83. @click="onStop(scope.row, 0)"
  84. type="text">停用</el-button>
  85. <el-button v-else
  86. @click="onStop(scope.row, 1)"
  87. type="text">启用</el-button>
  88. <el-button @click="onDel(scope.row)"
  89. type="text">删除</el-button>
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. <pagination
  94. saveKey="contentAppPage"
  95. sync :total.sync="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. </template>
  103. <script>
  104. import { newsList, newsUpdate, newsDel } from '@/api/contentManager'
  105. import pagination from '@/components/Pagination/index'
  106. export default {
  107. name: 'training',
  108. components: {
  109. pagination
  110. },
  111. data () {
  112. return {
  113. searchForm: {
  114. organIdList: []
  115. },
  116. tableList: [],
  117. teacherId: this.$route.query.teacherId,
  118. pageInfo: {
  119. // 分页规则
  120. limit: 10, // 限制显示条数
  121. page: 1, // 当前页
  122. total: 1, // 总条数
  123. page_size: [10, 20, 40, 50] // 选择限制显示条数
  124. }
  125. }
  126. },
  127. mounted () {
  128. this.$store.dispatch("setBranchs");
  129. this.getList()
  130. },
  131. methods: {
  132. search() {
  133. this.pageInfo.page = 1
  134. this.getList()
  135. },
  136. getList () {
  137. let params = {
  138. clientName: 'manage',
  139. organIdList: this.searchForm.organIdList ? this.searchForm.organIdList.join(',') : null,
  140. rows: this.pageInfo.limit,
  141. page: this.pageInfo.page,
  142. type: 6
  143. }
  144. newsList(params).then(res => {
  145. if (res.code == 200) {
  146. this.tableList = res.data.rows
  147. this.pageInfo.total = res.data.total
  148. }
  149. })
  150. },
  151. openTeaching (type, rows) {
  152. let params = {}
  153. if (type == 'update') {
  154. params.id = rows.id
  155. }
  156. params.type = 6
  157. params.pageType = type
  158. this.$router.push({
  159. path: '/contentManager/contentOperation',
  160. query: params
  161. })
  162. },
  163. onDel (row) { // 删除
  164. this.$confirm('确定是否删除?', '提示', {
  165. confirmButtonText: '确定',
  166. cancelButtonText: '取消',
  167. type: 'warning'
  168. }).then(() => {
  169. newsDel({ id: row.id }).then(res => {
  170. if (res.code == 200) {
  171. this.$message.success('删除成功')
  172. this.getList()
  173. } else {
  174. this.$message.error(res.msg)
  175. }
  176. })
  177. }).catch(() => { })
  178. },
  179. onStop (row, status) { // 停止
  180. // newsUpdate
  181. let tempStr = ['停用', '启用']
  182. newsUpdate({
  183. id: row.id,
  184. status: status
  185. }).then(res => {
  186. if (res.code == 200) {
  187. this.$message.success(tempStr[status] + '成功')
  188. this.getList()
  189. } else {
  190. this.$message.error(res.msg)
  191. }
  192. })
  193. }
  194. }
  195. }
  196. </script>
  197. <style lang="scss" scoped>
  198. .bannerImg {
  199. height: 60px;
  200. }
  201. </style>