index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <el-card shadow="hover" class="full-height full-width flex flex-col">
  3. <avue-crud
  4. ref="crud"
  5. v-model="form"
  6. v-model:page="page"
  7. :before-open="beforeOpen"
  8. :data="data"
  9. :option="option"
  10. :table-loading="loading"
  11. @row-del="rowDel"
  12. @current-change="currentChange"
  13. @size-change="sizeChange"
  14. @refresh-change="refreshChange"
  15. @on-load="onLoad"
  16. >
  17. </avue-crud>
  18. </el-card>
  19. </template>
  20. <route>
  21. {
  22. path: '/recycle',
  23. name: '回收站',
  24. }
  25. </route>
  26. <script>
  27. export default {
  28. name: 'index',
  29. data() {
  30. return {
  31. keyWords: '',
  32. loading: false,
  33. data: [],
  34. form: {},
  35. page: {
  36. pageSize: 10,
  37. currentPage: 1,
  38. total: 10
  39. },
  40. option: {
  41. calcHeight: 30,
  42. refreshBtn: false,
  43. tip: false,
  44. columnBtn: false,
  45. searchShow: true,
  46. editBtn: true,
  47. editBtnText: '还原',
  48. addBtn: false,
  49. delBtn: true,
  50. border: true,
  51. index: true,
  52. align: 'center',
  53. viewBtn: false,
  54. menuWidth: 260,
  55. dialogClickModal: false,
  56. column: [
  57. {
  58. label: '名称',
  59. prop: 'name',
  60. addDisplay: false,
  61. editDisplay: false
  62. },
  63. {
  64. label: '类型',
  65. prop: 'type',
  66. type: 'select',
  67. dicData: [
  68. {
  69. label: '文件夹',
  70. value: 1
  71. },
  72. {
  73. label: '文件',
  74. value: 2
  75. },
  76. {
  77. label: '项目',
  78. value: 3
  79. },
  80. {
  81. label: '阶段',
  82. value: 4
  83. },
  84. {
  85. label: '专债明细',
  86. value: 5
  87. }
  88. ]
  89. },
  90. {
  91. label: '删除时间',
  92. prop: 'createTime'
  93. },
  94. {
  95. label: '删除人',
  96. prop: 'createUserName'
  97. }
  98. ]
  99. }
  100. }
  101. },
  102. methods: {
  103. onLoad() {
  104. this.loading = true
  105. this.page.current = this.page.currentPage
  106. this.page.size = this.page.pageSize
  107. this.$api.recycle.recycleList(this.page).then(res => {
  108. this.loading = false
  109. if (res.code === 200) {
  110. this.data = res.data.records
  111. this.page.total = res.data.total
  112. }
  113. })
  114. },
  115. beforeOpen(done, type) {
  116. if (type === 'edit') {
  117. this.$confirm('确定恢复所选择的文件?', {
  118. confirmButtonText: '确定',
  119. cancelButtonText: '取消',
  120. type: 'warning'
  121. }).then(() => {
  122. this.$api.recycle
  123. .recycleBack({ recycleBinId: this.form.id })
  124. .then(res => {
  125. if (res.code === 200) {
  126. this.$message.success(res.msg)
  127. this.onLoad()
  128. } else {
  129. this.$message.error(res.msg)
  130. }
  131. })
  132. })
  133. }
  134. },
  135. currentChange(currentPage) {
  136. this.page.currentPage = currentPage
  137. },
  138. sizeChange(pageSize) {
  139. this.page.size = pageSize
  140. },
  141. refreshChange() {
  142. this.onLoad()
  143. },
  144. rowDel(row) {
  145. this.$confirm('确定彻底删除所选择的文件?', {
  146. confirmButtonText: '确定',
  147. cancelButtonText: '取消',
  148. type: 'warning'
  149. }).then(() => {
  150. this.$api.recycle.recycleRemove({ ids: row.id }).then(res => {
  151. if (res.code === 200) {
  152. this.$message.success(res.msg)
  153. this.onLoad()
  154. } else {
  155. this.$message.error(res.msg)
  156. }
  157. })
  158. })
  159. }
  160. }
  161. }
  162. </script>
  163. <style scoped></style>