SourceDetail.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <script setup>
  2. //数据来源详情
  3. import {ref,watch} from 'vue'
  4. import apiChart from '@/api/chart'
  5. const props = defineProps({
  6. show:{
  7. type:Boolean,
  8. default:false
  9. },
  10. EdbInfoId:{
  11. type:Number,
  12. default:0
  13. },
  14. UniqueCode: {
  15. type:Number,
  16. default: ''
  17. }
  18. })
  19. watch(()=>props.show,()=>{
  20. if(props.show){
  21. getEdbInfo()
  22. }
  23. },{immediate:true})
  24. const edbSourceData = ref([])
  25. async function getEdbInfo(){
  26. const res = await apiChart.getEdbCreateHistory({
  27. UniqueCode:props.UniqueCode
  28. })
  29. if(res.Ret!==200) return
  30. edbSourceData.value = flatTreeData([res.Data]||[]).reverse()
  31. }
  32. function flatTreeData(tree){
  33. let arr = []
  34. let concatData=[]
  35. for(const item of tree){
  36. const {EdbName,RuleTitle} = item
  37. concatData.push({EdbName:EdbName||'',RuleTitle:RuleTitle||''})
  38. if(item.Child&&item.Child.length){
  39. arr = arr.concat(flatTreeData(item.Child))
  40. }
  41. }
  42. arr.push(concatData)
  43. return arr
  44. }
  45. </script>
  46. <template>
  47. <div class="source-detail-wrap">
  48. <div class="top-box">
  49. <span class="title"> 数据来源</span>
  50. </div>
  51. <div class="source-arr-wrap">
  52. <div class="source-item" v-for="(arr,index) in edbSourceData">
  53. <template v-for="item in arr">
  54. <span class="title">{{item.EdbName}}</span>
  55. <span class="text">{{item.RuleTitle}}</span>
  56. </template>
  57. <div class="line" v-if="index!==edbSourceData.length-1"></div>
  58. </div>
  59. </div>
  60. </div>
  61. </template>
  62. <style scoped lang="scss">
  63. .source-detail-wrap{
  64. .top-box{
  65. padding: 32px $page-padding;
  66. border-bottom: 1px solid $border-color;
  67. .title{
  68. font-size: 32px;
  69. font-weight: 600;
  70. }
  71. }
  72. .source-arr-wrap{
  73. display: flex;
  74. flex-direction: column;
  75. padding:40px 80px;
  76. gap:40px;
  77. max-height: 600px;
  78. overflow-y:scroll;
  79. .source-item{
  80. position: relative;
  81. .text{
  82. display: block;
  83. margin: 8px 0;
  84. font-size: 12px;
  85. color: #00000066;;
  86. }
  87. .line{
  88. position:absolute;
  89. left:-33px;
  90. top:36px;
  91. width:1px;
  92. height:100%;
  93. background-color: $theme-color;
  94. }
  95. &::after{
  96. content:'';
  97. position:absolute;
  98. top:0;
  99. left:-40px;
  100. background-color: $theme-color;
  101. width:16px;
  102. height:16px;
  103. border-radius: 50%;
  104. top:8px;
  105. }
  106. }
  107. }
  108. @media screen and (min-width:$media-width){
  109. .top-box{
  110. padding: 16px;
  111. .title{
  112. font-size: 18px;
  113. }
  114. }
  115. .source-arr-wrap{
  116. padding:20px 40px;
  117. gap:20px;
  118. max-height: 300px;
  119. .source-item{
  120. .text{
  121. margin: 8px 0;
  122. font-size: 12px;
  123. }
  124. .line{
  125. position:absolute;
  126. left:-17px;
  127. top:18px;
  128. width:1px;
  129. height:100%;
  130. background-color: $theme-color;
  131. }
  132. &::after{
  133. left: -20px;
  134. width: 8px;
  135. height: 8px;
  136. top:4px;
  137. }
  138. }
  139. }
  140. }
  141. }
  142. </style>