后端

paperrequire.vue 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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('admin:paperrequire:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
  10. <el-button v-if="isAuth('admin:paperrequire: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="">
  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="deadline"
  39. header-align="center"
  40. align="center"
  41. label="截止时间">
  42. </el-table-column>
  43. <el-table-column
  44. prop="name"
  45. header-align="center"
  46. align="center"
  47. label="要求">
  48. </el-table-column>
  49. <el-table-column
  50. prop="createTime"
  51. header-align="center"
  52. align="center"
  53. label="创建时间">
  54. </el-table-column>
  55. <el-table-column
  56. prop="isDel"
  57. header-align="center"
  58. align="center"
  59. label="是否被删除 状态 0:正常 1:删除">
  60. </el-table-column>
  61. <el-table-column
  62. fixed="right"
  63. header-align="center"
  64. align="center"
  65. width="150"
  66. label="操作">
  67. <template slot-scope="scope">
  68. <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
  69. <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
  70. </template>
  71. </el-table-column>
  72. </el-table>
  73. <el-pagination
  74. @size-change="sizeChangeHandle"
  75. @current-change="currentChangeHandle"
  76. :current-page="pageIndex"
  77. :page-sizes="[10, 20, 50, 100]"
  78. :page-size="pageSize"
  79. :total="totalPage"
  80. layout="total, sizes, prev, pager, next, jumper">
  81. </el-pagination>
  82. <!-- 弹窗, 新增 / 修改 -->
  83. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
  84. </div>
  85. </template>
  86. <script>
  87. import AddOrUpdate from './paperrequire-add-or-update'
  88. export default {
  89. data () {
  90. return {
  91. dataForm: {
  92. key: ''
  93. },
  94. dataList: [],
  95. pageIndex: 1,
  96. pageSize: 10,
  97. totalPage: 0,
  98. dataListLoading: false,
  99. dataListSelections: [],
  100. addOrUpdateVisible: false
  101. }
  102. },
  103. components: {
  104. AddOrUpdate
  105. },
  106. activated () {
  107. this.getDataList()
  108. },
  109. methods: {
  110. // 获取数据列表
  111. getDataList () {
  112. this.dataListLoading = true
  113. this.$http({
  114. url: this.$http.adornUrl('/admin/paperrequire/list'),
  115. method: 'get',
  116. params: this.$http.adornParams({
  117. 'page': this.pageIndex,
  118. 'limit': this.pageSize,
  119. 'key': this.dataForm.key
  120. })
  121. }).then(({data}) => {
  122. if (data && data.code === 0) {
  123. this.dataList = data.page.list
  124. this.totalPage = data.page.totalCount
  125. } else {
  126. this.dataList = []
  127. this.totalPage = 0
  128. }
  129. this.dataListLoading = false
  130. })
  131. },
  132. // 每页数
  133. sizeChangeHandle (val) {
  134. this.pageSize = val
  135. this.pageIndex = 1
  136. this.getDataList()
  137. },
  138. // 当前页
  139. currentChangeHandle (val) {
  140. this.pageIndex = val
  141. this.getDataList()
  142. },
  143. // 多选
  144. selectionChangeHandle (val) {
  145. this.dataListSelections = val
  146. },
  147. // 新增 / 修改
  148. addOrUpdateHandle (id) {
  149. this.addOrUpdateVisible = true
  150. this.$nextTick(() => {
  151. this.$refs.addOrUpdate.init(id)
  152. })
  153. },
  154. // 删除
  155. deleteHandle (id) {
  156. var ids = id ? [id] : this.dataListSelections.map(item => {
  157. return item.id
  158. })
  159. this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
  160. confirmButtonText: '确定',
  161. cancelButtonText: '取消',
  162. type: 'warning'
  163. }).then(() => {
  164. this.$http({
  165. url: this.$http.adornUrl('/admin/paperrequire/delete'),
  166. method: 'post',
  167. data: this.$http.adornData(ids, false)
  168. }).then(({data}) => {
  169. if (data && data.code === 0) {
  170. this.$message({
  171. message: '操作成功',
  172. type: 'success',
  173. duration: 1500,
  174. onClose: () => {
  175. this.getDataList()
  176. }
  177. })
  178. } else {
  179. this.$message.error(data.msg)
  180. }
  181. })
  182. })
  183. }
  184. }
  185. }
  186. </script>