files.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div class='flex flex-col full-height'>
  3. <div class="full-height white-bg">
  4. <current :id="id" :data="fileData" :total="total" @reFiles="getFileList" @change='changePage'/>
  5. </div>
  6. <div class="full-height full-width white-bg mt-10">
  7. <historical :folderList="historyFolder" :total="total"/>
  8. </div>
  9. </div>
  10. </template>
  11. <route>
  12. {
  13. name:'项目文件',
  14. }
  15. </route>
  16. <script>
  17. import current from './component/current.vue'
  18. import historical from './component/historical.vue'
  19. export default {
  20. name: 'files',
  21. components: { current, historical },
  22. data () {
  23. return {
  24. id: '',
  25. fileData: '',
  26. historyFolder: [],
  27. total: '',
  28. page: {
  29. current: 1,
  30. size: 10
  31. }
  32. }
  33. },
  34. created () {
  35. this.id = this.$route.query.id
  36. this.getFileList()
  37. this.getFolderAll()
  38. this.$bus.on('delete', () => {
  39. this.getFileList()
  40. })
  41. this.$bus.on('reFolder', () => {
  42. this.getFolderAll()
  43. })
  44. },
  45. methods: {
  46. getFileList () {
  47. const data = { folderId: this.id }
  48. this.$api.project.fileList(Object.assign(data, this.page)).then(res => {
  49. if (res.code === 200) {
  50. this.fileData = res.data
  51. } else {
  52. this.$message.error(res.msg)
  53. }
  54. })
  55. },
  56. getFolderAll () {
  57. this.$api.project.folderListAll({ parentId: this.id, type: 1 }).then(res => {
  58. if (res.code === 200) {
  59. this.historyFolder = res.data.records.map(e => {
  60. e.folderName = e.title
  61. e.fileNumber = e.childrenNumber
  62. return e
  63. })
  64. this.total = res.data.total
  65. }
  66. })
  67. },
  68. changePage (page) {
  69. this.page.current = page
  70. this.getFileList()
  71. }
  72. }
  73. }
  74. </script>
  75. <style scoped>
  76. </style>