details.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <div class='flex flex-justify-start full-height'>
  3. <div class="full-height">
  4. <left-bar :active="type === '0' ? -1 : active " :data="data" :stage="stage" @typeChange="typeChange"/>
  5. </div>
  6. <div class="full-height full-width white-bg padding-left padding-top" style="margin-left: 300px">
  7. <proinfo v-if="type === '0'" :data="data" :issue="list" @refInfo="proInfo" @refresh="issueList"/>
  8. <folder-info v-else :id="id" :data='data' :projectStageId="projectStageId" />
  9. </div>
  10. </div>
  11. </template>
  12. <route>
  13. {
  14. name: '项目详情',
  15. meta: { keepAlive: true }
  16. }
  17. </route>
  18. <script>
  19. import leftBar from './component/left_bar.vue'
  20. import proinfo from './component/proinfo.vue'
  21. import folderInfo from './component/folder_info.vue'
  22. export default {
  23. name: '项目详情',
  24. components: { leftBar, proinfo, folderInfo },
  25. watch: {
  26. stage: {
  27. handler (newValue) {
  28. if (newValue) {
  29. this.change(0)
  30. }
  31. },
  32. immediate: true
  33. }
  34. },
  35. data () {
  36. return {
  37. type: '0',
  38. id: '',
  39. data: {},
  40. list: [],
  41. stage: [],
  42. projectStageId: '',
  43. active: -1
  44. }
  45. },
  46. created () {
  47. this.id = this.$route.query.id
  48. this.type = this.$route.query.type
  49. this.proInfo()
  50. this.issueList()
  51. this.getStage()
  52. this.$bus.on('change', (index) => {
  53. this.type = '1'
  54. this.active = index
  55. this.projectStageId = this.stage[index] === undefined ? '' : this.stage[index].id
  56. })
  57. console.log('created')
  58. },
  59. methods: {
  60. typeChange () {
  61. this.type = '0'
  62. },
  63. /**
  64. * 项目信息
  65. */
  66. proInfo () {
  67. this.$api.project.projectInfo(this.id).then(res => {
  68. if (res.code === 200) {
  69. this.data = res.data
  70. }
  71. })
  72. },
  73. /**
  74. * 发行明细
  75. */
  76. issueList () {
  77. this.$api.project.issuanceDetail({ projectId: this.id }).then(res => {
  78. if (res.code === 200) {
  79. this.list = res.data.records
  80. }
  81. })
  82. },
  83. /**
  84. * 获取项目阶段
  85. */
  86. getStage () {
  87. this.$api.project.includeStage({ projectId: this.id }).then(res => {
  88. if (res.code === 200) {
  89. this.stage = res.data.map(e => {
  90. const newItem = {}
  91. newItem.title = e.stageName
  92. newItem.count = e.fileNumber
  93. newItem.isAccess = e.isAccess
  94. newItem.id = e.id
  95. return newItem
  96. })
  97. }
  98. })
  99. },
  100. /**
  101. * 切换项目阶段
  102. * @param res
  103. */
  104. change (res) {
  105. if (this.$route.query.type !== '0') {
  106. this.type = '1'
  107. }
  108. this.projectStageId = this.stage[res] === undefined ? '' : this.stage[res].id
  109. }
  110. }
  111. }
  112. </script>
  113. <style scoped>
  114. </style>