pro_detail.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div class='flex flex-justify-start'>
  3. <div class="full-height">
  4. <pro-left :data="data" :code='code' @success='listSucc' @change='changeIndex'/>
  5. </div>
  6. <div style='margin-left: 300px;' class='full-width' ref='content'>
  7. <basic-container>
  8. <basic-tab :tabs='tabs' @change='change'></basic-tab>
  9. </basic-container>
  10. <div v-if='currentTab.value === 1'>
  11. <basic-container v-for='(item,index) in resultList' :key='item.id'>
  12. <div class='full-width padding-top' :id="`header`+(index+1)">
  13. <params1 v-if='item.dictKey === "1" ' :info='item'/>
  14. <params2 v-if='item.dictKey === "2" ' :info='item'/>
  15. <params3 v-if='item.dictKey === "3" ' :info='item'/>
  16. <params4 v-if='item.dictKey === "4" ' :info='item'/>
  17. <params5 v-if='item.dictKey === "5" ' :info='item'/>
  18. <params6 v-if='item.dictKey === "6" ' :info='item'/>
  19. </div>
  20. </basic-container>
  21. </div>
  22. <div v-else-if='currentTab.value === 2'>
  23. <basic-container v-for='(item,index) in resultList' :key='item.id'>
  24. <div class='full-width' :id="`header`+(index+1)">
  25. <inspect1 :info='item'/>
  26. </div>
  27. </basic-container>
  28. </div>
  29. <div v-else-if='currentTab.value === 3'>
  30. tab3
  31. </div>
  32. </div>
  33. </div>
  34. </template>
  35. <route>
  36. {
  37. name: '项目详情',
  38. meta: { keepAlive: true }
  39. }
  40. </route>
  41. <script>
  42. import proLeft from '@/views/home/component/pro_left.vue'
  43. import BasicContainer from '@/components/basic-container/main.vue'
  44. import BasicTab from '@/components/basic-tab/index.vue'
  45. import params1 from '@/views/home/component/params/params1.vue'
  46. import params2 from '@/views/home/component/params/params2.vue'
  47. import params3 from '@/views/home/component/params/params3.vue'
  48. import params4 from '@/views/home/component/params/params4.vue'
  49. import params5 from '@/views/home/component/params/params5.vue'
  50. import params6 from '@/views/home/component/params/params6.vue'
  51. import inspect1 from '@/views/home/component/inspect/Inspect1.vue'
  52. export default {
  53. name: 'pro_detail',
  54. components: { BasicContainer, proLeft, BasicTab, params1, inspect1, params2, params3, params4, params5, params6 },
  55. data () {
  56. return {
  57. id: '',
  58. data: {},
  59. tabs: [
  60. { name: '项目信息管理', value: 1, code: 'params_type' },
  61. { name: '项目督查情况', value: 2, code: 'inspect_type' }
  62. // { name: '项目数据明细管理', value: 3 }
  63. ],
  64. currentTab: null,
  65. resultList: [],
  66. code: 'params_type',
  67. url: ''
  68. }
  69. },
  70. created () {
  71. this.id = this.$route.query.id
  72. const tmp = window.location.href
  73. if (tmp.indexOf('#header') > 0) {
  74. this.url = tmp.split('#header')[0]
  75. }
  76. this.currentTab = this.tabs[0]
  77. this.proInfo()
  78. },
  79. methods: {
  80. change (res, index) {
  81. this.currentTab = res
  82. this.code = this.currentTab.code
  83. },
  84. /**
  85. * 项目信息
  86. */
  87. proInfo () {
  88. this.$api.project.projectInfo(this.id).then(res => {
  89. if (res.code === 200) {
  90. this.data = res.data
  91. }
  92. })
  93. },
  94. listSucc (list) {
  95. this.resultList = list
  96. },
  97. changeIndex (index) {
  98. // window.location.hash = '#header' + (index + 1)
  99. document.getElementById('header' + (index + 1)).scrollIntoView()
  100. // this.$nextTick(() => {
  101. // })
  102. }
  103. }
  104. }
  105. </script>
  106. <style scoped>
  107. </style>