details.vue 3.1 KB

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