后端

lecture.vue 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
  4. <el-form-item>
  5. <el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
  6. </el-form-item>
  7. <el-form-item>
  8. <el-button @click="getDataList()">查询</el-button>
  9. <el-button v-if="isAuth('generator:lecture:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
  10. <el-button v-if="isAuth('generator:lecture:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
  11. </el-form-item>
  12. </el-form>
  13. <el-table
  14. :data="dataList"
  15. border
  16. v-loading="dataListLoading"
  17. @selection-change="selectionChangeHandle"
  18. style="width: 100%;">
  19. <el-table-column
  20. type="selection"
  21. header-align="center"
  22. align="center"
  23. width="50">
  24. </el-table-column>
  25. <el-table-column
  26. prop="id"
  27. header-align="center"
  28. align="center"
  29. label="演讲id (演讲/报告表)">
  30. </el-table-column>
  31. <el-table-column
  32. prop="meetingId"
  33. header-align="center"
  34. align="center"
  35. label="会议id">
  36. </el-table-column>
  37. <el-table-column
  38. prop="speaker"
  39. header-align="center"
  40. align="center"
  41. label="演讲人id">
  42. </el-table-column>
  43. <el-table-column
  44. prop="topic"
  45. header-align="center"
  46. align="center"
  47. label="题目">
  48. </el-table-column>
  49. <el-table-column
  50. prop="branchId"
  51. header-align="center"
  52. align="center"
  53. label="所属会场(主会场/分会场)">
  54. </el-table-column>
  55. <el-table-column
  56. prop="speechTime"
  57. header-align="center"
  58. align="center"
  59. label="演讲时间">
  60. </el-table-column>
  61. <el-table-column
  62. prop="summary"
  63. header-align="center"
  64. align="center"
  65. label="摘要">
  66. </el-table-column>
  67. <el-table-column
  68. prop="createTime"
  69. header-align="center"
  70. align="center"
  71. label="創建時間">
  72. </el-table-column>
  73. <el-table-column
  74. prop="isDel"
  75. header-align="center"
  76. align="center"
  77. label="是否被删除 状态 0:正常 1:删除">
  78. </el-table-column>
  79. <el-table-column
  80. fixed="right"
  81. header-align="center"
  82. align="center"
  83. width="150"
  84. label="操作">
  85. <template slot-scope="scope">
  86. <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
  87. <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
  88. </template>
  89. </el-table-column>
  90. </el-table>
  91. <el-pagination
  92. @size-change="sizeChangeHandle"
  93. @current-change="currentChangeHandle"
  94. :current-page="pageIndex"
  95. :page-sizes="[10, 20, 50, 100]"
  96. :page-size="pageSize"
  97. :total="totalPage"
  98. layout="total, sizes, prev, pager, next, jumper">
  99. </el-pagination>
  100. <!-- 弹窗, 新增 / 修改 -->
  101. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
  102. </div>
  103. </template>
  104. <script>
  105. import AddOrUpdate from './lecture-add-or-update'
  106. export default {
  107. data () {
  108. return {
  109. dataForm: {
  110. key: ''
  111. },
  112. dataList: [],
  113. pageIndex: 1,
  114. pageSize: 10,
  115. totalPage: 0,
  116. dataListLoading: false,
  117. dataListSelections: [],
  118. addOrUpdateVisible: false
  119. }
  120. },
  121. components: {
  122. AddOrUpdate
  123. },
  124. activated () {
  125. this.getDataList()
  126. },
  127. methods: {
  128. // 获取数据列表
  129. getDataList () {
  130. this.dataListLoading = true
  131. this.$http({
  132. url: this.$http.adornUrl('/generator/lecture/list'),
  133. method: 'get',
  134. params: this.$http.adornParams({
  135. 'page': this.pageIndex,
  136. 'limit': this.pageSize,
  137. 'key': this.dataForm.key
  138. })
  139. }).then(({data}) => {
  140. if (data && data.code === 0) {
  141. this.dataList = data.page.list
  142. this.totalPage = data.page.totalCount
  143. } else {
  144. this.dataList = []
  145. this.totalPage = 0
  146. }
  147. this.dataListLoading = false
  148. })
  149. },
  150. // 每页数
  151. sizeChangeHandle (val) {
  152. this.pageSize = val
  153. this.pageIndex = 1
  154. this.getDataList()
  155. },
  156. // 当前页
  157. currentChangeHandle (val) {
  158. this.pageIndex = val
  159. this.getDataList()
  160. },
  161. // 多选
  162. selectionChangeHandle (val) {
  163. this.dataListSelections = val
  164. },
  165. // 新增 / 修改
  166. addOrUpdateHandle (id) {
  167. this.addOrUpdateVisible = true
  168. this.$nextTick(() => {
  169. this.$refs.addOrUpdate.init(id)
  170. })
  171. },
  172. // 删除
  173. deleteHandle (id) {
  174. var ids = id ? [id] : this.dataListSelections.map(item => {
  175. return item.id
  176. })
  177. this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
  178. confirmButtonText: '确定',
  179. cancelButtonText: '取消',
  180. type: 'warning'
  181. }).then(() => {
  182. this.$http({
  183. url: this.$http.adornUrl('/generator/lecture/delete'),
  184. method: 'post',
  185. data: this.$http.adornData(ids, false)
  186. }).then(({data}) => {
  187. if (data && data.code === 0) {
  188. this.$message({
  189. message: '操作成功',
  190. type: 'success',
  191. duration: 1500,
  192. onClose: () => {
  193. this.getDataList()
  194. }
  195. })
  196. } else {
  197. this.$message.error(data.msg)
  198. }
  199. })
  200. })
  201. }
  202. }
  203. }
  204. </script>