pro_detail.vue 3.7 KB

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