index.vue 3.8 KB

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